NSImage和NSImageRep
来源:互联网 发布:淘宝买发票 编辑:程序博客网 时间:2024/05/17 07:30
The NSImage
class provides the high-level interface for manipulating images in many different formats. Because it provides the high-level interface,NSImage
knows almost nothing about managing the actual image data. Instead, the NSImage
class manages one or more image representation objects—objects derived from theNSImageRep
class. Each image representation object understands the image data for a particular format and is capable of rendering that data to the current context.
The following sections provide insight into the relationship between image objects and image representations.
Image Representations
An image representation object represents an image at a specific size, using a specific color space, and in a specific data format. Image representations are used by anNSImage
object to manage image data. An image representation object knows how to read image data from a file, write that data back to a file, and convert the image data to a raw bitmap that can then be rendered to the current context. Some image representations also provide an interface for manipulating the image data directly.
For file-based images, NSImage
creates an image representation object for each separate image stored in the file. Although most image formats support only a single image, formats such as TIFF allow multiple images to be stored. For example, a TIFF file might store both a full size version of an image and a thumbnail.
If you are creating images dynamically, you are responsible for creating the image representation objects you need for your image. As with file-based images, most of the images you create need only a single image representation. BecauseNSImage
is adept at scaling and adjusting images to fit the target canvas, it is usually not necessary to create different image representations at different resolutions. You might create multiple representations in the following situations, however:
For printing, you might want to create a PDF representation or high-resolution bitmap of your image.
You want to provide different content for your image when it is scaled to different sizes.
When you draw an image, the NSImage
object chooses the representation that is best suited for the target canvas. This choice is based on several factors, which are explained in“How an Image Representation Is Chosen.” If you want to ensure that a specific image representation is used, you can use thedrawRepresentation:inRect:
method of NSImage
.
- NSImage和NSImageRep
- NSImage
- NSimage的size和pixels
- 解决JPG文件和NSImage分辨率不同的问题
- save NSImage instance
- NSImage的坐标系统
- NSImage的作用
- NSImage的缓存
- NSImage加载图片
- NSImage加载图片
- NSImage加载图片
- 对NSImage的一个扩展
- NSImage rotated degrees—question
- 对NSImage的一个扩展
- 判断NSImage能否显示出来
- NSImage,CFImage常规操作(转)
- 图片数据类型转换 NSImage、CIImage、CGImageRef
- 图片数据类型转换 NSImage、CIImage、CGImageRef
- import/export win7中电源计划
- FTP数字代码的意义
- HDU 4033 4036 4039 The 36th ACM/ICPC Asia Regional Chengdu Site —— Online Contest
- Android系统默认Home应用程序(Launcher)的启动过程源代码分析
- 函数中实参与9/11
- NSImage和NSImageRep
- 软件工程第一章总结
- 测试一下自己生成的分类器xml 可不可以用 ~~
- 编译时、运行时调通过指针将用到哪个虚函数、非虚函数、成员变量
- 开发过程中两种项目管理方式
- 论对PHD实时数据库的看法
- Windows网络编程经验小结
- 在Domino中使用LOG4J遇到java.security.AccessControlException的解决办法
- (*(volatile unsigned *)0x56000010)解释。