Python API 2.0 Reference
|
Public Member Functions | |
def | __init__ () |
def | create () |
def | depth () |
def | depthMap () |
def | filter () |
def | floatPixels () |
def | getDepthMapRange () |
def | getDepthMapSize () |
def | getSize () |
def | haveDepth () |
def | isRGBA () |
def | pixelType () |
def | pixels () |
def | readDepthMap () |
def | readFromFile () |
def | readFromTextureNode () |
def | release () |
def | resize () |
def | setDepthMap () |
def | setFloatPixels () |
def | setPixels () |
def | setRGBA () |
def | verticalFlip () |
def | writeToFile () |
def | writeToFileWithDepth () |
Static Public Member Functions | |
def | __new__ () |
def | filterExists () |
Static Public Attributes | |
int | kByte = 1 |
int | kFloat = 2 |
int | kHeightFieldBumpFormat = 1 |
int | kNoFormat = 0 |
int | kNormalMapBumpFormat = 2 |
int | kUnknown = 0 |
int | kUnknownFormat = 3 |
Manipulate color data.
def OpenMaya.MImage.__init__ | ( | ) |
Initialize self. See help(type(self)) for accurate signature.
|
static |
Create and return a new object. See help(type) for accurate signature.
def OpenMaya.MImage.create | ( | ) |
create(width, height, channels=4, type=kByte) -> self Create a new MImage object. Allocates memory for an RGBA array of pixels of the given size. If an object was already in memory, it is released first. * width (unsigned int) - the desired image's width in pixels. * height (unsigned int) - the desired image's height in pixels. * channels (unsigned int) - the desired number of channels per pixel. * type (int) - the desired pixel format (kByte or kFloat, see MImage.pixelType() description for details.)
def OpenMaya.MImage.depth | ( | ) |
depth() -> int Get the color depth (in bytes) of the currently opened image.
def OpenMaya.MImage.depthMap | ( | ) |
depthMap() -> long Returns a long containing a C++ 'float' pointer which points to the depth data.
def OpenMaya.MImage.filter | ( | ) |
filter(sourceFormat, targetFormat, scale=1.0, offset=1.0) -> self Modify the content of the image by applying a filter. The dimension of the image remains the same; only the RGBA components get affected. * sourceFormat (MImageFilterFormat) - the format of the source image. * targetFormat (MImageFilterFormat) - the format of the resulting image.* scale (float) - vary depending on the source/target format. * offset (float) - vary depending on the source/target format. The scale argument for this filter can vary from -256.0 to 256.0, although typical values range from 1.0 to 10.0. The offset argument is currently ignored and should be left to the default value of 0.0.
|
static |
filterExists(sourceFormat, targetFormat) -> bool Return whether or not a given source format can be directly converted to a given target format. * sourceFormat (MImageFilterFormat) - the format of the source image. * targetFormat (MImageFilterFormat) - the format of the resulting image.
def OpenMaya.MImage.floatPixels | ( | ) |
floatPixels() -> long Returns a long containing a C++ 'float' pointer which points to the pixel data. This data is uncompressed and tightly packed, of size (width * height * depth * sizeof( float)) bytes.
def OpenMaya.MImage.getDepthMapRange | ( | ) |
getDepthMapRange() -> [minValue, maxValue] Compute the minimum and maximum depth values (range) for any stored depth buffer.
def OpenMaya.MImage.getDepthMapSize | ( | ) |
getDepthMapSize() -> [width, height] Returns the size of the depth map buffer.
def OpenMaya.MImage.getSize | ( | ) |
getSize() -> [width, height] Get the width and height of the currently opened image.
def OpenMaya.MImage.haveDepth | ( | ) |
haveDepth() -> bool Returns True if this instance of MImage contains a depth map.
def OpenMaya.MImage.isRGBA | ( | ) |
isRGBA() -> bool Query flag which indicates whether the pixel information is in RGBA sequence or BGRA sequence. If no pixel data exists, then False will be returned.
def OpenMaya.MImage.pixels | ( | ) |
pixels() -> long Returns a long containing a C++ 'unsigned char' pointer which points to the pixel data. This data is uncompressed and tightly packed, of size (width * height * depth) bytes. For the moment, pixels are always stored in a RGBA (depth=4 bytes) pixel format.
def OpenMaya.MImage.pixelType | ( | ) |
pixelType() -> int Get the current pixel format of the image: kUnknown Format not known or invalid. kByte One byte per channel, ranging from 0 to 255. kFloat One float per channel, ranging from 0.0 to 1.0.
def OpenMaya.MImage.readDepthMap | ( | ) |
readDepthMap(pathname) -> self Reads the depth map from the specified file and place the result into the depth map array of this MImage instance.
def OpenMaya.MImage.readFromFile | ( | ) |
readFromFile(pathname, type=kByte) -> self Attempt to identify and open the specified image file. * pathname (string) - the full path of the image file that should be opened. * type (MPixelType) - the desired pixel format. kUnknown attempts to load the native pixel type.
def OpenMaya.MImage.readFromTextureNode | ( | ) |
readFromTextureNode(fileTextureObject, type=kByte) -> self Attempt to read the content of the given file texture node. * fileTextureObject (MObject) - an object that refers to the file texture node that should be read. * type (MPixelType) - the desired pixel format. kUnknown attempts to load the native pixel type.
def OpenMaya.MImage.release | ( | ) |
release() -> self Release the current image. If there is no current image, the call is ignored.
def OpenMaya.MImage.resize | ( | ) |
resize(width, height, preserveAspectRatio=True) -> self Resize the currently opened image to the specified dimension, or to the closest width/height that is preserves the original aspect ratio.* width (unsigned int) - the desired image's width in pixels. * height (unsigned int) - the desired image's height in pixels. * preserveAspectRatio (bool) - specifies whether the aspect ratio should be preserved or not. If this flag is set, the given width and height are interpreted as the maximum dimensions allowable.
def OpenMaya.MImage.setDepthMap | ( | ) |
setDepthMap(depth, width, heigth) -> self Specifies the depth map resolution and data. * depth (float*) - float buffer that contains depth values. * width (unsigned int) - the width of the depth buffer. * height (unsigned int) - the height of the depth buffer. * depth (MFloatArray) - float array that contains depth values. * width (unsigned int) - the width of the depth buffer. * height (unsigned int) - the height of the depth buffer.
def OpenMaya.MImage.setFloatPixels | ( | ) |
setFloatPixels(pixels, width, height, channels=4) -> self Copy the uncompressed pixels array passed in into the MImage. This array is tightly packed, of size (width * height * depth) bytes. For the moment, pixels are always stored in a RGBA (depth=4 bytes) pixel format. * pixels (float*) - the variable containing a block of pixels. * width (unsigned int) - the variable that will be set to the image's width in pixels. * height (unsigned int) - the variable that will be set to the image's height in pixels. * channels (unsigned int) - the number of channels per pixel.
def OpenMaya.MImage.setPixels | ( | ) |
setPixels(pixels, width, height) -> self Copy the uncompressed pixels array passed in into the MImage. This array is tightly packed, of size (width * height * depth) bytes. For the moment, pixels are always stored in a RGBA (depth=4 bytes) pixel format. * pixels (unsigned char*) - the variable containing a block of pixels. * width (unsigned int) - the variable that will be set to the image's width in pixels. * height (unsigned int) - the variable that will be set to the image's height in pixels.
def OpenMaya.MImage.setRGBA | ( | ) |
setRGBA(bool) -> self Sets a flag to indicate that pixel information is in RGBA sequence or BGRA sequence. Pixel data must have been allocated before this call is made.
def OpenMaya.MImage.verticalFlip | ( | ) |
verticalFlip() -> bool Flips the image vertically.
def OpenMaya.MImage.writeToFile | ( | ) |
writeToFile(pathname, outputFormat=iff) -> self Save the content of this image in a file. By default, the file is saved in IFF format. Optionally, the file can also be converted in a variety of image formats.
def OpenMaya.MImage.writeToFileWithDepth | ( | ) |
writeToFileWithDepth(pathname, outputFormat=iff, writeDepth=False) -> self Save the content of this image in a file. By default, the file is saved in IFF format. Optionally, the file can also be converted in a variety of image formats. If the writeDepth parameter is True then any depth information stored in MImage will be written to file.