- 浏览: 240310 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (118)
- Ruby/ROR (4)
- Mac (28)
- 我的见闻触发你我的灵感 (1)
- 创业 (1)
- JOSSO (2)
- XML (2)
- OpenRemote (1)
- 娱乐 (2)
- 版权/License (1)
- Java/Spring (4)
- 调试 (1)
- 路由器 (2)
- 技术博客 (21)
- 虚拟机 (1)
- Javascript (6)
- SVN (2)
- HA(Home Automation) (0)
- Android (2)
- iPhone/iPod (23)
- iPad (22)
- iOS公共 (28)
- Windows7 (1)
- 服务器技术 (2)
- 其它 (1)
- Shell (1)
- 数据库 (1)
- 问题总结 (1)
最新评论
-
zjjzmw1:
...
转载:IOS开发之——objectForKey与valueForKey在NSDictionary中的差异 -
hldfxh:
解决了我的问题
JSON Lib, XML转JSON字符串不要namespace,以及处理特殊xml属性"type" -
herry68:
可以给我提供以下你的这个NSData+Base64.h类吗
图片转base64串及反转回图片 -
herry68:
我用这个方法把图片转换成nsstring成功了,但是从nsst ...
图片转base64串及反转回图片 -
hibluse:
handy.wang 写道hibluse 写道我已经设置了WA ...
基于FMDB-SQLite的App数据库性能优化
Refered from article "iPhonedrawingwithquarz2d "
Drawing to a Graphics Context in iPhone OS
-------------------------------------------------------
// Obtain this graphics context by calling the UIKit function
CGContextRef context = UIGraphicsGetCurrentContext();
// Save graphics contexts using the functions
UIGraphicsPushContext(context);
// Restore graphics contexts using the functions
UIGraphicsPopContext();
You can create custom graphics context objects in situations where you want to draw somewhere other than your view. For example, you may want to capture a series of drawing commands and use them to create an image or a PDF file. To create the context, you use the
CGBitmapContextCreate or CGPDFContextCreate function. After you have the context, you can pass it to the drawing functions needed to create your content.
When creating custom contexts, the coordinate system for those contexts is different from the native coordinate system used by iPhone OS. Instead of the origin being in the upper-left corner of the drawing surface, it is in the lower-left corner and the axes point up and to the right. Instead of the origin being in the upper-left corner of the drawing surface, it is in the lower-left corner and the axes point up and to the right . The coordinates you specify in your drawing commands must take this into consideration or the resulting image or PDF file may appear wrong when rendered. See “Creating a Bitmap Graphics Context ” (page 39) and “Creating a PDF Graphics Context ” (page 35) for details on using CGBitmapContextCreate and CGPDFContextCreate.
IMPORTANT : Because you use a lower-left origin when drawing into a bitmap or PDF context,you must compensate for that coordinate system when rendering the resulting content into a view. In other words,
if you create an image and draw it using the CGContextDrawImage function, the image will appear upside down by default
. To correct for this, you must invert the y-axis of the CTM (by multiplying it by -1)
and shift the origin from the lower-left corner to the top-right corner of the view.
If you use a UIImage object to wrap a CGImageRef you create, you do not need to modify the CTM
. The UIImage object automatically compensates for the inverted coordinate system of the CGImageRef type.
Creating a PDF Graphics Context
-------------------------------------------------------
When you create a PDF graphics context and draw to that context, Quartz records your drawing as a series of PDF drawing commands written to a file. You supply a location for the PDF output and a default media box —a rectangle that specifies bounds of the page.
The Quartz 2D API provides two functions that create a PDF graphics context:
■ CGPDFContextCreateWithURL
, which you use when you want to specify the location for the PDF output as a Core Foundation URL. Listing 2-4 (page 36) shows how to use this function to create a PDF graphics context.
■ CGPDFContextCreate
, which you use when you want the PDF output sent to a data consumer. (For more information see “Data Management in Mac OS X” (page 131).) Listing 2-5 (page 37) shows how to use this function to create a PDF graphics context.
发表评论
-
图片转base64串及反转回图片
2013-07-29 12:04 2340图片转base64串: UIImage *_ori ... -
iOS中异步函数的单元测试
2013-06-08 09:51 1513转载自:http://blog.csdn.net/diyag ... -
拆数算法(ObjectiveC递归实现)
2013-03-21 10:45 2098把一个大数拆成几个指定的小数相加,以下实现方式性能很差仅供参考 ... -
复杂数据类型变量的引用计数与block以及__block修饰符的关系
2012-12-14 17:05 4896以下结论是结合参考资料和实验得来,不对地方请大家纠正: ... -
基于FMDB-SQLite的App数据库性能优化
2012-12-14 16:48 111821)如果数据库配置成为串行模式:sqlite3_con ... -
Run Loop
2012-08-24 11:12 1261来源:http://www.cnblogs.com/scorp ... -
转载:IOS开发之——objectForKey与valueForKey在NSDictionary中的差异
2012-08-23 15:49 1337来源:http://blog.csdn.net/pjk1 ... -
深拷贝和浅拷贝
2012-08-23 15:44 960来源:http://blog.csdn.net/pjk1129 ... -
静态全局变量的内存问题
2012-08-23 15:43 1178来源:http://blog.csdn.net/pjk1 ... -
如何将iPhone模拟器的分辨率调整至1136x640?
2012-08-09 10:01 3136来源:http://www.weiphone ... -
AtoS查看iOS Crash log中的16进制代码日志
2012-08-02 17:21 3422注意:crash_log一定要和打包时的archive对应上; ... -
Objective-c 中 nil, Nil, NULL和NSNull的区别
2012-08-02 10:40 953来自:http://blog.csdn.net/yhawaii ... -
XCODE4.3.2与真机联调时,console里输出中文乱码
2012-07-19 13:34 1316修改项目的scheme的info,把debugger由LLDB ... -
NSAutoReleasePool使用中drain和release的区别
2012-05-30 14:50 1702虽然ARC引入之后NSAutoReleasePool的使 ... -
Network Link Conditioner in Lion
2012-05-21 14:46 1919Network Link Conditioner in ... -
PushMeBaby中的神秘错误代码OSStatus的实际含义
2012-05-03 09:31 76331)查看SecureTransport.h中 / ... -
NSDefaultRunLoopMode vs NSRunLoopCommonModes
2012-04-20 10:14 5330A run loop is a mechanism th ... -
NSParameterAssert
2012-04-20 09:38 2653NSParameterAssert Valida ... -
线程内sleep
2012-04-19 09:20 1068[NSThread sleepForTim ... -
转换Xcode里打印的unicode编码日志
2012-04-18 20:33 18101)打开Terminal 2)输入python 3)pri ...
相关推荐
### CS193P iOS Application Development - Assignment 1 Walkthrough #### Objective The main objective of this assignment is to reproduce the demonstration given in class, which involves building a ...
iOS多线程开发基础指南, Raywenderlich 出品, Concurrency by Tutorials Multithreading in Swift with GCD and Operations
Discover the powerful capabilities integrated into Core Data, and how to use Core Data in your iOS and OS X projects. All examples are current for OS X El Capitan, iOS 9, and the latest release of ...
#### 1. **Using CloudKit APIs to Store Information in the Cloud** - **Concept**: CloudKit is a powerful framework that enables developers to store data on Apple's servers and synchronize it across ...
Multithreading in Swift with GCD and Operations, Up to date for iOS 12, Xcode 10 & Swift 4.2 Include PDF & EPUB & Source Code
All code has been built and tested on iOS 7, Android 4.3, Windows (OpenGL ES 3.0 Emulation), and Ubuntu Linux, and the authors demonstrate how to build OpenGL ES code for each platform. Coverage ...
1 Scope 1 2 Normative references 2 3 Terms and definitions 3 4 General principles 7 4.1 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.2 Structure ...
You'll learn how to declare variables, assign values, and perform operations using them. - **Data Structures:** Designing and implementing data structures is essential for organizing and storing data...
4.2 Serial Data Input, Output and IOs (DI, DO and IO0, IO1, IO2, IO3) ............................................... 10 4.3 Write Protect (/WP)...........................................................