Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSBitmapImageRepMBS class

Super class: NSImageRepMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa Drawing MBS MacBase Plugin 12.0 Yes No No Yes, macOS only No
Function: The NSBitmapImageRep class renders an image from bitmap data.
Notes:
Bitmap data formats supported include GIF, JPEG, TIFF, PNG, and various permutations of raw bitmap data.

Alpha Premultiplication

If a coverage (alpha) plane exists, a bitmap's color components are premultiplied with it. If you modify the contents of the bitmap, you are therefore responsible for premultiplying the data. For this reason, though, if you want to manipulate the actual data, an NSBitmapImageRep object is not recommended for storage. If you need to work with data that is not premultiplied, you should use Quartz, specifically CGImageCreate with kCGImageAlphaLast.

Note that premultiplying does not affect the output quality. Given source bitmap pixel s, destination pixel d, and alpha value a, a blend is basically

d' = a * s + (1 - a) * d

All premultiplication does is precalculate a * s.
Subclass of the NSImageRepMBS class.

Feedback, Comments & Corrections

Bitmap Format Constants

Constant Value Description
NSAlphaFirstBitmapFormat 1 If 0, alpha values are the last component.
For example, CMYKA and RGBA.
Available in Mac OS X v10.4 and later.
NSAlphaNonpremultipliedBitmapFormat 2 If 0, alpha values are premultiplied.
Available in Mac OS X v10.4 and later.
NSFloatingPointSamplesBitmapFormat 4 If 0, samples are integer values.
Available in Mac OS X v10.4 and later.

Image format file type constants

Constant Value Description
NSBMPFileType 1 Windows bitmap image (BMP) format
NSGIFFileType 2 Graphics Image Format (GIF), originally created by CompuServe for online downloads
NSJPEG2000FileType 5 JPEG 2000 file format.
NSJPEGFileType 3 JPEG format.
NSPNGFileType 4 Portable Network Graphics (PNG) format.
NSTIFFFileType 0 Tagged Image File Format (TIFF)

Image Loading State Constants

Constant Value Description
NSImageRepLoadStatusCompleted -6 Enough data has been provided to successfully decompress the image (regardless of the complete: flag).
NSImageRepLoadStatusInvalidData -4 An error occurred during image decompression. The image contains the portions of the data that have already been successfully decompressed, if any.
NSImageRepLoadStatusReadingHeader -2 The image format is known, but not enough data has been read to determine the size, depth, etc., of the image. You should continue to provide more data.
NSImageRepLoadStatusUnexpectedEOF -5 incrementalLoadFromData was called with true, but not enough data was available for decompression. The image contains the portions of the data that have already been successfully decompressed, if any.
NSImageRepLoadStatusUnknownType -1 Not enough data to determine image format. You should continue to provide more data.
NSImageRepLoadStatusWillNeedAllData -3 Incremental loading cannot be supported. Until you call incrementalLoadFromData with true, this status will be returned. You can continue to call the method but no decompression will take place. Once you do call the method with true, then the image will be decompressed and one of the final three status messages will be returned.

Tiff Compression Constants

Constant Value Description
NSTIFFCompressionCCITTFAX3 3 CCITT Fax Group 3 compression.
Used for 1-bit fax images sent over telephone lines.
NSTIFFCompressionCCITTFAX4 4 CCITT Fax Group 4 compression.
Used for 1-bit fax images sent over ISDN lines.
NSTIFFCompressionJPEG 6 JPEG compression. No longer supported for input or output.
NSTIFFCompressionLZW 5 LZW compression.
NSTIFFCompressionNEXT 32766 NeXT compressed. Supported for input only.
NSTIFFCompressionNone 1 No compression.
NSTIFFCompressionOldJPEG 32865 Old JPEG compression. No longer supported for input or output.
NSTIFFCompressionPackBits 32773 PackBits compression.

Super class NSImageRepMBS

This class has no sub classes.

Some methods using this class:

Some examples which use this class:


The items on this page are in the following plugins: MBS MacBase Plugin.


NSBezierPathMBS   -   NSBoxMBS




Links
MBS Xojo tutorial videos