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.
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
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
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
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
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
even if the data reference specified contains more than one image, just the first one is converted into the raw data format
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
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
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 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
use this method to read and write the image value specified by the
p coordinates
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
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
[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
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
[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
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
[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
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
[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
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
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,
,)
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
use this method to constrain the current image data within the range of values specified by the
low and
high parameter
use this method to apply a histogram equalization to the current image data
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
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
automatically converts the object into a RealBasic picture. This allows you to use transparently QTPlgImage objects anytime you need to specify a picture
automatically converts the image data into a RealBasic memoryblock. This allows you to use transparently QTPlgImage objects anytime you need to specify a memoryblock
performs the arithmetic addition of the values of the two images. The images must have the same and the same
sums each value of the image in use to the constant
rhs value
performs the arithmetic subtraction of the values of the two images. The images must have the same and the same
subtracts the constant
rhs value to each value of the image in use
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