This is NSBitmapImageRep.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s6 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSBitmapImageRep pard s16 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSImageRep : NSObject fs20 fs28 s9 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying (NSImageRep) fi0 NSObject (NSObject) fs20 fs28 s10 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSBitmapImageRep.h fs20 fs28 pard s21 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 An NSBitmapImageRep is an object that can render an image from bitmap data. The data can be in Tag Image File Format (TIFF), or it can be raw image data. If it'27s raw data, the object must be informed about the structure of the image'd0its size, the number of color components, the number of bits per sample, and so on'd0when it'27s first initialized. If it'27s TIFF data, the object can get this information from the various TIFF fields included with the data. fs16 fs28 Although NSBitmapImageReps are often used indirectly, through instances of the NSImage class, they can also be used directly'd0for example to manipulate the bits of an image as you might need to do in a paint program. fs16 fs28 pard s20 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 Setting Up an NSBitmapImageRep pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 A new NSBitmapImageRep is passed bitmap data for an image when it'27s first initialized. An NSBitmapImageRep can also be created from bitmap data that'27s read from a specified rectangle of a focused NSView. fs16 fs28 Although the NSBitmapImageRep class inherits NSImageRep methods that set image attributes, these methods shouldn'27t be used. Instead, you should either allow the object to find out about the image from the TIFF fields or use methods defined in this class to supply this information when the object is initialized. fs16 fs28 pard s20 li477 fi0 ri1007 ql f0 b fs24 fs4 fs24 TIFF Compression pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 TIFF data can be read and rendered after it has been compressed using any one of the four schemes briefly described below: fs16 fs28 pard s23 li4509 fi-3655 ri1007 ql tx4509 tx10432 LZWtab 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. fs16 fs28 fi-3655 fi-3655 PackBitstab Compresses and decompresses without information loss, but may not achieve the same compression ratios as LZW. fs16 fs28 fi-3655 fi-3655 JPEGtab 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. fs16 fs28 fi-3655 fi-3655 CCITTFAXtab Compresses and decompresses 1 bit grayscale images using international fax compression standards CCITT3 and CCITT4. fs16 fs28 fi-3655 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 An NSBitmapImageRep can also produce compressed TIFF data for its image using any of these schemes. fs16 fs28 pard s21 li100 fi0 ri1007 ql f0 b fs24 fs28 Allocating and Initializing a New NSBitmapImageRep Object fs14 fs28 pard s11 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (id)b imageRepWithData:b0 (NSData *)i tiffDatai0 tab Creates and returns an initialized NSBitmapImageRep corresponding to the first image in i tiffDatai0 . fi-6552 fs16 fs28 fi-6552 + (NSArray *)b imageRepsWithData:b0 (NSData *)i tiffData s13 li7030 fi-6553 fi-5796 i0 tab Creates and returns initialized NSBitmapImageRep objects for all the images in i tiffDatai0 . s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithData:b0 (NSData *)i tiffDatai0 tab Initializes a newly allocated NSBitmapImageRep from the first TIFF header and image data found in i tiffData.i0 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithFocusedViewRect:b0 (NSRect)i recti0 tab Initializes the new object using data read from the image contained in the rectangle i recti0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithBitmapDataPlanes:b0 (unsigned char **)i planes s13 li7030 fi-6553 fi-5796 i0 b pixelsWide:b0 (int)i widthi0 tab Initializes the new object from raw bitmap data in the b pixelsHigh:b0 (int)i heighti0 tab tab i planesi0 data buffers. As the data is raw, the other b bitsPerSample:b0 (int)i bpsi0 tab tab arguments specify its attributes. b samplesPerPixel:b0 (int)i spp i0 b hasAlpha:b0 (BOOL)i alpha i0 b isPlanar:b0 (BOOL)i config i0 b colorSpaceName:b0 (NSString *)i colorSpaceName i0 b bytesPerRow:b0 (int)i rowBytes i0 b bitsPerPixel:b0 (int)i pixelBits pard s21 li100 fi0 ri1007 ql f0 b i0 fs48 fs28 Getting Information about the Image fs14 fs28 pard s11 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (int)b bitsPerPixelb0 tab Returns how many bits are needed to specify one pixel. fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b samplesPerPixelb0 tab Returns the number of samples (components) in the data. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b isPlanarb0 tab Returns YES if in planar configuration, NO if meshed. fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b numberOfPlanesb0 tab Returns the number of data planes. fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b bytesPerPlaneb0 tab Returns the number of bytes in each data plane. fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b bytesPerRowb0 tab Returns the number of bytes in a scan line. pard s21 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting Image Data fs14 fs28 pard s11 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (unsigned char *)b bitmapDatab0 tab Returns a pointer to the bitmap data. If the data is planar, returns a pointer to the first plane. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getBitmapDataPlanes:b0 (unsigned char **)i data s13 li7030 fi-6553 fi-5796 i0 tab Provides pointers to each plane of bitmap data. pard s21 li100 fi0 ri1007 ql f0 b fs48 fs28 Producing a TIFF Representation of the Image fs14 fs28 pard s11 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSData *)b TIFFRepresentationOfImageRepsInArray:b0 (NSArray *)i anArray s13 li7030 fi-6553 fi-5796 i0 tab Returns a TIFF representation of the images in the specified NSArray, using the compression that'27s returned by b getCompression:factor:b0 (if applicable). s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSData *)b TIFFRepresentationOfImageRepsInArray:b0 (NSArray *)i anArray s13 li7030 fi-6553 fi-5796 i0 b usingCompression:b0 (NSTIFFCompression)i compressionType i0 b factor:b0 (float)i factori0 tab Returns a TIFF representation of the images in the specified NSArray, which are compressed using i compressionTypei0 and i factori0 . If the specified compression isn'27t applicable, no compression is used. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSData *)b TIFFRepresentationtab b0 Returns a TIFF representation of the image, using the compression that'27s returned by b getCompression:factor:b0 (if applicable). fi-6552 fs16 fs28 fi-6552 {f3 -} (NSData *)b TIFFRepresentationUsingCompression:b0 (NSTIFFCompression)i compressionType s13 li7030 fi-6553 fi-5796 i0 b factorb0 :(float)i factortab i0 Returns a compressed TIFF representation of the imagei , i0 having the specified compression type and compression factor. If the specified compression isn'27t applicable, no compression is used. Raises NSTIFFException if an atempt is made to create a TIFF representation using OpenStep custom color space bitmaps. pard s21 li100 fi0 ri1007 ql f0 b fs48 fs28 Setting and Checking Compression Types fs14 fs28 pard s11 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (void)b getTIFFCompressionTypes:b0 (const NSTIFFCompression **)i listi0 tab s13 li7030 fi-6553 fi-5796 b count:b0 (int *)i numTypesi0 tab Returns all available compression types. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b localizedNameForTIFFCompressionType:b0 (NSTIFFCompression)i compression s13 li7030 fi-6553 fi-5796 i0 tab Returns the localized name for the compression type. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b canBeCompressedUsing:b0 (NSTIFFCompression)i compression s13 li7030 fi-6553 fi-5796 i0 tab Returns YES if the image can be compressed using the specified type of compression. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCompression:b0 (NSTIFFCompression *)i compressioni0 tab s13 li7030 fi-6553 fi-5796 b factor:b0 (float *)i factori0 tab Returns, in its arguments, the compression type and compression factor. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b setCompression:b0 (NSTIFFCompression)i compressioni0 tab s13 li7030 fi-6553 fi-5796 b factor:b0 (float)i factori0 tab Sets the compression type and compression factor. s11 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.