Inherits from: NSImageRep : NSObject
Package: com.apple.yellow.application
An NSBitmapImageRep is an object that can render an image from bitmap data. The data can be in Tag Image File Format (TIFF), Windows bitmap format (BMP), or it can be raw image data. If it's raw data, the object must be informed about the structure of the image-its size, the number of color components, the number of bits per sample, and so on-when it's first initialized. If it's TIFF or BMP data, the object can get this information from the various fields included with the data.
Although NSBitmapImageReps are often used indirectly, through instances of the NSImage class, they can also be used directly-for example to manipulate the bits of an image as you might need to do in a paint program.
You pass bitmap data for an image to a new NSBitmapImageRep when you first initialize it. You can also create an NSBitmapImageRep from bitmap data that's read from a specified rectangle of a focused NSView.
Although the NSBitmapImageRep class inherits NSImageRep methods that set image attributes, these methods shouldn't be used. Instead, you should either allow the object to find out about the image from the fields included with the bitmap data, or use methods defined in this class to supply this information when the object is initialized.
TIFF data can be read and rendered after it has been compressed using any one of the four schemes briefly described below:
LZW | Compresses and decompresses without information loss, achieving compression ratios up to 5:1. It may be somewhat slower to compress and decompress than the PackBits scheme. |
PackBits | Compresses and decompresses without information loss, but may not achieve the same compression ratios as LZW. |
JPEG | Compresses and decompresses with some information loss, but can achieve compression ratios anywhere from 10:1 to 100:1. The ratio is determined by a user-settable factor ranging from 1.0 to 255.0, with higher factors yielding greater compression. More information is lost with greater compression, but 15:1 compression is safe for publication quality. Some images can be compressed even more. JPEG compression can be used only for images that specify at least 4 bits per sample. |
CCITTFAX | Compresses and decompresses 1 bit gray-scale images using international fax compression standards CCITT3 and CCITT4. |
An NSBitmapImageRep can also produce compressed TIFF data for its image using any of these schemes.
- Creating an NSBitmapImageRep
- imageRepsWithData
- imageRepWithData:
- - initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:
- - initWithBitmapHandle:
- - initWithData:
- - initWithFocusedViewRect:
- - initWithIconHandle:
- Getting information about the image
- bitsPerPixel
- bytesPerPlane
- bytesPerRow
- isPlanar
- numberOfPlanes
- samplesPerPixel
- Getting image data
- bitmapData
- - getBitmapDataPlanes:
- Producing a TIFF representation of the image
- TIFFRepresentationOfImageReps
- TIFFRepresentationOfImageRepsInArray:usingCompression:factor:
- TIFFRepresentation
- - TIFFRepresentationUsingCompression:factor:
- Setting and checking compression types
- localizedNameForTIFFCompressionType
- - canBeCompressedUsing:
- - getCompression:factor:
- setCompressionWithFactor
public NSBitmapImageRep()
public NSBitmapImageRep(NSRect aNSRect)
public NSBitmapImageRep(NSData aNSData)
public NSBitmapImageRep(int anInt, int anInt, int anInt, int anInt, boolean aBoolean, boolean aBoolean, java.lang.String aString, int anInt, int anInt)
public static NSBitmapImageRep imageRep(com.apple.yellow.foundation.NSData aNSData)
public static NSArray imageRepsWithData(NSData bitmapData)
public static java.lang.String localizedNameForTIFFCompressionType(int anInt)
public static com.apple.yellow.foundation.NSData representationOfImageRepsInArray(com.apple.yellow.foundation.NSArray aNSArray, int anInt, com.apple.yellow.foundation.NSDictionary aNSDictionary)
public static int[] TIFFCompressionTypes()
public static NSData TIFFRepresentationOfImageReps(NSArray aNSArray, int anInt, float aFloat)
public static NSData TIFFRepresentationOfImageReps(NSArray array)
If a problem is encountered during generation of the TIFF, TIFFRepresentationOfImageRepsInArray throws an exception.
See Also: TIFFRepresentation
public byte[] bitmapData()
See Also: - getBitmapDataPlanes:
public byte[][] bitmapDataPlanes()
public int bitsPerPixel()
public int bytesPerPlane()
See Also: bytesPerRow
public int bytesPerRow()
See Also: bytesPerPlane
public boolean canBeCompressedUsingType(int anInt)
public void colorizeByMappingGray(float aFloat, NSColor aNSColor, NSColor aNSColor, NSColor aNSColor)
public float compressionFactor()
public int compressionType()
public boolean isPlanar()
See Also: samplesPerPixel
public int numberOfPlanes()
See Also: samplesPerPixel, - hasAlpha (NSImageRep) - bitsPerSample (NSImageRep)
public NSData representationUsingType(int anInt, NSDictionary aNSDictionary)
public int samplesPerPixel()
See Also: - hasAlpha (NSImageRep) - bitsPerSample (NSImageRep)
public void setBitmapData(byte[] aByte[])
public void setBitmapDataPlanes(byte[][] aByte[][])
public void setCompressionWithFactor(int compression, float factor)
When an NSBitmapImageRep is created, the instance stores the compression type and factor for the source data. TIFFRepresentation and TIFFRepresentationOfImageRepsInArray: (class method) try to use the stored compression type and factor. Use this method to change the compression type and factor.
See Also: - canBeCompressedUsing:
public void setProperty(java.lang.String aString, java.lang.Object anObject)
public NSData TIFFRepresentation()
If a problem is encountered during generation of the TIFF, TIFFRepresentation throws an exception.
See Also: TIFFRepresentationOfImageReps
public com.apple.yellow.foundation.NSData TIFFRepresentation(int anInt, float aFloat)
public java.lang.Object valueForProperty(java.lang.String aString)