Contents
Navigation
Home User Reference Other Resources


The QTPlgImage class is the base class of a set of classes that provide services intended to be used for managing uncompressed still images within the QTPlugin. The classes derived from it provide support for some of the more common types of uncompressed visual data such as 8–bit greyscale char and float images, 16–bit greyscale, 24–bit RGB and 32–bit ARGB images. Also, using these classes allows to access to the raw data buffer and apply, for example, some filter algorithm to them.

The QTPlgImage class is a class cluster, that is an opaque class that lets you create and manipulate different types of uncompressed image data while providing you with a consistent and unique interface.

Since version 6.7 of the plugin this class can be used in Console Applications






The QTPlgImage class has not constructor at all (you can always use the Realbasic common constructor syntax, of course, but you will obtain an usless object). You can obtain instances of this class by using one of the shared class method. Its destructor, will be implicitly invoked every time one of its derived classes will be destroyed.

Anyway, once a new instance of a class derived from QTPlgImage is returned, it is good practice to check the class property to be sure that the new object can be used. As a rule of thumb, a class derived from QTPlgImage is valid if both the and class properties are greater than 0.

(format as ,[size as ]) as QTPlgImage
use this method to create a newly allocated QTPlgImage instance. The type of data suitable for the image is determined by the format parameter. You can use one of the of the class to initialized a valid object. If you specify a size, an empty data block will be allocated as well. You can then use the class methods to read and write every single block of image data
returns a QTPlgImage object if successful, otherwise returns nil
(p as picture, format as ,[size as ]) as QTPlgImage
use this method to convert the RealBasic picture specified by the p parameter into the raw data format determined by the format parameter. You can use one of the of the class to initialized a valid object. If you specify the dimensions of the destination image by using the optional parameter size, the source picture is scaled appropriately to fit the pre–established and values; otherwise the destination image has the same dimensions of the RealBasic picture
returns a QTPlgImage object if successful, otherwise returns nil
(data as memoryblock, format as , size as ) as QTPlgImage
use this method to initialize a QTPlgImage instance accordingly to the format parameter and to the values of width and height specified by the sizeparameter. You can use one of the of the class to initialized a valid object. You specify the block of raw data to be copied into the newly allocated data buffer by the data parameter; it is up to you to ensure that the data passed into the data parameter are compatible with the format specified
returns a QTPlgImage object if successful, otherwise returns nil
(f as folderitem, format as , size as ,[offset as double]) as QTPlgImage
use this method to allocate a QTPlgImage object using the image data contained into the f parameter at the offset, in bytes, specified by the optional offset parameter; it is up to you to ensure that the dimensions and the type of raw data coming from the specified source file are suitable to the type of image to create
returns a QTPlgImage object if successful, otherwise returns nil
(source as , format as ,[size as ]) as QTPlgImage
use this method to convert the image referenced by the source parameter into the raw data format determined by the format parameter. You can use one of the of the class to initialized a valid object. This method tries to locate and open a graphics importer component for the data reference specified by the source parameter; if a graphics importer cannot be found using the file’s type, file extension, or MIME type the method will fail. If you specify the dimensions of the destination image by using the optional parameter size, the imported image is scaled appropriately to fit the pre–established and values; otherwise the resulting image has the same dimensions of the imported image
returns a QTPlgImage object if successful, otherwise returns nil
even if the data reference specified contains more than one image, just the first one is converted into the raw data format
(f as folderitem) as boolean
determines whether the file specified by the f parameter contains graphic data created by serializing a subclass instance of . This being the case you can use the shared method of the class to obtain a valid object
returns true if the specified file is a plugin native image file, otherwise returns false
(f as folderitem,byref err as integer) as QTPlgImage
you can use this method to create and initialize a new class instance from the image data contained into the QTPlugin image file specified by the f parameter. You can inspect the property of the returned object to find about the type of image data
returns a class instance initialized with the data contained into the src file; if the specified file is not a QTPlugin image document or some other error occurs returns nil and an error code into the the err parameter
(image as QTPlgImage,byref err as integer) as QTPlgImage
you can use this method to create a copy of the image data contained into the QTPlugin image object specified by the image parameter. You can use this function whenever you need a real copy of the specified image data, not just a reference to them (the Realbasic default behaviour)
returns a class instance initialized with the data contained into the src image; if some error occurs returns nil and an error code into the err parameter

returns a pointer to the data buffer in use. useful for toolbox programmers (use with care: you could invalidate the handle causing unpredictable results (probably an application crash))
indicates the width in pixels of the image
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the class property instead
indicates the height in pixels of the image
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the class property instead
specifies the width and height, in pixels, of the image
indicates the pixel depth of the image. Values of 24, and 32 indicate the depth of color images. Values of 8, and 16 indicate 8–bit and 16–bit grayscale, respectively, for grayscale images
indicates the offset in bytes from one row of the image to the next
specifies the degree of spatial decompression performed on the image data; this value is used when converting the raw data to a Realbasic picture using the class property. For a list of values see the defined into the class
specifies the format of data currently stored into the raw image object. For a list of possible values see the defined below
indicates the dimensions in bytes of the raw data buffer
returns a copy of the raw data buffer
indicates the number of channels of the image. Actually this property is set to 1 for , and ; it is set to 3 for and 4 for
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the and class properties instead
allows you to retrieve the histogram of the image’s channel specified by the index i; this index ranges from 0 to -1
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the class property instead
allows you to retrieve statistics about data owned by the image’s channel specified by the index i; this index ranges from 0 to -1
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the class property instead
a list of objects. The list will contain a number of histograms appropriate to the image in use (that is a histogram for each channel of the image). Actually there is 1 channel for , , and ; 3 channels for and 4 channels for
a list of objects. The list will contain a number of statistic reports appropriate to the image in use (that is a report for each channel of the image). Actually there is 1 channel for , , and ; 3 channels for and 4 channels for
wraps the parameters of the raw image into the QuickTime Image Description format
indicates the RealBasic picture that represents the data contained into the buffer in use

()
use this method to invert the order of bytes in an image. This method is effective on multi–bytes images only
returns nothing. Check the class property for errors
(p as ) as
use this method to read and write the image value specified by the p coordinates
returns the value corresponding to the image coordinates specified by the p parameter
(image as QTPlgImage)
use this method to copy the visual data contained into the image parameter; if the format of the data contained into the source image does not match with that one of the destination image, this method converts the source data into the format suitable to the destination container as well. If you have already specified the dimensions of the destination image by using the appropriate class constructor, the source image is scaled appropriately to fit the pre–established and values; otherwise the destination image has the same dimensions as the source image
returns nothing. Check the class property for errors
(source as picture)
use this method to convert the RealBasic picture specified by the source parameter into the appropriate raw data format. If you have already specified the dimensions of the destination image by using the appropriate class constructor, the source picture is scaled appropriately to fit the pre–established and values; otherwise the destination image has the same dimensions of the RealBasic picture
returns nothing. Check the class property for errors
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the shared method instead
(source as )
use this method to convert the current frame of the movie specified by the source into the appropriate raw data format. If you have already specified the dimensions of the image by using the appropriate class constructor, the movie frame is scaled appropriately to fit the pre–established and values; otherwise the resulting image has the same dimensions of the movie frame
returns nothing. Check the class property for errors
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use one of the class method to get a frame and then use the shared method to obtain a QTPlgImage object
(source as )
use this method to convert the image referenced by the source parameter into the appropriate raw data format. This method tries to locate and open a graphics importer component for the data reference specified by the source parameter; if a graphics importer cannot be found using the file’s type, file extension, or MIME type the method will fail. If you have already specified the dimensions of the image by using the appropriate class constructor, the imported image is scaled appropriately to fit the pre–established and values; otherwise the resulting image has the same dimensions of the imported image
returns nothing. Check the class property for errors
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the shared method instead
(source as folderitem, w as integer, h as integer, offset as double)
use this method to copy into the class instance in use the image data contained into the source parameter at the offset, in bytes, specified by the offset parameter; it is up to you to ensure that the width (the w parameter), the height (the h parameter) and the raw data coming from the specified source are suitable to the type of image in use. This method deletes any previously allocated image data
returns nothing. Check the class property for errors
[Deprecated]: since version 6.7 of the plugin this method is deprecated and will be removed from a future plugin version; use the shared method instead
(other as QTPlgImage, ratio as double) as QTPlgImage
this method forms a blend of the current image and the image specified into the other parameter; the images must be of the same size. Similar to pixel addition, the value of each pixel in the output image is a linear combination of the corresponding pixel values in the input images. The coefficients of the linear combination are user–specified by the ratio parameter that represents the ratio by which to scale each image before combining them. Suitable values for ratio range from 0.0 to 1.0
returns the blended image if no error occurs; otherwise returns nil. You can check the class property for errors
(roi as ) as QTPlgImage
use this method to create a new image using the current image data belonging to the rectangle specified by the roi parameter; the rectangle coordinates are intended to be relative to the image bounds (always 0,0, ,)
returns the cropped image if no error occurs; otherwise returns nil. You can check the class property for errors
(size as ) as QTPlgImage
use this method to create a new image scaled to the values of and specified via the size parameter. The scaling algorithm used is the simplest and fastest nearest neighbor one
returns the scaled image if no error occurs; otherwise returns nil. You can check the class property for errors
(low as double, high as double) as QTPlgImage
use this method to constrain the current image data within the range of values specified by the low and high parameter
returns the normalized image if no error occurs; otherwise returns nil. You can check the class property for errors
() as QTPlgImage
use this method to apply a histogram equalization to the current image data
returns the equalized image if no error occurs; otherwise returns nil. You can check the class property for errors
(lowPercent as integer, highPercent as integer) as QTPlgImage
use this method to constrain the current image data within the range of histogram values (expressed as percentual) specified by the lowPercent and highPercent parameter
returns the modified image if no error occurs; otherwise returns nil. You can check the class property for errors
(f as folderitem,[onlyData as boolean])
use this method to save the current image data into the QTPlugin image file specified by the f parameter; if the target file already exists at the specified location, this function overwrites it with the new image data. The format of this file is cross–platform. If you pass true into the onlyData parameter, the method will flush just the image bytes to the file without any additional informations; this being the case, it is up to you to know how to deal with the image data stored into the file. By default, this parameter is set to false
returns nothing. Check the class property for errors

() as picture
automatically converts the object into a RealBasic picture. This allows you to use transparently QTPlgImage objects anytime you need to specify a picture
returns a RealBasic picture or nil if the conversion fails
() as memoryblock
automatically converts the image data into a RealBasic memoryblock. This allows you to use transparently QTPlgImage objects anytime you need to specify a memoryblock
returns a memoryblock or nil if the conversion fails
(rhs as QTPlgImage) as QTPlgImage
performs the arithmetic addition of the values of the two images. The images must have the same and the same
returns a QTPlgImage object that represents the result of the arithmetic operation or nil if the required conditions are not met
(rhs as double) as QTPlgImage
sums each value of the image in use to the constant rhs value
returns a QTPlgImage object that represents the result of the arithmetic operation
(rhs as QTPlgImage) as QTPlgImage
performs the arithmetic subtraction of the values of the two images. The images must have the same and the same
returns a QTPlgImage object that represents the result of the arithmetic operation or nil if the required conditions are not met
(rhs as double) as QTPlgImage
subtracts the constant rhs value to each value of the image in use
returns a QTPlgImage object that represents the result of the arithmetic operation


image data are represented with unsigned char integer values that can be set only to 0 or 255
image data are represented with unsigned char integer values ranging from 0 to 255
image data are represented with unsigned short integer values ranging from 0 to 65535
specifies image data constituted by 32 bit float signed values
the image data are represented with triplets of unsigned char integer values ranging from 0 to 255. Each triplet of byte represents the red, green and blue channel values respectively
the image data are represented with quadruplets of unsigned char integer values ranging from 0 to 255. Each quadruplet of byte represents the alpha, red, green and blue channel values respectively