MSFBitmap
Objective-C
@interface MSFBitmap : NSObject {
void *swigCPtr;
BOOL swigCMemOwn;
}
Swift
class MSFBitmap : NSObject
A class that provides the functionality to store, compress, uncompress and resize basic image formats. Currently supported formats are png and jpeg. Upon loading compressed images will be converted to alpha premultiplied uncompressed bitmaps of various image formats.
-
Checks if this object is equal to the specified object.
Declaration
Objective-C
- (BOOL)isEqual:(id)object;Swift
func isEqual(_ object: Any!) -> BoolParameters
objectThe reference object.
Return Value
True when objects are equal, false otherwise.
-
Returns the hash value of this object.
Declaration
Objective-C
- (NSUInteger)hash;Swift
func hash() -> UIntReturn Value
The hash value of this object.
-
Constructs a bitmap from an already decoded vector of bytes. The bitmap data is expected to be alpha premultiplied, if alpha channel is used. If the power of two conversion flag is set, additional padding will be added to the image to make it’s dimensions power of two. This can be useful when creating OpenGL textures from the Bitmap, because some GPUs perform badly with non power of two textures.
Declaration
Objective-C
- (id)initWithPixelData:(MSFBinaryData *)pixelData width:(unsigned int)width height:(unsigned int)height colorFormat:(enum MSFColorFormat)colorFormat bytesPerRow:(int)bytesPerRow;Swift
init!(pixelData: MSFBinaryData!, width: UInt32, height: UInt32, colorFormat: MSFColorFormat, bytesPerRow: Int32)Parameters
pixelDataA vector of decoded, premultiplied bitmap bytes.
widthThe width of the bitmap.
heightThe height of the bitmap.
colorFormatThe color format of the bitmap.
bytesPerRowThe total number of bytes per row. Some bitmaps have additional padding at the end of each row. If the value is negative, then bitmap is assumed to be vertically flipped. In this case absolute value of the bytesPerRow value is used.
-
Returns the width of the bitmap.
Declaration
Objective-C
- (unsigned int)getWidth;Swift
func getWidth() -> UInt32Return Value
The width of the bitmap.
-
Returns the height of the bitmap.
Declaration
Objective-C
- (unsigned int)getHeight;Swift
func getHeight() -> UInt32Return Value
The height of the bitmap.
-
Returns the color format of this bitmap.
Declaration
Objective-C
- (enum MSFColorFormat)getColorFormat;Swift
func getColorFormat() -> MSFColorFormatReturn Value
The color format of this bitmap.
-
Returns the bytes per pixel parameter of this bitmap. Valid values are 1, 2, 3 and 4.
Declaration
Objective-C
- (unsigned int)getBytesPerPixel;Swift
func getBytesPerPixel() -> UInt32Return Value
The bytes per pixel parameter of this bitmap.
-
Returns a copy of the pixel data of this bitmap.
Declaration
Objective-C
- (MSFBinaryData *)getPixelData;Swift
func getPixelData() -> MSFBinaryData!Return Value
A binary data of the bitmap’s pixel data.
-
Compresses this bitmap to a PNG format.
Declaration
Objective-C
- (MSFBinaryData *)compressToPNG;Swift
func compressToPNG() -> MSFBinaryData!Return Value
A byte vector of the PNG’s data.
-
Compresses this bitmap to a internal format. This operation is intended for serialization of the data only, no actual compression is performed.
Declaration
Objective-C
- (MSFBinaryData *)compressToInternal;Swift
func compressToInternal() -> MSFBinaryData!Return Value
A byte vector of the serialized data.
-
Returns resized version of the bitmap. The power of two padding added during the construction of this bitmap will be removed prior to resizing. If the power of two conversion flag is set, new padding will be added to the image after resizing to make it’s dimensions power of two.
Declaration
Objective-C
- (MSFBitmap *)getResizedBitmap:(unsigned int)width height:(unsigned int)height;Swift
func getResizedBitmap(_ width: UInt32, height: UInt32) -> MSFBitmap!Parameters
widthThe new width of this bitmap.
heightThe new height of this bitmap.
Return Value
The resized bitmap instance or null in case of error (wrong dimensions).
-
Returns sub-bitmap with specified offsets and dimensions.
Declaration
Objective-C
- (MSFBitmap *)getSubBitmap:(int)xOffset yOffset:(int)yOffset width:(int)width height:(int)height;Swift
func getSubBitmap(_ xOffset: Int32, yOffset: Int32, width: Int32, height: Int32) -> MSFBitmap!Parameters
xOffsetX coordinate offset in the bitmap.
yOffsetY coordinate offset in the bitmap.
widthWidth of the sub-bitmap.
heightHeight of the sub-bitmap.
Return Value
Sub-bitmap instance or null in case of error (wrong dimensions).
-
Returns paddedsub-bitmap with specified offsets and dimensions.
Declaration
Objective-C
- (MSFBitmap *)getPaddedBitmap:(int)xPadding yPadding:(int)yPadding;Swift
func getPaddedBitmap(_ xPadding: Int32, yPadding: Int32) -> MSFBitmap!Parameters
xPaddingPadding along X coordinate. If negative value is used, the bitmap is padded from the left. By default, bitmap is padded from the right.
yPaddingPadding along Y coordinate. If negative value is used, the bitmap is padded from the top. By default, bitmap is padded from the bottom.
Return Value
Padded bitmap instance or null in case of error (wrong dimensions).
-
Returns copy of the bitmap converted to RGBA format.
Declaration
Objective-C
- (MSFBitmap *)getRGBABitmap;Swift
func getRGBA() -> MSFBitmap!Return Value
The bitmap with identical dimensions but converted to RGBA format.
-
Creates a new bitmap from compressed byte vector. If the power of two conversion flag is set, additional padding will be added to the image to make it’s dimensions power of two.
Declaration
Objective-C
+ (MSFBitmap *)createFromCompressed:(MSFBinaryData *)compressedData;Swift
class func create(fromCompressed compressedData: MSFBinaryData!) -> MSFBitmap!Parameters
compressedDataThe compressed bitmap data.
Return Value
The bitmap created from the compressed data. If the decompression fails, null is returned.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()