NSImage的Drawing方法与Compositing方法的对比
来源:互联网 发布:课程可从哪些方面优化 编辑:程序博客网 时间:2024/06/05 18:56
Drawing Versus Compositing
The NSImage
class offers different groups of methods to facilitate drawing your images to the current context. The two main groups of methods can be generally categorized as the “drawing” versus “compositing” methods. There are three “drawing” methods ofNSImage
:
drawAtPoint:fromRect:operation:fraction:
drawInRect:fromRect:operation:fraction:
drawRepresentation:inRect:
The drawing methods are among the most commonly-used methods of NSImage
because of their basic safety. Images are typically rendered in offscreen windows and then copied to the screen as needed. In some cases, several images may be composited into the same window for efficiency reasons. The draw methods use extra safety checking to ensure that only the contents of the current image are ever drawn in one of your views. The same is not true of compositing methods, of which there are the following:
compositeToPoint:operation:
compositeToPoint:fromRect:operation:
compositeToPoint:fromRect:operation:fraction:
compositeToPoint:operation:fraction:
These methods can be more efficient than the drawing methods because they perform fewer checks on the image bounds. These methods do have other behaviors that you need to understand, however. The most important behavior is that the compositing methods undo any scale or rotation factors (but not translation factors) applied to the CTM prior to drawing. If you are drawing in a flipped view or manually applied scaling or rotation values to the current context, these methods will ignore those transformations. Although this might seem like a problem, it actually can be a very useful tool. For example, if your program is scaling a graphic element, you might want to add a scale value to your transform to do the scaling (at least temporarily). If your element uses image-based selection handles, you could use the compositing methods to prevent those handles from being scaled along with the rest of your graphic element.
The other thing to remember about the compositing methods is that none of them allow you to scale your image to a target rectangle. Cocoa composites the entire image (or designated portion thereof) bit-for-bit to the specified location. This is in contrast to the drawInRect:fromRect:operation:fraction:
method, which lets you scale all or part of your image to the designated target rectangle in your view.
Note: The dissolveToPoint:fraction:
and dissolveToPoint:fromRect:fraction:
methods behave in a similar manner as the corresponding compositing methods. Their use is generally more limited though and better support for dissolving images is available through Core Image.
- NSImage的Drawing方法与Compositing方法的对比
- NSImage 存储为jpg或png文件的方法
- JQuery is()与hasClass()方法的对比
- NSImage的坐标系统
- NSImage的作用
- NSImage的缓存
- System::Drawing::Bitmap向CBitmap转换的方法
- C# System.Drawing.Region类的方法使用图解
- 电磁攻击方法与能量攻击方法的对比
- java 静态方法static 与 动态方法的使用对比
- 对NSImage的一个扩展
- NSimage的size和pixels
- 对NSImage的一个扩展
- android的系统升级方法对比
- 古老的线程方法对比
- 各种排序方法的对比。
- android的系统升级方法对比
- J2ME与Android的常用类和方法对比
- 简述Android触摸屏手势识别
- linux install HUAWEI ECC122 data card step by step
- CHANGE THE MAC 10.7 LION LOGIN SCREEN BACKGROUND IMAGE?
- 软件工程概述
- [MFC]ADO 数据库编程参考
- NSImage的Drawing方法与Compositing方法的对比
- 在ubuntu 11.10 64位 上安装adobe flash player
- NSImage的坐标系统
- HDU 4034 Graph The 36th ACM/ICPC Asia Regional Chengdu Site —— Online Contest
- 学习Linux/UNIX编程方法的建议
- Object-C学习笔记二-----面向对象编程基础知识
- HDU 4038 Stone The 36th ACM/ICPC Asia Regional Chengdu Site —— Online Contest
- AndEngine Button(2)——点击切换显示图片Button
- NSImage的作用