Platforms to show: All Mac Windows Linux Cross-Platform
NSBitmapImageRepMBS class
Super class: NSImageRepMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Drawing | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
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.
- 11 properties
- property bitmapData as Ptr
- property bitmapFormat as Integer
- property bitsPerPixel as Integer
- property bytesPerPlane as Integer
- property bytesPerRow as Integer
- property CGImage as Variant
- property colorSpace as NSColorSpaceMBS
- property isPlanar as Boolean
- property numberOfPlanes as Integer
- property samplesPerPixel as Integer
- property valueForProperty(key as string) as Variant
- 12 methods
- method bitmapImageRepByConvertingToColorSpace(colorSpace as NSColorSpaceMBS, renderingIntent as Integer) as NSBitmapImageRepMBS
- method bitmapImageRepByRetaggingWithColorSpace(newSpace as NSColorSpaceMBS) as NSBitmapImageRepMBS
- method BMPRepresentation(properties as dictionary = nil) as Memoryblock
- method canBeCompressedUsing(compression as Integer) as Boolean
- method Constructor(data as Memoryblock)
- method Constructor(pic as Picture)
- method Constructor(pixelsWide as Integer, pixelsHigh as Integer, bitsPerSample as Integer, samplesPerPixel as Integer, hasAlpha as boolean, colorSpaceName as string, bytesPerRow as Integer, bitsPerPixel as Integer)
- method GIFRepresentation(properties as dictionary = nil) as Memoryblock
- method JPEGRepresentation(properties as dictionary = nil) as Memoryblock
- method PNGRepresentation(properties as dictionary = nil) as Memoryblock
- method TIFFRepresentation as Memoryblock
- method TIFFRepresentation(properties as dictionary = nil) as Memoryblock
- 19 shared methods
- shared method imageRepWithCGImage(CGImage as Variant) as NSBitmapImageRepMBS
- shared method imageRepWithCGImageRef(CGImageHandle as Integer) as NSBitmapImageRepMBS
- shared method imageRepWithCIImage(CIImage as variant) as NSBitmapImageRepMBS
- shared method imageRepWithCIImageRef(CIImageHandle as Integer) as NSBitmapImageRepMBS
- shared method imageRepWithData(data as Memoryblock) as NSBitmapImageRepMBS
- shared method NSImageColorSyncProfileData as string
- shared method NSImageCompressionFactor as string
- shared method NSImageCompressionMethod as string
- shared method NSImageCurrentFrame as string
- shared method NSImageCurrentFrameDuration as string
- shared method NSImageDitherTransparency as string
- shared method NSImageEXIFData as string
- shared method NSImageFallbackBackgroundColor as string
- shared method NSImageFrameCount as string
- shared method NSImageGamma as string
- shared method NSImageInterlaced as string
- shared method NSImageLoopCount as string
- shared method NSImageProgressive as string
- shared method NSImageRGBColorTable as string
- 23 constants
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
- 10 properties
- property bitsPerSample as Integer
- property colorSpaceName as String
- property Handle as Integer
- property hasAlpha as Boolean
- property height as Double
- property isOpaque as Boolean
- property pixelsHigh as Integer
- property pixelsWide as Integer
- property size as NSSizeMBS
- property width as Double
- 2 methods
- method Constructor Private
- method setSize(width as Double, height as Double)
- shared method canInitWithData(data as memoryblock) as Boolean
Constants
Constant | Value | Description |
---|---|---|
NSImageRepMatchesDevice | 0 | One of the constants used by NSImageRep to denote an attribute whose value changes to match the display device. Indicates that the value of certain attributes, such as the number of colors or bits per sample, will change to match the display device. more |
This class has no sub classes.
Some methods using this class:
- NSGraphicsMBS.Constructor(targetImage as NSBitmapImageRepMBS)
- NSGraphicsMBS.graphicsContextWithNSBitmapImageRep(targetImage as NSBitmapImageRepMBS) as NSGraphicsMBS
Some examples using this class:
Blog Entries
- MBS Xojo Plugins, version 17.2pr1
- MBS Xojo / Real Studio Plugins, version 14.2pr3
- MBS Xojo / Real Studio Plugins, version 13.5pr5
- MBS Real Studio Plugins, version 12.3pr7
- MBS Real Studio Plugins, version 12.0pr5
Release notes
- Version 17.2
- Added NSBitmapImageRepMBS.bitmapImageRepByConvertingToColorSpace.
The items on this page are in the following plugins: MBS MacBase Plugin.