DrawKit
Vector and illustration framework for Mac OS X
|
This category provides methods for exporting drawings in a variety of formats, such as TIFF, JPEG and PNG. More...
Instance Methods | |
(CGImageRef) | - CGImageWithResolution:hasAlpha: |
Creates the initial bitmap image that the various bitmap formats are created from. More... | |
(CGImageRef) | - CGImageWithResolution:hasAlpha:relativeScale: |
(NSData *) | - JPEGDataWithProperties: |
Returns JPEG data for the drawing. More... | |
(NSData *) | - JPEGDataWithResolution:quality:progressive: |
Returns JPEG data for the drawing or nil if there was a problem. More... | |
(NSArray *) | - layerBitmapsWithDPI: |
Returns an array of bitmaps (NSBitmapImageReps) one per layer. More... | |
(NSData *) | - multipartTIFFDataWithResolution: |
Returns TIFF data. More... | |
(NSData *) | - PNGDataWithProperties: |
Returns PNG data for the drawing. More... | |
(NSData *) | - PNGDataWithResolution:gamma:interlaced: |
(NSData *) | - thumbnailData |
Returns JPEG data for the drawing at 50% actual size, with 50% quality. More... | |
(NSData *) | - TIFFDataWithProperties: |
Returns TIFF data for the drawing. More... | |
(NSData *) | - TIFFDataWithResolution:compressionType: |
Returns TIFF data for the drawing or nil if there was a problem. More... | |
This category provides methods for exporting drawings in a variety of formats, such as TIFF, JPEG and PNG.
This category provides methods for exporting drawings in a variety of formats, such as TIFF, JPEG and PNG. As these are all bitmap formats, a way to specify the resolution of the exported image is also provided. All methods return NSData that is the formatted image data - this can be written directly as a file of the designated kind.
All image export starts with the pdf representation of the drawing as exported directly by DKDrawing. This is then imaged into a new bitmap image rep before conversion to the final format. The use of the pdf data ensures that results are consistent and require no major knowledge of the drawing's internals.
All images are exported in 24/32 bit full colour.
dpi is specified directly, e.g. 72 for 72 dpi, 150 for 150 dpi, etc. The image size will be the drawing size scaled by the dpi, so a 144dpi image will be twice as wide and twice as high as the drawing. If the dpi passed does not result in a whole multiple of the drawing size, it is rounded up to the nearest whole value that is.
This uses Image I/O to perform the data encoding.
- (CGImageRef) CGImageWithResolution: | (NSInteger) | dpi | |
hasAlpha: | (BOOL) | hasAlpha | |
Creates the initial bitmap image that the various bitmap formats are created from.
Returned ref is autoreleased. The image always has an alpha channel, but the <hasAlpha> flag will paint the background in the paper colour if hasAlpha is NO.
dpi | the resolution of the image in dots per inch. |
hasAlpha | specifies whether the image is painted in the background paper colour or not. |
relScale | scaling factor, 1.0 = actual size, 0.5 = half size, etc. |
Extends class DKDrawing.
- (CGImageRef) CGImageWithResolution: | (NSInteger) | dpi | |
hasAlpha: | (BOOL) | hasAlpha | |
relativeScale: | (CGFloat) | relScale | |
Extends class DKDrawing.
- (NSData*) JPEGDataWithProperties: | (NSDictionary *) | props |
Returns JPEG data for the drawing.
props | various parameters and properties |
Extends class DKDrawing.
- (NSData*) JPEGDataWithResolution: | (NSInteger) | dpi | |
quality: | (CGFloat) | quality | |
progressive: | (BOOL) | progressive | |
Returns JPEG data for the drawing or nil if there was a problem.
This is a convenience wrapper around the dictionary-based methods above
dpi | the resolution in dots per inch |
quality | a value 0..1 that indicates the amount of compression - 0 = max, 1 = none. |
progressive | YES if the data is progressive, NO otherwise |
Extends class DKDrawing.
- (NSArray*) layerBitmapsWithDPI: | (NSUInteger) | dpi |
Returns an array of bitmaps (NSBitmapImageReps) one per layer.
The lowest index is the bottom layer. Hidden layers and non-printing layers are excluded.
dpi | the desired resolution in dots per inch. |
Extends class DKDrawing.
- (NSData*) multipartTIFFDataWithResolution: | (NSUInteger) | dpi |
Returns TIFF data.
Each layer is written as a separate image. This is not the same as a layered TIFF however.
dpi | the desired resolution in dots per inch. |
Extends class DKDrawing.
- (NSData*) PNGDataWithProperties: | (NSDictionary *) | props |
Returns PNG data for the drawing.
props | various parameters and properties |
Extends class DKDrawing.
- (NSData*) PNGDataWithResolution: | (NSInteger) | dpi | |
gamma: | (CGFloat) | gamma | |
interlaced: | (BOOL) | interlaced | |
Extends class DKDrawing.
- (NSData*) thumbnailData |
Returns JPEG data for the drawing at 50% actual size, with 50% quality.
Useful for e.g. generating QuickLook thumbnails
Extends class DKDrawing.
- (NSData*) TIFFDataWithProperties: | (NSDictionary *) | props |
Returns TIFF data for the drawing.
props | various parameters and properties |
Extends class DKDrawing.
Returns TIFF data for the drawing or nil if there was a problem.
This is a convenience wrapper around the dictionary-based methods above
dpi | the resolution in dots per inch |
compType | a valid TIFF compression type (see NSBitMapImageRep.h) |
Extends class DKDrawing.