Functions | |
IMAGELIB_EXPORT int | mdlImage_RGBToMapWithGamma (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, double gamma) |
Converts an RGB image to a mapped image, applying gamma correction to each pixel as it is converted. More... | |
IMAGELIB_EXPORT int | mdlImage_RGBToMap (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize) |
Converts an RGB image to a mapped image. More... | |
IMAGELIB_EXPORT void | mdlImage_ditherCleanup (void) |
Frees the internal buffers allocated during the dithering process. More... | |
IMAGELIB_EXPORT int | mdlImage_ditherInitialize (int nColors, byte *redMapP, byte *grnMapP, byte *bluMapP, int width) |
Initialization for dithering. More... | |
IMAGELIB_EXPORT int | mdlImage_ditherRow (byte *outputLineP, byte *redP, byte *grnP, byte *bluP, int width) |
Creates a dithered scanline from a sequence of red, green and blue pixels. More... | |
IMAGELIB_EXPORT int | mdlImage_getOptimizedPalette (byte *redMapP, byte *grnMapP, byte *bluMapP, int *paletteSizeP, int maxColors, byte *imageBufferP, Point2d *sizeP) |
Calculates an optimized color palette for an RGB image. More... | |
IMAGELIB_EXPORT int | mdlImage_mapToRGB (byte **rgbBufferPP, byte *mapP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP) |
Converts a mapped image to an RGB image. More... | |
IMAGELIB_EXPORT int | mdlImage_mapToRGBBuffer (byte *rgbBufferP, byte *mapP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP) |
Converts a mapped image to an RGB image. More... | |
IMAGELIB_EXPORT int | mdlImage_resize (byte **outputImagePP, Point2d *outputSizeP, byte *inputImageP, Point2d *inputSizeP) |
Compresses or expands the RGB buffer specified by inputImageP and inputSizeP to the size specified by outputSizeP. More... | |
IMAGELIB_EXPORT int | mdlImage_readFileInfo (Point2d *imageSizeP, DgnPlatform::ImageColorMode *colorModeP, int *orientationP, WCharCP fileName, DgnPlatform::ImageFileFormat fileType) |
Returns information about the image file specified by fileName and fileType. More... | |
IMAGELIB_EXPORT int | mdlImage_readFileToRGB (byte **imageBufferPP, Point2d *imageSizeP, WCharCP name, DgnPlatform::ImageFileFormat fileType, Point2d *requestedSizeP) |
Reads the image file specified by filename and fileType and returns an RGB image. More... | |
IMAGELIB_EXPORT int | mdlImage_readFileToMap (byte **imageMapPP, Point2d *imageSizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int *paletteSizeP, WCharCP fileName, DgnPlatform::ImageFileFormat fileType) |
Reads the mapped image file specified by fileName and fileType. More... | |
IMAGELIB_EXPORT int | mdlImage_extCreateFileFromMap (WCharCP name, DgnPlatform::ImageFileFormat type, DgnPlatform::ImageColorMode colorMode, Point2d *sizeP, byte *imageMapP, byte *redPaletteP, byte *grnPaletteP, byte *bluPaletteP, int paletteSize, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio, byte *transparencyP) |
Creates the image file specified by fileName, fileType and colorMode from a mapped image, allowing compression and transparency to be set. More... | |
IMAGELIB_EXPORT int | mdlImage_createFileFromMap (WCharCP name, DgnPlatform::ImageFileFormat type, DgnPlatform::ImageColorMode colorMode, Point2d *sizeP, byte *imageMapP, byte *redPaletteP, byte *grnPaletteP, byte *bluPaletteP, int paletteSize) |
Creates the image file specified by fileName, fileType and colorMode from a mapped image. More... | |
IMAGELIB_EXPORT int | mdlImage_extCreateFileFromRGB (WCharCP name, DgnPlatform::ImageFileFormat type, DgnPlatform::ImageColorMode colorMode, Point2d *sizeP, byte *imageBufferP, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio, byte *transparencyP) |
Creates the image file specified by fileName, fileType and colorMode from an RGB image, allowing compression type and transparency to be set. More... | |
IMAGELIB_EXPORT int | mdlImage_extCreateMonoFileFromRGB (WCharCP name, DgnPlatform::ImageFileFormat type, Point2d *sizeP, byte *imageBufferP, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio, byte *transparencyP, RgbColorDef *backgroundColorP) |
Creates the monochrome image file specified by fileName, fileType from an RGB image, allowing compression type. More... | |
IMAGELIB_EXPORT int | mdlImage_createFileFromRGB (WCharCP name, DgnPlatform::ImageFileFormat type, DgnPlatform::ImageColorMode colorMode, Point2d *sizeP, byte *imageBufferP) |
Creates the image file specified by fileName, fileType and colorMode from an RGB image. More... | |
IMAGELIB_EXPORT int | mdlImage_getExtension (WCharP ext, DgnPlatform::ImageFileFormat type) |
Returns the default three character file extension for the specified image format. More... | |
IMAGELIB_EXPORT int | mdlImage_getOSFileType (UInt32 *osFileTypeP, DgnPlatform::ImageFileFormat imageType) |
Returns the operating system file type for the specified image type. More... | |
IMAGELIB_EXPORT int | mdlImage_getExportSupport (DgnPlatform::ImageColorMode *defaultModeP, bool *rgbSupportP, bool *palette256SupportP, bool *palette16SupportP, bool *greyScaleSupportP, bool *monochromeSupportP, DgnPlatform::ImageFileFormat imageType) |
For a specified image format, returns the default color mode, and whether each of the various color modes is supported for export. More... | |
IMAGELIB_EXPORT int | mdlImage_getExportFormat (WCharP formatName, DgnPlatform::ImageFileFormat *importTypeP, int index) |
Determines if the specified image file format is supported for export. More... | |
IMAGELIB_EXPORT int | mdlImage_getImportFormat (WCharP formatName, DgnPlatform::ImageFileFormat *importTypeP, int index) |
Determines if the specified image file format is supported for import. More... | |
IMAGELIB_EXPORT void | mdlImage_getBalancedPalette (byte *redMapP, byte *grnMapP, byte *bluMapP, int *numColorsP) |
Calculates a balanced color palette. More... | |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat | mdlImage_typeFromExtension (WCharCP fileName) |
Returns the file type of the specified image file. More... | |
IMAGELIB_EXPORT StatusInt | mdlImage_getImageBgColor (byte *pixelP, WCharCP name) |
Retrieves the background color information from the specified image file. More... | |
IMAGELIB_EXPORT void | mdlImage_applyGamma (byte *rgbOutP, byte *rgbInP, Point2d *sizeP, double gamma) |
Applies gamma correction to the input RGB buffer and places the result in the output RGB buffer. More... | |
IMAGELIB_EXPORT void | mdlImage_applyGammaToPalette (byte *redMapP, byte *greenMapP, byte *blueMapP, int paletteSize, double gamma) |
Applies gamma correction to an existing palette. More... | |
IMAGELIB_EXPORT void | mdlImage_negate (byte *rgbOutP, byte *rgbInP, Point2d *sizeP) |
Returns an RGB image that is the negated version of the input RGB image. More... | |
IMAGELIB_EXPORT void | mdlImage_negatePalette (byte *redMapP, byte *greenMapP, byte *blueMapP, int paletteSize) |
Returns a negated version of the supplied color palette. More... | |
IMAGELIB_EXPORT int | mdlImage_readFileToBitMap (byte **imageBitMap, Point2d *imageSize, WCharCP fileName, DgnPlatform::ImageFileFormat fileType, bool runLengthEncode) |
Reads a bitmapped image file into an image buffer and optionally run length encodes the bitmap. More... | |
IMAGELIB_EXPORT int | mdlImage_createFileFromBitMap (WCharCP nameP, DgnPlatform::ImageFileFormat type, Point2d *sizeP, byte *bitMapP, bool runLengthEncode, RgbColorDef *foregroundColorP, RgbColorDef *backgroundColorP) |
creates an image file from a memory bitmap. More... | |
IMAGELIB_EXPORT int | mdlImage_createFileFromBuffer (WCharCP saveAsFileNameP, DgnPlatform::ImageFileFormat fileType, DgnPlatform::ImageColorMode colorMode, Point2d *sizeP, byte *imageDataP, int imageFormat, void *param1P, void *param2P, void *param3P, int paletteSize, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio) |
Creates a file from an image buffer by using the imageFormat to determine how to best write the file. More... | |
IMAGELIB_EXPORT int | mdlImage_extractRGBSubImage (byte *outP, Point2d *outSizeP, byte *inP, Point2d *inSizeP, BSIRect *rectP) |
Extracts an RGB subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_extractRGBASubImage (byte *outP, Point2d *outSizeP, byte *inP, Point2d *inSizeP, BSIRect *rectP) |
Extracts an RGBA subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_extractPackByteSubImage (byte **outRowPP, Point2d *outSizeP, byte **inRowPP, Point2d *inSizeP, BSIRect *rectP, byte *mapP) |
Extracts a packbyte subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_extractByteMapSubImage (byte *outMapP, Point2d *outSizeP, byte *inMapP, Point2d *inSizeP, BSIRect *rectP, byte *mapP) |
Extracts a byte mapped subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_extractBitMapSubImage (byte *outMapP, Point2d *outSizeP, byte *inBitMapP, Point2d *inSizeP, BSIRect *rectP) |
Extracts a bitmapped subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_subByteMapFromBitMap (byte *outMapP, Point2d *outSizeP, byte *inBitMapP, Point2d *inSizeP, BSIRect *rectP, int foreground, int background, bool rle) |
Converts a bitmapped image to a byte mapped image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_subByteMapFromRLEBitMap (byte *outMapP, Point2d *outSizeP, UShort **inBitMapPP, Point2d *inSizeP, BSIRect *rectP, int foreground, int background) |
Converts a RLE bitmapped image to a byte mapped image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_subByteMapFromPackByte (byte *outMapP, Point2d *outSizeP, byte **inRowPP, Point2d *inSizeP, BSIRect *rectP, byte *mapP) |
Converts a packbyte image to a byte mapped image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT void | mdlImage_freeImage (void *imageP, Point2d *sizeP, int imageFormat) |
Frees the memory buffer identified by imageP. More... | |
IMAGELIB_EXPORT int | mdlImage_extractSubImage (byte *outP, Point2d *outSizeP, byte *inP, Point2d *inSizeP, BSIRect *rectP, int imageFormat) |
Extracts a subimage from a larger image and stretches or decimates it to fit a user-defined output image size. More... | |
IMAGELIB_EXPORT int | mdlImage_runLengthEncodeBitMap (UShort ***rlePPP, byte *bitmapP, Point2d *sizeP) |
Converts a bitmap in format IMAGEFORMAT_BitMap to its run-length-encoded format IMAGEFORMAT_RLEBitMap. More... | |
IMAGELIB_EXPORT void | mdlImage_tintPalette (byte *redP, byte *grnP, byte *bluP, int paletteSize, RgbColorDef *tintRGBP) |
Tints each entry of an image palette by adjusting values as defined below. More... | |
IMAGELIB_EXPORT void | mdlImage_tintImage (byte *imageP, Point2d *imageSizeP, RgbColorDef *tintRGBP) |
Tints an RGB image in format IMAGEFORMAT_RGBSeparate by adjusting values as defined below. More... | |
IMAGELIB_EXPORT int | mdlImage_setMapPolygon (byte *dataP, bool *dataModifiedP, Point2d *sizeP, int imageFormat, DPoint2d *pointP, int nPoints, bool outside, int value) |
Masks a polygonal area within an image. More... | |
IMAGELIB_EXPORT int | mdlImage_setRGBPolygon (byte *dataP, bool *dataModifiedP, Point2d *sizeP, DPoint2d *pointP, int nPoints, bool outside, RgbColorDef *colorP) |
Masks a polygonal area within an image. More... | |
IMAGELIB_EXPORT int | mdlImage_rotate (byte **outBufferPP, Point2d *outSizeP, byte *inpBufferP, Point2d *imageSizeP, int imageFormat, int rotation) |
Rotates the image about the origin in a counter clockwise direction by a specified number of degrees. More... | |
IMAGELIB_EXPORT int | mdlImage_mirror (byte *inpBufferP, Point2d *imageSizeP, int imageFormat, bool vertical) |
Mirrors an image by reversing the pixels, either horizontally or vertically. More... | |
IMAGELIB_EXPORT int | mdlImage_warp (byte **outPP, Point2d *outSizeP, byte *inP, Point2d *inSizeP, int imageFormat, TransformP inverseTransformP, byte *transparentP) |
Warps an image by using an inverse transform from each pixel of the output image to find the corresponding pixel in the source image. More... | |
IMAGELIB_EXPORT int | mdlImage_memorySize (Point2d *sizeP, int imageFormat) |
Returns the amount of memory initially required to hold the image in the specified image format. More... | |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat | mdlImage_typeFromFile (WCharCP fileNameP) |
Attempts to determine the type of file from header information within the file itself. More... | |
IMAGELIB_EXPORT void | mdlImage_setMapIfRGBMatch (byte *mapP, int value, byte *rgbP, Point2d *sizeP, RgbColorDef *matchP, bool packBytes) |
Modifies a corresponding byte mapped image every time pixels in a corresponding RGB image match a specified value. More... | |
IMAGELIB_EXPORT void | mdlImage_getMapUsage (byte mapUsed[256], byte *mapP, Point2d *sizeP, bool packBytes) |
Determines which palette entries are used or available in an image. More... | |
IMAGELIB_EXPORT void | mdlImage_paletteToGreyScale (byte *greyPaletteP, int *minGreyP, int *maxGreyP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize) |
Computes a greyscale palette from a color palette using the formula: More... | |
IMAGELIB_EXPORT int | mdlImage_byteMapToGreyScale (byte *greyP, int *minGreyP, int *maxGreyP, byte *byteMapP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, Point2d *sizeP) |
Converts an uncompressed byte-mapped color image with format IMAGFORMAT_ByteMap to a greyscale image based on the formula: More... | |
IMAGELIB_EXPORT int | mdlImage_packByteToGreyScale (byte *greyP, int *minGreyP, int *maxGreyP, byte *packByteP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, Point2d *sizeP) |
Converts a compressed byte-mapped color image with format IMAGEFORMAT_PackByte to a greyscale image based on the formula: More... | |
IMAGELIB_EXPORT int | mdlImage_rgbToGreyScale (byte *greyP, int *minGreyP, int *maxGreyP, byte *rgbP, Point2d *sizeP) |
Converts an RGB image to a byte-per-pixel greyscale image based on the formula: More... | |
IMAGELIB_EXPORT int | mdlImage_greyScaleToBitMap (byte *bitMapP, byte *greyP, Point2d *sizeP, int minGrey, int maxGrey, int ditherMode) |
Converts an uncompressed byte-per-pixel greyscale image to an uncompressed bitmap by dithering the greyscale image. More... | |
IMAGELIB_EXPORT int | mdlImage_rgbToBitMap (byte *bitMapP, byte *rgbP, Point2d *sizeP, int ditherMode) |
Converts an RGB image to an uncompressed bitmap by dithering the color image. More... | |
IMAGELIB_EXPORT int | mdlImage_byteMapToBitMap (byte *bitMapP, byte *byteMapP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, Point2d *sizeP, int ditherMode) |
Converts an uncompressed byte-mapped color image to an uncompressed bitmap by dithering the color image. More... | |
IMAGELIB_EXPORT int | mdlImage_packByteToBitMap (byte *bitMapP, byte *packByteP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, Point2d *sizeP, int ditherMode) |
Converts a compressed byte-mapped color image to an uncompressed bitmap by dithering the color image. More... | |
IMAGELIB_EXPORT void | mdlImage_runLengthEncodeBitMapRow (UShort *outP, int *compressedSizeP, byte *inP, int nPixels) |
Encodes a bitmap row in format IMAGEFORMAT_BitMap into any array of UShort integers. More... | |
IMAGELIB_EXPORT void | mdlImage_runLengthDecodeBitMapRow (byte *outP, UShort *inP, int nPixels) |
Decodes a bitmap row from an array of UShort integers into a row in format IMAGEFORMAT_BitMap. More... | |
IMAGELIB_EXPORT int | mdlImage_convertToUpperLeftHorizontal (byte **imagePP, Point2d *sizeP, int ingrOrientation, int imageFormat) |
Converts an image to upper-left-horizontal orientation, so the first image pixel is the upper-left corner, and subsequent pixels proceed from left to right, then from top to bottom. More... | |
IMAGELIB_EXPORT int | mdlImage_extReadFileToMap (byte **imageMapPP, Point2d *imageSizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int *paletteSizeP, WCharCP fileNameP, DgnPlatform::ImageFileFormat fileType, bool packBytes) |
Reads a file which contains a byte-mapped image with no more than 265 color palette entries. More... | |
IMAGELIB_EXPORT int | mdlImage_stretchRLEToBitMap (byte **imagePP, Point2d *sizeP) |
Replaces a run-length encoded (RLE) bitmap representation of an image with its corresponding bitmap representation. More... | |
IMAGELIB_EXPORT int | mdlImage_extMapToRGB (byte **rgbBufferPP, byte *mapP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, bool packBytes) |
Converts a byte-mapped image from IMAGEFORMAT_ByteMap or IMAGEFORMAT_PackByte format to an RGB image in IMAGEFORMAT_RGBSeparate format. More... | |
IMAGELIB_EXPORT int | mdlImage_RGBToPackByte (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize) |
Converts an RGB image to a packbyte compressed byte-mapped image. More... | |
IMAGELIB_EXPORT int | mdlImage_RGBToPackByteWithGamma (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, double gamma) |
Converts an RGB image to a packbyte compressed byte-mapped image and applies the supplied gamma value. More... | |
IMAGELIB_EXPORT int | mdlImage_extRGBToMap (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, bool packBytes) |
Converts from an RGB image with format IMAGEFORMAT_RGBSeparate to a byte-mapped image with format IMAGEFORMAT_ByteMap or IMAGEFORMAT_PackByte. More... | |
IMAGELIB_EXPORT void | mdlImage_packByteBuffer (byte *outP, int *encodeSizeP, byte *inP, int rawSize) |
Encodes a sequence of byte-mapped data into packbyte format. More... | |
IMAGELIB_EXPORT void | mdlImage_unpackByteBuffer (byte *outP, byte *inP, int numDecode) |
Unpacks a buffer in packbyte format to a sequence of bytes. More... | |
IMAGELIB_EXPORT void | mdlImage_doubleImage (byte *outMapP, byte *inMapP, Point2d *sizeP, int bytesPerPixel) |
Doubles the size of the source image to produce the output image. More... | |
IMAGELIB_EXPORT Public int | mdlImage_resizeBand (byte **outputImagePP, Point2d *outputSizeP, int outRowStart, int outRowStop, byte *inputImageP, Point2d *inputSizeP) |
Resizes a portion of the specified image to the given size. More... | |
IMAGELIB_EXPORT Public void | mdlImage_resizeCleanup (void) |
Clean up after resizing operations performed by calling ~mmdlImage_resizeBand. More... | |
IMAGELIB_EXPORT int | mdlImage_createRasterFile (WCharCP saveAsFileNameP, DgnPlatform::ImageFileFormat fileType, DgnPlatform::ImageColorMode colorMode, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio, Point2d *imageSizeP, byte *imageDataP, int imageFormat, void *param1P, void *param2P, void *param3P, int paletteSize) |
Creates a raster file of the specified name and type using the given raster data. More... | |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat | mdlImage_fileType (DgnPlatform::ImageFileFormat fileType, WCharCP fileNameP) |
Determines the format of the specified image file. More... | |
IMAGELIB_EXPORT StatusInt | mdlImage_RGBToRGBSeparate (byte *rgbSeparateP, byte *rgbInterlacedP, Point2d *imageSizeP, DgnPlatform::ImageColorMode colorMode) |
Converts the specified image from RBG interlaced to RGB separated format. More... | |
IMAGELIB_EXPORT StatusInt | mdlImage_RGBSeparateToRGB (byte *rgbInterlacedP, byte *rgbSeparateP, Point2d *imageSizeP, DgnPlatform::ImageColorMode colorMode) |
Converts the specified image from RBG separate to RGB interlaced format. More... | |
IMAGELIB_EXPORT StatusInt | mdlImage_RGBSeparateToBGR (byte *bgrInterlacedP, byte *rgbSeparateP, Point2d *imageSizeP, DgnPlatform::ImageColorMode colorMode) |
Converts the specified image from RBG separate to BGR interlaced format. More... | |
IMAGELIB_EXPORT int | mdlImage_convertToGreyScale (void *dstDataP, byte *redMapP, byte *grnMapP, byte *bluMapP, int *paletteSizeP, void *srcDataP, Point2d *imageSizeP, int imageFormat) |
Converts the specified image to greyScale. More... | |
IMAGELIB_EXPORT StatusInt | mdlImage_createMonochromeFile (WCharCP fileNameP, DgnPlatform::ImageFileFormat fileType, Point2d *imageSizeP, byte *imageDataP, int imageFormat, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, DgnPlatform::CompressionType compressType, DgnPlatform::CompressionRatio compressRatio) |
Creates a monochrome file from the specified image data. More... | |
IMAGELIB_EXPORT int | mdlImage_ditherInitializeWithGamma (int nColors, byte *redMapP, byte *grnMapP, byte *bluMapP, int width, double gammaValue) |
Initialization for dithering with gamma corrected pixels. More... | |
IMAGELIB_EXPORT int | mdlImage_ditherRowWithOffset (byte *outputLineP, byte *redP, byte *grnP, byte *bluP, int width, int channelOffset) |
Creates a dithered scanline from a sequence of red, green and blue pixels. More... | |
int | mdlImage_checkStop (int target, int current) |
A generic stop function called during image processing. More... | |
int | mdlImage_saveView (WCharCP fileNameP, Point2d *sizeP, int renderMode, DgnPlatform::ImageFileFormat format, bool stereo, bool antiAlias, int view) |
Renders an RGB image of a view to disk. More... | |
int | mdlImage_saveViewToRGB (byte **imageBufferPP, Point2d *sizeP, int renderMode, bool stereo, bool antiAlias, int view) |
Renders the specified view and stores the image in the RGB buffer pointed to by imageBufferPP. More... | |
int | mdlImage_renderViewToRGB (byte **imageBufferPP, Point2d *sizeP, int renderMode, bool stereo, bool antiAlias, int view) |
Renders the specified view and stores the image in the RGB buffer pointed to by imageBufferPP. More... | |
int | mdlImage_RGBToScreenMap (byte **mapPP, byte *rgbBufferP, Point2d *sizeP, int screen) |
Converts an RGB image to a mapped image, applying gamma correction to each pixel as it is converted, and dithered to the palette for the graphics device indicated by screen. More... | |
Public int | mdlImage_captureScreen (byte **imagePP, BSIRect *rectangleP, int screenNum, int imageFormat) |
Captures all or part of a MicroStation graphics screen into an RGB or byte-mapped image buffer. More... | |
Public int | mdlImage_captureScreenMap (byte **imageMapPP, BSIRect *rectangleP, int screenNum) |
Captures the rectangular portion of the MicroStation display specified by screenNum and rectangleP into a mapped image. More... | |
int | mdlImage_getScreenPalette (byte *redMapP, byte *grnMapP, byte *bluMapP, int *paletteSizeP, int screenNum) |
Returns the color palette for the specified MicroStation display screen. More... | |
int | mdlImage_createRasterFromRGB (MSElementDescrH edPP, byte *imageBufferP, Point2d *imageSizeP, Dpoint3d *originP, double scale, int level, int useCurrentPalette, int transparentBackground) |
Creates an element descriptor for a raster (type 87/88) element representing the RGB image specified by imageBuffer and imageSize. More... | |
void | mdlImage_remapToScreenPalette (byte *outP, byte *inP, Point2d *sizeP, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize, int screenNumber) |
Remaps a palettized image to the nearest colors in a screen's palette. More... | |
int | mdlWindow_transparentRasterDataDraw (MSWindow *windowP, BSIRect *rectP, byte *inP, int srcPitch, int monoChrome, int foreground, int background, BSIRect *clipRectP, int transparent) |
Draws a block of raster data to the window identified by windowP, and overwrites the window's background only when the raster data does not match the specified transparent color. More... | |
int | mdlWindow_transparentRgbDataDraw (MSWindow *windowP, BSIRect *rectP, int srcPitch, byte *rgbBufferP, int format, BSIRect *clipRectP, RgbColorDef *transparentRgbP) |
Draws a block of RGB data to the window identified by windowP, and overwrites the window's background only when the RGB data does not match the specified transparent color. More... | |
int | mdlImage_computeScreenMap (byte screenMap[256], int screenNumber, byte *redMapP, byte *grnMapP, byte *bluMapP, int paletteSize) |
Matches each entry of the palette identified by the red, green and blue palette entries to the closest screen palette entry, and returns an index that can be used to remap the image to the screen's palette. More... | |
int | mdlImage_extRGBToScreenMap (byte **imageMapPP, byte *rgbBufferP, Point2d *sizeP, int screen, bool packBytes) |
Converts an RGB image to a mapped image that is gamma corrected and dithered to the palette of the graphics device of the indicated screen. More... | |
MSDisplayDescr * | mdlImage_displayDescrGet (int screen) |
Returns a pointer to the display descriptor associated with the indicated screen. More... | |
void | mdlDither_drawRow (MSWindow *windowP, long x0, long x1, long y, byte *redsP, byte *greensP, byte *bluesP) |
Allows an application draw a smoothly shaded image, row by row, using the same dithering algorithm that MicroStation employs for rendering. More... | |
StatusInt | mdlWindow_capture (byte **imageDataPP, Point2dP imageSizeP, MSWindowP windowP, int imageFormat, BSIRectCP rectP) |
Captures the image of the specified window or sub area of the window. More... | |
void mdlDither_drawRow | ( | MSWindow * | windowP, |
long | x0, | ||
long | x1, | ||
long | y, | ||
byte * | redsP, | ||
byte * | greensP, | ||
byte * | bluesP | ||
) |
Allows an application draw a smoothly shaded image, row by row, using the same dithering algorithm that MicroStation employs for rendering.
The caller specifies the starting and ending of pixels to draw in the row (x0 and x1), the row number (y), and arrays of red, green and blue values associated with each pixel in the row.
[out] | windowP | points to the window where the dithered row will be drawn. A pointer to a dialog box can be used in place of a pointer to an MSWindow. |
[in] | x0 | the X-coordinate of the first pixel (or column) in the dithered row. |
[in] | x1 | the X-coordinate of the last pixel in the dithered row. |
[in] | y | the Y-coordinate of all pixels in the dithered row. |
[in] | redsP | an array of red color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array. |
[in] | greensP | an array of green color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array. |
[in] | bluesP | an array of blue color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array. |
IMAGELIB_EXPORT void mdlImage_applyGamma | ( | byte * | rgbOutP, |
byte * | rgbInP, | ||
Point2d * | sizeP, | ||
double | gamma | ||
) |
Applies gamma correction to the input RGB buffer and places the result in the output RGB buffer.
rgbOutP | OUT output image buffer (may be the same as rgbInP). |
rgbInP | IN input image buffer. |
sizeP | IN pointer to image size in X and Y pixels. |
gamma | IN gamma value to be applied to image (1.0 means no correction). |
IMAGELIB_EXPORT void mdlImage_applyGammaToPalette | ( | byte * | redMapP, |
byte * | greenMapP, | ||
byte * | blueMapP, | ||
int | paletteSize, | ||
double | gamma | ||
) |
Applies gamma correction to an existing palette.
redMapP | IN OUT red palette entries. |
greenMapP | IN OUT green palette entries. |
blueMapP | IN OUT blue palette entries. |
paletteSize | IN number of palette entries. |
gamma | IN gamma value to be applied to palette (1.0 means no correction). |
IMAGELIB_EXPORT int mdlImage_byteMapToBitMap | ( | byte * | bitMapP, |
byte * | byteMapP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
Point2d * | sizeP, | ||
int | ditherMode | ||
) |
Converts an uncompressed byte-mapped color image to an uncompressed bitmap by dithering the color image.
bitMapP | OUT pointer to the bitmap image buffer in which results are stored. The caller must allocate memory for this buffer. The format of this buffer is IMAGEFORMAT_BitMap. |
byteMapP | IN pointer to the uncompressed byte-mapped buffer to be converted to monochrome. The format of the buffer is IMAGEFORMAT_ByteMap. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
ditherMode | IN either DITHERMODE_Pattern to apply a Bayer dither or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm. Both defines are in msdefs.h. |
IMAGELIB_EXPORT int mdlImage_byteMapToGreyScale | ( | byte * | greyP, |
int * | minGreyP, | ||
int * | maxGreyP, | ||
byte * | byteMapP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
Point2d * | sizeP | ||
) |
Converts an uncompressed byte-mapped color image with format IMAGFORMAT_ByteMap to a greyscale image based on the formula:
greyP | OUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer. |
minGreyP | OUT the minimum greyscale value. If the pointer is NULL, this value is not returned. |
maxGreyP | OUT the maximum greyscale value. If the pointer is NULL, this value is not returned. |
byteMapP | IN pointer to the byte-mapped color image data to be converted to greyscale. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
Public int mdlImage_captureScreen | ( | byte ** | imagePP, |
BSIRect * | rectangleP, | ||
int | screenNum, | ||
int | imageFormat | ||
) |
Captures all or part of a MicroStation graphics screen into an RGB or byte-mapped image buffer.
[out] | imagePP | pointer to the allocated image data buffer. When the user no longer needs this buffer, this memory should be freed. |
[in] | rectangleP | pointer to a rectangular portion of the screen to be captured (in screen coordinates). |
[in] | screenNum | number of physical screen to capture. |
[in] | imageFormat | either IMAGEFORMAT_RGB or IMAGEFORMAT_ByteMap. Use mdlImage_getScreenPalette to determine the RGB colors for a byte-mapped image. |
Captures the rectangular portion of the MicroStation display specified by screenNum and rectangleP into a mapped image.
The image map is allocated and the base address returned in imageMapPP.
[out] | imageMapPP | pointer to the allocated image data buffer. When the user no longer needs this buffer, this memory should be freed. |
[in] | rectangleP | pointer to a rectangular portion of the screen to be captured (in screen coordinates). |
[in] | screenNum | number of physical screen to capture. |
int mdlImage_checkStop | ( | int | target, |
int | current | ||
) |
A generic stop function called during image processing.
The purpose of a stop function is to allow the user to halt an image manipulation process by pressing Ctrl-C on the keyboard.
int mdlImage_computeScreenMap | ( | byte | screenMap[256], |
int | screenNumber, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize | ||
) |
Matches each entry of the palette identified by the red, green and blue palette entries to the closest screen palette entry, and returns an index that can be used to remap the image to the screen's palette.
[out] | screenMap | array of indices that will map from the image palette to the closest color in the screen palette. Matching is based on closest HSV values. |
[in] | screenNumber | the screen number on which the image data is to be displayed; 0 for the main screen, 1 for the secondary screen. |
[in] | redMapP | red color palatte for the image. |
[in] | grnMapP | green color palatte for the image. |
[in] | bluMapP | blue color palette for the image. |
[in] | paletteSize | the number of palette entries. Only paletteSize entries of screenMap are filled. |
IMAGELIB_EXPORT int mdlImage_convertToGreyScale | ( | void * | dstDataP, |
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | paletteSizeP, | ||
void * | srcDataP, | ||
Point2d * | imageSizeP, | ||
int | imageFormat | ||
) |
Converts the specified image to greyScale.
dstDataP | OUT pointer to the buffer to receive the greyscale image. |
redMapP | IN OUT red palette entries (changed to greyscale if srcP == dstP). |
grnMapP | IN OUT green palette entries (changed to greyscale if srcP == dstP). |
bluMapP | IN OUT blue palette entries (changed to greyscale if srcP == dstP). |
paletteSizeP | IN OUT number of palette entries (changed to 256 if srcP == dstP). |
srcDataP | IN the source image to be converted to greyscale. |
imageSizeP | IN the size of the input image. |
imageFormat | IN the format of the source image (and destination) data. |
IMAGELIB_EXPORT int mdlImage_convertToUpperLeftHorizontal | ( | byte ** | imagePP, |
Point2d * | sizeP, | ||
int | ingrOrientation, | ||
int | imageFormat | ||
) |
Converts an image to upper-left-horizontal orientation, so the first image pixel is the upper-left corner, and subsequent pixels proceed from left to right, then from top to bottom.
imagePP | IN OUT the address of the image buffer. This address can change depending on the type of mirroring or rotation required to normalize the orientation to upper-left-horizontal. If the image is already in upper-left-horizontal orientation, no change occurs. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
ingrOrientation | IN orientation of the original image; an INGR_ORIENT_... constant in image.h. |
imageFormat | IN format of the original image; an IMAGEFORMAT_... defined constant in image.h. |
IMAGELIB_EXPORT int mdlImage_createFileFromBitMap | ( | WCharCP | nameP, |
DgnPlatform::ImageFileFormat | type, | ||
Point2d * | sizeP, | ||
byte * | bitMapP, | ||
bool | runLengthEncode, | ||
RgbColorDef * | foregroundColorP, | ||
RgbColorDef * | backgroundColorP | ||
) |
creates an image file from a memory bitmap.
nameP | IN full path name of the file to be written. | |||||||||
type | IN one of the possible IMAGEFILE_ types contained in image.h. If type is other than a monochrome type, this function converts the bitmap to a byte mapped format using the specified foregroundColorP and backgroundColorP colors, then calls mdlImage_createFileFromMap. The monochrome values for type include: IMAGEFILE_CIT, IMAGEFILE_RLE, IMAGEFILE_TIFF. | |||||||||
sizeP | IN size of the bitmap in X and Y pixels. | |||||||||
bitMapP | IN pointer to the bitmap image data. Data must be in either IMAGEFORMAT_BitMap or IMAGEFORMAT_RLEBitMap formats. | |||||||||
runLengthEncode | IN indicates whether the data has been compressed or not. The following data formats are assumed depending on the value of runLengthEncode:
| |||||||||
foregroundColorP | IN RGB value for the foreground color. This value is used only if type is not one of the monochrome types listed above. | |||||||||
backgroundColorP | IN RGB value for the background color. This value is used only if type is not one of the monochrome types listed above. |
IMAGELIB_EXPORT int mdlImage_createFileFromBuffer | ( | WCharCP | saveAsFileNameP, |
DgnPlatform::ImageFileFormat | fileType, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
Point2d * | sizeP, | ||
byte * | imageDataP, | ||
int | imageFormat, | ||
void * | param1P, | ||
void * | param2P, | ||
void * | param3P, | ||
int | paletteSize, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio | ||
) |
Creates a file from an image buffer by using the imageFormat to determine how to best write the file.
saveAsFileNameP | IN full path name of the file to be created by this function. |
fileType | IN one of the IMAGEFILE_ constants in image.h identifying the disk format, or -1 to use the file name extension to determine the disk format. |
colorMode | IN one of the COLORMODE_ constants in image.h identifying the color mode of the source buffer. |
sizeP | IN source image size in X and Y pixels. |
imageDataP | IN pointer to the source data in one of the indicated formats. |
imageFormat | IN one of the IMAGEFORMAT_ constants in image.h identifying the memory storage format. |
param1P | IN a pointer that has several uses depending on the imageFormat. (see below) |
param2P | IN a pointer that has several uses depending on the imageFormat. (see below) |
param3P | IN a pointer that has several uses depending on the imageFormat. (see below) |
paletteSize | IN the number of palette entries if the image format is IMAGEFORMAT_ByteMap, IMAGEFORMAT_GreyScale or IMAGEFORMAT_PackByte. |
compressType | IN compression ratio for JPEG images. Otherwise, it is not used. |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
imageFormat Value | Function Used |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | mdlImage_createFileFromBitMap |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale | mdlImage_extCreateFileFromMap |
IMAGEFORMAT_PackByte | mdlImage_createFileFromPackByte or if JPEG, then mdlImage_extCreateFileFromRGB |
IMAGEFORMAT_RGBSeparate IMAGEFORMAT_RGB IMAGEFORMAT_RGBA | mdlImage_extCreateFileFromRGB |
imageFormat Value | param1P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | RgbColorDef *foregroundColorP |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *redMapP |
Other | unused |
imageFormat Value | param2P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | RgbColorDef *backgroundColorP |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *grnMapP |
Other | unused |
imageFormat Value | param3P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | unused |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *bluMapP |
Other | unused |
IMAGELIB_EXPORT int mdlImage_createFileFromMap | ( | WCharCP | name, |
DgnPlatform::ImageFileFormat | type, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
Point2d * | sizeP, | ||
byte * | imageMapP, | ||
byte * | redPaletteP, | ||
byte * | grnPaletteP, | ||
byte * | bluPaletteP, | ||
int | paletteSize | ||
) |
Creates the image file specified by fileName, fileType and colorMode from a mapped image.
name | IN name of file. |
type | IN type of file (from image.h). |
colorMode | IN color mode (from image.h). |
sizeP | IN pointer to size of image in X and Y pixels. |
imageMapP | IN address of the image map with a single-byte color palette index for each of the (sizeP->x * sizeP->y) pixels. |
redPaletteP | IN red palette values. |
grnPaletteP | IN green palette values. |
bluPaletteP | IN blue palette values. |
paletteSize | IN specifies number of color palette entries. |
IMAGELIB_EXPORT int mdlImage_createFileFromRGB | ( | WCharCP | name, |
DgnPlatform::ImageFileFormat | type, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
Point2d * | sizeP, | ||
byte * | imageBufferP | ||
) |
Creates the image file specified by fileName, fileType and colorMode from an RGB image.
name | IN name of file. |
type | IN type of file (from image.h). |
colorMode | IN color mode (from image.h). |
sizeP | IN pointer to size of image in X and Y pixels. |
imageBufferP | IN address of the image buffer with red, green and blue rows stored separately for each scan line. The size of imageBuffer should be (3 * sizeP->x * sizeP->y). |
IMAGELIB_EXPORT StatusInt mdlImage_createMonochromeFile | ( | WCharCP | fileNameP, |
DgnPlatform::ImageFileFormat | fileType, | ||
Point2d * | imageSizeP, | ||
byte * | imageDataP, | ||
int | imageFormat, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio | ||
) |
Creates a monochrome file from the specified image data.
fileNameP | IN the name of the file to create. |
fileType | IN the type of the file (from image.h) |
imageSizeP | IN the size of the image in X and Y pixels. |
imageDataP | IN the image data for each pixel. |
imageFormat | IN the format of the image data. |
redMapP | IN red palette entries (or NULL). |
grnMapP | IN green palette entries (or NULL). |
bluMapP | IN blue palette entries (or NULL). |
paletteSize | IN the number of palette entries. |
compressType | IN the type of compression to apply (from image.h) |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
IMAGELIB_EXPORT int mdlImage_createRasterFile | ( | WCharCP | saveAsFileNameP, |
DgnPlatform::ImageFileFormat | fileType, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio, | ||
Point2d * | imageSizeP, | ||
byte * | imageDataP, | ||
int | imageFormat, | ||
void * | param1P, | ||
void * | param2P, | ||
void * | param3P, | ||
int | paletteSize | ||
) |
Creates a raster file of the specified name and type using the given raster data.
saveAsFileNameP | IN the name of the raster file to be created. |
fileType | IN the type of the file to be created (IMAGEFILE types in image.h). |
colorMode | IN the color model to use (COLORMODE in image.h). |
compressType | IN the compression type to use (COMPRESSTYPE in image.h). |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
imageSizeP | IN the size of the image (in X and Y pixels). |
imageDataP | IN the image data for each pixel. |
imageFormat | IN the image buffer format (IMAGEFORMAT in image.h). |
param1P | IN a pointer that has several uses depending on the imageFormat. (see below) |
param2P | IN a pointer that has several uses depending on the imageFormat. (see below) |
param3P | IN a pointer that has several uses depending on the imageFormat. (see below) |
paletteSize | IN the number of palette entries. |
imageFormat Value | Function Used |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | mdlImage_createFileFromBitMap |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale | mdlImage_extCreateFileFromMap |
IMAGEFORMAT_PackByte | mdlImage_createFileFromPackByte or if JPEG, then mdlImage_extCreateFileFromRGB |
IMAGEFORMAT_RGBSeparate IMAGEFORMAT_RGB IMAGEFORMAT_RGBA | mdlImage_extCreateFileFromRGB |
imageFormat Value | param1P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | RgbColorDef *foregroundColorP |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *redMapP |
Other | unused |
imageFormat Value | param2P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | RgbColorDef *backgroundColorP |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *grnMapP |
Other | unused |
imageFormat Value | param3P usage |
---|---|
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap | unused |
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte | byte *bluMapP |
Other | unused |
int mdlImage_createRasterFromRGB | ( | MSElementDescrH | edPP, |
byte * | imageBufferP, | ||
Point2d * | imageSizeP, | ||
Dpoint3d * | originP, | ||
double | scale, | ||
int | level, | ||
int | useCurrentPalette, | ||
int | transparentBackground | ||
) |
Creates an element descriptor for a raster (type 87/88) element representing the RGB image specified by imageBuffer and imageSize.
[out] | edPP | set to point to the raster element descriptor. |
[in] | imageBufferP | RGB image buffer. |
[in] | imageSizeP | image size (in X and Y pixels). |
[in] | originP | specifies the upper left corner of the raster element in the design file. |
[in] | scale | specifies the ratio of design file coordinates in the current coordinate system to pixels. |
[in] | level | specifies the level of the raster element. |
[in] | useCurrentPalette | If non-zero, the current design file color palette is used and the raster element is calculated to match this palette. Otherwise an optimized color palette is calculated for the image, and the image colors are placed at the end of the design file palette. The first 15 palette colors are never changed, the remaining 240 colors may be changed if the input image contains a wide spectrum of colors. |
[in] | transparentBackground | If non-zero, the background (black) pixels are transparent. |
MSDisplayDescr* mdlImage_displayDescrGet | ( | int | screen | ) |
Returns a pointer to the display descriptor associated with the indicated screen.
From the display descriptor, defined in global.h, information can be obtained such as the display resolution and the number of colors that the screen supports.
[in] | screen | the screen number on which the image data is to be displayed; 0 for the main screen, 1 for the secondary screen. |
IMAGELIB_EXPORT void mdlImage_ditherCleanup | ( | void | ) |
Frees the internal buffers allocated during the dithering process.
IMAGELIB_EXPORT int mdlImage_ditherInitialize | ( | int | nColors, |
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | width | ||
) |
Initialization for dithering.
Must be called before any mdlImage_dither... functions to specify the color palette and scan line width. ~mmdlImage_ditherRow should then be called for each row. The rows should be processed sequentially for the error diffusion to occur correctly. After processing all rows, ~mmdlImage_ditherCleanup should be called to free the internal buffers allocated during the dithering process.
nColors | IN number of palette entries. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
width | IN width of scanlines (in pixels). |
IMAGELIB_EXPORT int mdlImage_ditherInitializeWithGamma | ( | int | nColors, |
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | width, | ||
double | gammaValue | ||
) |
Initialization for dithering with gamma corrected pixels.
Must be called before any mdlImage_dither... functions to specify the color palette and scan line width. ~mmdlImage_ditherRow should then be called for each row. The rows should be processed sequentially for the error diffusion to occur correctly. After processing all rows, ~mmdlImage_ditherCleanup should be called to free the internal buffers allocated during the dithering process.
nColors | IN the number of palette entries. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
width | IN the width of scanlines. |
gammaValue | IN the gamma correction value to be applied to the dithered pixels. |
IMAGELIB_EXPORT int mdlImage_ditherRow | ( | byte * | outputLineP, |
byte * | redP, | ||
byte * | grnP, | ||
byte * | bluP, | ||
int | width | ||
) |
Creates a dithered scanline from a sequence of red, green and blue pixels.
After calling ~mmdlImage_ditherInitialize or ~mmdlImage_ditherInitializeWithGamma to specify the color palette and scan line width, mdlImage_ditherRow should be called for each row. The rows should be processed sequentially for the error diffusion to occur correctly. After processing all rows, ~mmdlImage_ditherCleanup should be called to free the internal buffers allocated during the dithering process.
outputLineP | OUT pointer to row in the image map to receive color map indices for each pixel. |
redP | IN red values for each pixel. |
grnP | IN green values for each pixel. |
bluP | IN blue values for each pixel. |
width | IN number of pixels in scanline. |
IMAGELIB_EXPORT int mdlImage_ditherRowWithOffset | ( | byte * | outputLineP, |
byte * | redP, | ||
byte * | grnP, | ||
byte * | bluP, | ||
int | width, | ||
int | channelOffset | ||
) |
Creates a dithered scanline from a sequence of red, green and blue pixels.
After calling ~mmdlImage_ditherInitialize or ~mmdlImage_ditherInitializeWithGamma to specify the color palette and scan line width, mdlImage_ditherRow should be called for each row. The rows should be processed sequentially for the error diffusion to occur correctly. After processing all rows, ~mmdlImage_ditherCleanup should be called to free the internal buffers allocated during the dithering process.
outputLineP | OUT pointer to row in the image map to receive color map indices for each pixel. |
redP | IN the red values for each pixel. |
grnP | IN the green values for each pixel. |
bluP | IN the blue values for each pixel. |
width | IN the number of pixels in the scanline. |
channelOffset | IN the number of bytes between channels. |
IMAGELIB_EXPORT void mdlImage_doubleImage | ( | byte * | outMapP, |
byte * | inMapP, | ||
Point2d * | sizeP, | ||
int | bytesPerPixel | ||
) |
Doubles the size of the source image to produce the output image.
This function is useful when producing movies to double the size of the image so that is it can be viewed easier.
outMapP | OUT pointer to a buffer to hold the destination image. Since the size of the image doubled in each dimension, the buffer is actually 4 times as large as the source image. Its size is computed as follows: |
inMapP | IN pointer to the source image, formatted as either IMAGEFORMAT_ByteMap or IMAGEFORMAT_RGB. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
bytesPerPixel | IN the number of bytes required per pixel. If the image format is IMAGEFORMAT_ByteMap, bytesPerPixel is 1. If the image format is IMAGEFORMAT_RGB, bytesPerPixel is 3. |
IMAGELIB_EXPORT int mdlImage_extCreateFileFromMap | ( | WCharCP | name, |
DgnPlatform::ImageFileFormat | type, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
Point2d * | sizeP, | ||
byte * | imageMapP, | ||
byte * | redPaletteP, | ||
byte * | grnPaletteP, | ||
byte * | bluPaletteP, | ||
int | paletteSize, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio, | ||
byte * | transparencyP | ||
) |
Creates the image file specified by fileName, fileType and colorMode from a mapped image, allowing compression and transparency to be set.
name | IN name of file. |
type | IN type of file (from image.h). |
colorMode | IN color mode (from image.h). |
sizeP | IN pointer to size of image in X and Y pixels. |
imageMapP | IN address of the image map with a single-byte color palette index for each of the (sizeP->x * sizeP->y) pixels. |
redPaletteP | IN red palette values. |
grnPaletteP | IN green palette values. |
bluPaletteP | IN blue palette values. |
paletteSize | IN specifies number of color palette entries. |
compressType | IN the type of compression to use in creating the file (from image.h) |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
transparencyP | IN the index of the transparency value, or the RGB triple to use for the transparency value. |
IMAGELIB_EXPORT int mdlImage_extCreateFileFromRGB | ( | WCharCP | name, |
DgnPlatform::ImageFileFormat | type, | ||
DgnPlatform::ImageColorMode | colorMode, | ||
Point2d * | sizeP, | ||
byte * | imageBufferP, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio, | ||
byte * | transparencyP | ||
) |
Creates the image file specified by fileName, fileType and colorMode from an RGB image, allowing compression type and transparency to be set.
name | IN name of file. |
type | IN type of file (from image.h). |
colorMode | IN color mode (from image.h). |
sizeP | IN pointer to size of image in X and Y pixels. |
imageBufferP | IN address of the image buffer with red, green and blue rows stored separately for each scan line. The size of imageBuffer should be (3 * sizeP->x * sizeP->y). |
compressType | IN the type of compression to use in creating the file (from image.h) |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
transparencyP | IN the index of the transparency value, or the RGB tripple to use for the transparency value. |
IMAGELIB_EXPORT int mdlImage_extCreateMonoFileFromRGB | ( | WCharCP | name, |
DgnPlatform::ImageFileFormat | type, | ||
Point2d * | sizeP, | ||
byte * | imageBufferP, | ||
DgnPlatform::CompressionType | compressType, | ||
DgnPlatform::CompressionRatio | compressRatio, | ||
byte * | transparencyP, | ||
RgbColorDef * | backgroundColorP | ||
) |
Creates the monochrome image file specified by fileName, fileType from an RGB image, allowing compression type.
This function is very similar to mdlImage_extCreateFileFromRGB wihtout the paramter colorMode. This function doesn't use the threshold to convert RGB value to monochrome is replaced by : all pixel # backgound color will be ON.
name | IN name of file. |
type | IN type of file (from image.h). |
sizeP | IN pointer to size of image in X and Y pixels. |
imageBufferP | IN address of the image buffer with red, green and blue rows stored separately for each scan line. The size of imageBuffer should be (3 * sizeP->x * sizeP->y). |
compressType | IN the type of compression to use in creating the file (from image.h) |
compressRatio | IN the ratio of compression to use in creating the file (from image.h) |
transparencyP | IN the index of the transparency value, or the RGB tripple to use for the transparency value. |
backgroundColorP | IN background color used in monochrome mode. Must be set if the colorMode is Monochrome, can be NULL with all other colorMode. |
IMAGELIB_EXPORT int mdlImage_extMapToRGB | ( | byte ** | rgbBufferPP, |
byte * | mapP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
bool | packBytes | ||
) |
Converts a byte-mapped image from IMAGEFORMAT_ByteMap or IMAGEFORMAT_PackByte format to an RGB image in IMAGEFORMAT_RGBSeparate format.
The byte-mapped image can be either compressed or uncompressed. This function supplements ~mmdlImage_mapToRGB by handling compressed byte-mapped data.
rgbBufferPP | OUT pointer to a buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
mapP | IN address of the byte-mapped image data that is converted to RGB format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
packBytes | IN flag to indicate if bytes should be packed (run length encoded). |
IMAGELIB_EXPORT int mdlImage_extractBitMapSubImage | ( | byte * | outMapP, |
Point2d * | outSizeP, | ||
byte * | inBitMapP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP | ||
) |
Extracts a bitmapped subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outMapP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_BitMap and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inBitMapP | IN source image buffer in IMAGEFORMAT_BitMap format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
IMAGELIB_EXPORT int mdlImage_extractByteMapSubImage | ( | byte * | outMapP, |
Point2d * | outSizeP, | ||
byte * | inMapP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
byte * | mapP | ||
) |
Extracts a byte mapped subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outMapP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inMapP | IN source image buffer in IMAGEFORMAT_ByteMap format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
mapP | IN optional array of color indices used to remap the colors. mapP is a pointer to an array of 256 elements, or NULL if no color mapping is to occur. |
IMAGELIB_EXPORT int mdlImage_extractPackByteSubImage | ( | byte ** | outRowPP, |
Point2d * | outSizeP, | ||
byte ** | inRowPP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
byte * | mapP | ||
) |
Extracts a packbyte subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outRowPP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_PackByte and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inRowPP | IN source image buffer in IMAGEFORMAT_PackByte format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
mapP | IN optional array of color indices used to remap the colors. mapP is a pointer to an array of 256 elements, or NULL if no color mapping is to occur. |
IMAGELIB_EXPORT int mdlImage_extractRGBASubImage | ( | byte * | outP, |
Point2d * | outSizeP, | ||
byte * | inP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP | ||
) |
Extracts an RGBA subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_RGBA and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inP | IN source image buffer in IMAGEFORMAT_RGBA format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
IMAGELIB_EXPORT int mdlImage_extractRGBSubImage | ( | byte * | outP, |
Point2d * | outSizeP, | ||
byte * | inP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP | ||
) |
Extracts an RGB subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_RGBSeparate and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inP | IN source image buffer in IMAGEFORMAT_RGBSeparate format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
IMAGELIB_EXPORT int mdlImage_extractSubImage | ( | byte * | outP, |
Point2d * | outSizeP, | ||
byte * | inP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
int | imageFormat | ||
) |
Extracts a subimage from a larger image and stretches or decimates it to fit a user-defined output image size.
outP | OUT pointer to a buffer allocated by the caller. The format of this buffer is defined by imageFormat and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inP | IN source image buffer. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
imageFormat | IN IMAGEFORMAT type defined in image.h. |
IMAGELIB_EXPORT int mdlImage_extReadFileToMap | ( | byte ** | imageMapPP, |
Point2d * | imageSizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | paletteSizeP, | ||
WCharCP | fileNameP, | ||
DgnPlatform::ImageFileFormat | fileType, | ||
bool | packBytes | ||
) |
Reads a file which contains a byte-mapped image with no more than 265 color palette entries.
This function is an extension to ~mmdlImage_readFileToMap, except that the format of the data returned is run length encoded if the packBytes flag is set. The packbytes compression scheme is a compact encoding scheme that rarely increases the size required to maintain a byte-mapped image, although is does typically add somewhat to the time required to display the image data.
imageMapPP | OUT address of an image buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
imageSizeP | OUT returned with the size of the image in X and Y pixels. |
redMapP | OUT pointer to the red color palette entry. |
grnMapP | OUT pointer to the green color palette entry. |
bluMapP | OUT pointer to the blue color palette entry. |
paletteSizeP | OUT the number of palette entries. |
fileNameP | IN full path name of the file to be read. |
fileType | IN one of the possible IMAGEFILE_ types defined in image.h; or -1 for automatic detection of the type by using the file name extension, or header information in the file itself. |
packBytes | IN flag indicating whether to compress the byte-map that is read. If packBytes is true, data will have IMAGEFORMAT_PackByte. If packBytes is false, data will have IMAGEFORMAT_ByteMap. |
IMAGELIB_EXPORT int mdlImage_extRGBToMap | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
bool | packBytes | ||
) |
Converts from an RGB image with format IMAGEFORMAT_RGBSeparate to a byte-mapped image with format IMAGEFORMAT_ByteMap or IMAGEFORMAT_PackByte.
This function is similar to ~mmdlImage_RGBToMap, except that is supports both compressed and uncompressed byte-mapped formats.
imageMapPP | OUT address of an image buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
rgbBufferP | IN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
redMapP | IN pointer to the red color palette entry |
grnMapP | IN pointer to the green color palette entry |
bluMapP | IN pointer to the blue color palette entry |
paletteSize | IN the number of palette entries. |
packBytes | IN flag that identifies whether to compress the byte-mapped image. If packBytes is true, the output format is IMAGEFORMAT_PackByte. If packBytes is false, the output format is IMAGEFORMAT_ByteMap. |
int mdlImage_extRGBToScreenMap | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
int | screen, | ||
bool | packBytes | ||
) |
Converts an RGB image to a mapped image that is gamma corrected and dithered to the palette of the graphics device of the indicated screen.
The mapped image is then suitable for display by mdlWindow_rasterDataDraw. This function is similar to mdlImage_RGBToScreenMap, except that it supports both compressed and uncompressed byte-mapped formats.
[out] | imageMapPP | address of an image buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using mdlImage_freeImage. |
[in] | rgbBufferP | pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format. |
[in] | sizeP | pointer to the size of the image in X and Y pixels. |
[in] | screen | the screen number on which the image data is to be displayed. Screen is 0 for the main screen, 1 for the secondary screen. |
[in] | packBytes | flag that identifies whether to compress the byte-mapped image. If packBytes is true, the output format is IMAGEFORMAT_PackByte. If packBytes is false, the output format is IMAGEFORMAT_ByteMap. |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat mdlImage_fileType | ( | DgnPlatform::ImageFileFormat | fileType, |
WCharCP | fileNameP | ||
) |
Determines the format of the specified image file.
fileType | IN set to IMAGEFILE_UNKNOWN to find the type of the file, or set to a specific file type to verify that the file is of that type. |
fileNameP | IN the name of the file to verify or determine type |
IMAGELIB_EXPORT void mdlImage_freeImage | ( | void * | imageP, |
Point2d * | sizeP, | ||
int | imageFormat | ||
) |
Frees the memory buffer identified by imageP.
imageP | IN pointer to the image memory to be freed. |
sizeP | IN size of the image in X and Y pixels. Needed for some formats, such as run-length-encoded formats, since memory is allocated on a row-by-row basis. |
imageFormat | IN an IMAGEFORMAT type defined in image.h. |
IMAGELIB_EXPORT void mdlImage_getBalancedPalette | ( | byte * | redMapP, |
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | numColorsP | ||
) |
Calculates a balanced color palette.
A balanced color palette will contain a balanced mixture of all possible colors. This palette could be used for dithering an RGB image, although computing an optimized palette with mdlImage_getOptimizedPalette is preferable.
redMapP | OUT red values for balanced palette. |
grnMapP | OUT green values for balanced palette. |
bluMapP | OUT blue values for balanced palette. |
numColorsP | OUT number of colors in the palette. |
IMAGELIB_EXPORT int mdlImage_getExportFormat | ( | WCharP | formatName, |
DgnPlatform::ImageFileFormat * | importTypeP, | ||
int | index | ||
) |
Determines if the specified image file format is supported for export.
By using this function, an application can support all of the file formats supported by MicroStation without having to explicitly know what formats are available.
formatName | OUT image format name |
importTypeP | OUT IMAGEFILE_ type for returned format, from image.h |
index | IN index of export array to return |
IMAGELIB_EXPORT int mdlImage_getExportSupport | ( | DgnPlatform::ImageColorMode * | defaultModeP, |
bool * | rgbSupportP, | ||
bool * | palette256SupportP, | ||
bool * | palette16SupportP, | ||
bool * | greyScaleSupportP, | ||
bool * | monochromeSupportP, | ||
DgnPlatform::ImageFileFormat | imageType | ||
) |
For a specified image format, returns the default color mode, and whether each of the various color modes is supported for export.
defaultModeP | OUT default color mode. |
rgbSupportP | OUT support for 24 bit RGB. |
palette256SupportP | OUT support for 256 color palette. |
palette16SupportP | OUT support for 16 color palette. |
greyScaleSupportP | OUT support for grey scale. |
monochromeSupportP | OUT support for monochrome. |
imageType | IN image type (from image.h). |
IMAGELIB_EXPORT int mdlImage_getExtension | ( | WCharP | ext, |
DgnPlatform::ImageFileFormat | type | ||
) |
Returns the default three character file extension for the specified image format.
ext | OUT default file extension (MAXEXTENSIONLENGTH characters). |
type | IN image type (from image.h). |
IMAGELIB_EXPORT StatusInt mdlImage_getImageBgColor | ( | byte * | pixelP, |
WCharCP | name | ||
) |
Retrieves the background color information from the specified image file.
pixelP | OUT a 4 byte buffer that receives the background color. |
name | IN name of the image file to get the background color from. |
IMAGELIB_EXPORT int mdlImage_getImportFormat | ( | WCharP | formatName, |
DgnPlatform::ImageFileFormat * | importTypeP, | ||
int | index | ||
) |
Determines if the specified image file format is supported for import.
By using this function, an application can support all of the file formats supported by MicroStation without having to explicitly know what formats are available.
formatName | OUT image format name |
importTypeP | OUT IMAGEFILE_ type for returned format, from image.h |
index | IN index of export array to return |
IMAGELIB_EXPORT void mdlImage_getMapUsage | ( | byte | mapUsed[256], |
byte * | mapP, | ||
Point2d * | sizeP, | ||
bool | packBytes | ||
) |
Determines which palette entries are used or available in an image.
This function is useful to determine an available index to use as an index for a transparent color.
mapUsed | OUT an array of values, which will be non-zero or false. A non-zero mapUsed entry indicates that the palette entry is used. A false entry indicates that the palette entry is unused. |
mapP | IN pointer to the byte-mapped image data. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
packBytes | IN if true, the image is compressed with packbytes compression and the image format is IMAGEFORMAT_PackByte. If false, the image is uncompressed and the image format is IMAGEFORMAT_ByteMap. |
IMAGELIB_EXPORT int mdlImage_getOptimizedPalette | ( | byte * | redMapP, |
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | paletteSizeP, | ||
int | maxColors, | ||
byte * | imageBufferP, | ||
Point2d * | sizeP | ||
) |
Calculates an optimized color palette for an RGB image.
The RGB values for each pixel are examined to determine the color palette that will most accurately display the image. The RGB image can then be converted to a mapped image using the mdlImage_dither... functions or ~mmdlImage_RGBToMap.
redMapP | OUT red values for optimized palette. |
grnMapP | OUT green values for optimized palette. |
bluMapP | OUT blue values for optimized palette. |
paletteSizeP | OUT number of palette entries used. |
maxColors | IN maximum colors in optimized palette. |
imageBufferP | IN the base address of the image buffer with red, green, and blue rows stored separately for each scan line. The size of imageBuffer should equal (3 * sizeP->x * sizeP->y) bytes. |
sizeP | IN pointer to size of imageBuffer in X and Y pixels |
IMAGELIB_EXPORT int mdlImage_getOSFileType | ( | UInt32 * | osFileTypeP, |
DgnPlatform::ImageFileFormat | imageType | ||
) |
Returns the operating system file type for the specified image type.
osFileTypeP | OUT O.S. file type. |
imageType | IN image type (from image.h) |
int mdlImage_getScreenPalette | ( | byte * | redMapP, |
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | paletteSizeP, | ||
int | screenNum | ||
) |
Returns the color palette for the specified MicroStation display screen.
The red, green and blue palette entries are returned in redMapP, grnMapP and bluMapP. These buffers must be able to contain a maximum of 256 single byte values.
[out] | redMapP | red palette entries. |
[out] | grnMapP | green palette entries. |
[out] | bluMapP | blue palette entries. |
[out] | paletteSizeP | number of palette entries. |
[in] | screenNum | screen number. |
IMAGELIB_EXPORT int mdlImage_greyScaleToBitMap | ( | byte * | bitMapP, |
byte * | greyP, | ||
Point2d * | sizeP, | ||
int | minGrey, | ||
int | maxGrey, | ||
int | ditherMode | ||
) |
Converts an uncompressed byte-per-pixel greyscale image to an uncompressed bitmap by dithering the greyscale image.
bitMapP | OUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer. |
greyP | IN pointer to the greyscale source image buffer to be converted to monochrome. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
minGrey | IN the minimum greyscale value. |
maxGrey | IN the maximum greyscale value. |
ditherMode | IN either DITHERMODE_Pattern to apply a Bayer dither or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm. Both defines are in msdefs.h. |
IMAGELIB_EXPORT int mdlImage_mapToRGB | ( | byte ** | rgbBufferPP, |
byte * | mapP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP | ||
) |
Converts a mapped image to an RGB image.
The address of the output image buffer, allocated by this functions, is returned in rgbBufferPP. This buffer should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage. ~mmdlImage_mapToRGBBuffer performs the same task, but does not allocate memory for the output image.
rgbBufferPP | OUT pointer to allocated RGB image buffer. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
mapP | IN image map. |
sizeP | IN pointer to size of the image in X and Y pixels. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
IMAGELIB_EXPORT int mdlImage_mapToRGBBuffer | ( | byte * | rgbBufferP, |
byte * | mapP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP | ||
) |
Converts a mapped image to an RGB image.
The output image is allocated by mdlImage_mapToRGB and the base address is returned in rgbBufferPP. This buffer should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage ~mmdlImage_mapToRGB performs the same task but additionally, but does not allocate memory for the output image.
rgbBufferP | OUT image buffer (RGB). When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
mapP | IN image map. |
sizeP | IN pointer to size of the image in X and Y pixels. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
IMAGELIB_EXPORT int mdlImage_memorySize | ( | Point2d * | sizeP, |
int | imageFormat | ||
) |
Returns the amount of memory initially required to hold the image in the specified image format.
If the image is uncompressed, this is the total size. If it is compressed, this is the amount necessary to hold an array of pointers to each image row. Memory for each row will be allocated in subsequent operations once the size of the compressed row is determined.
sizeP | IN pointer to the size of the image in X and Y pixels. |
imageFormat | IN any of the IMAGEFORMAT types defined in image.h. |
IMAGELIB_EXPORT int mdlImage_mirror | ( | byte * | inpBufferP, |
Point2d * | imageSizeP, | ||
int | imageFormat, | ||
bool | vertical | ||
) |
Mirrors an image by reversing the pixels, either horizontally or vertically.
inpBufferP | IN OUT pointer to the image buffer. The original buffer is overwritten during the mirror operation. |
imageSizeP | IN size of the image buffer in X and Y pixels. |
imageFormat | IN one of the IMAGEFORMAT types defined in image.h. |
vertical | IN if true, the image is mirrored vertically; if false, the image is mirrored horizontally. |
IMAGELIB_EXPORT void mdlImage_negate | ( | byte * | rgbOutP, |
byte * | rgbInP, | ||
Point2d * | sizeP | ||
) |
Returns an RGB image that is the negated version of the input RGB image.
rgbOutP | OUT output image buffer (may be the same as rgbInP). |
rgbInP | IN input image buffer. |
sizeP | IN pointer to image size in X and Y pixels. |
IMAGELIB_EXPORT void mdlImage_negatePalette | ( | byte * | redMapP, |
byte * | greenMapP, | ||
byte * | blueMapP, | ||
int | paletteSize | ||
) |
Returns a negated version of the supplied color palette.
redMapP | IN OUT red palette entries. |
greenMapP | IN OUT green palette entries. |
blueMapP | IN OUT blue palette entries. |
paletteSize | IN number of palette entries. |
IMAGELIB_EXPORT void mdlImage_packByteBuffer | ( | byte * | outP, |
int * | encodeSizeP, | ||
byte * | inP, | ||
int | rawSize | ||
) |
Encodes a sequence of byte-mapped data into packbyte format.
It performs the inverse of ~mmdlImage_unpackByteBuffer.
outP | OUT buffer that holds the packbyte encoded data. The caller should allocate this buffer to be a minimum of (4 * rawSize / 3 + 2) bytes in length. |
encodeSizeP | OUT the actual encoded size required. This value is normally used to allocate space to hold a row of encoded image data. |
inP | IN pointer to the source uncompressed byte-mapped data in format IMAGEFORMAT_ByteMap. |
rawSize | IN the number of pixels to encode. |
IMAGELIB_EXPORT int mdlImage_packByteToBitMap | ( | byte * | bitMapP, |
byte * | packByteP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
Point2d * | sizeP, | ||
int | ditherMode | ||
) |
Converts a compressed byte-mapped color image to an uncompressed bitmap by dithering the color image.
bitMapP | OUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer. The format of this buffer is IMAGEFORMAT_BitMap. |
packByteP | IN pointer to the compressed byte-mapped buffer to be converted to monochrome. The format of the buffer is IMAGEFORMAT_PackByte. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN number of palette entries. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
ditherMode | IN DITHERMODE_Pattern to apply a Bayer dither; or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm. |
IMAGELIB_EXPORT int mdlImage_packByteToGreyScale | ( | byte * | greyP, |
int * | minGreyP, | ||
int * | maxGreyP, | ||
byte * | packByteP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
Point2d * | sizeP | ||
) |
Converts a compressed byte-mapped color image with format IMAGEFORMAT_PackByte to a greyscale image based on the formula:
greyP | OUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer. |
minGreyP | OUT the minimum greyscale value. If the pointer is NULL, this value is not returned. |
maxGreyP | OUT the maximum greyscale value. If the pointer is NULL, this value is not returned. |
packByteP | IN pointer to the compressed byte-mapped color image data to be converted to greyscale. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
IMAGELIB_EXPORT void mdlImage_paletteToGreyScale | ( | byte * | greyPaletteP, |
int * | minGreyP, | ||
int * | maxGreyP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize | ||
) |
Computes a greyscale palette from a color palette using the formula:
greyPaletteP | OUT pointer to an array of greyscale values. |
minGreyP | OUT the minimum greyscale value. If the pointer is NULL, this value is not returned. |
maxGreyP | OUT the maximum greyscale value. If the pointer is NULL, this value is not returned. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
IMAGELIB_EXPORT int mdlImage_readFileInfo | ( | Point2d * | imageSizeP, |
DgnPlatform::ImageColorMode * | colorModeP, | ||
int * | orientationP, | ||
WCharCP | fileName, | ||
DgnPlatform::ImageFileFormat | fileType | ||
) |
Returns information about the image file specified by fileName and fileType.
imageSizeP | OUT size of the image in X and Y pixels. If the pointer is NULL, this value is not returned. |
colorModeP | OUT color mode of the image (from image.h). If the pointer is NULL, this value is not returned. |
orientationP | OUT orientation of the image (from image.h). If the pointer is NULL, this value is not returned. |
fileName | IN file name to examine. |
fileType | IN type of the file (from image.h), or -1 to use the file name extension to determine the disk format. |
IMAGELIB_EXPORT int mdlImage_readFileToBitMap | ( | byte ** | imageBitMap, |
Point2d * | imageSize, | ||
WCharCP | fileName, | ||
DgnPlatform::ImageFileFormat | fileType, | ||
bool | runLengthEncode | ||
) |
Reads a bitmapped image file into an image buffer and optionally run length encodes the bitmap.
imageBitMap | OUT address of a pointer to a memory buffer that is allocated by this function to hold the bitmap. When the memory buffer is no longer required it should be freed by the caller by passing the buffer pointer to ~mmdlImage_freeImage, together with the size and format of the image data. The pointer should not be freed directly. | |||||||||
imageSize | OUT returned with the size of the image in X and Y pixels. | |||||||||
fileName | IN full path name of the file to be read. | |||||||||
fileType | IN one of the possible IMAGEFILE types contained in image.h, or - 1for automatic detection of file type by using the file name extension or header information in the file itself. | |||||||||
runLengthEncode | IN indicates whether or not compression is to occur. Compression will generally save lots of memory, but will require slightly large amount of processing time. The following possible data formats are returned depending on the value of runLengthEncode:
|
IMAGELIB_EXPORT int mdlImage_readFileToMap | ( | byte ** | imageMapPP, |
Point2d * | imageSizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int * | paletteSizeP, | ||
WCharCP | fileName, | ||
DgnPlatform::ImageFileFormat | fileType | ||
) |
Reads the mapped image file specified by fileName and fileType.
The image file must contain a mapped image with no more than 256 color palette entries. The image map is allocated and the address is returned in imageMapPP. This image map memory should be free by the calling routine when it is no longer required by using ~mmdlImage_freeImage. The size of the image is returned in imageSizeP.
imageMapPP | OUT memory to receive the pixels. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
imageSizeP | OUT size of the image in X and Y pixels. |
redMapP | OUT red palette entries. Buffer should be 256 bytes to accept the largest supported color palette. |
grnMapP | OUT green palette entries. Buffer should be 256 bytes to accept the largest supported color palette. |
bluMapP | OUT blue palette entries. Buffer should be 256 bytes to accept the largest supported color palette. |
paletteSizeP | OUT returned with the number of color palette entries. |
fileName | IN input file name. |
fileType | IN type of file (from image.h), or -1 to use the file name extension to determine the disk format. |
IMAGELIB_EXPORT int mdlImage_readFileToRGB | ( | byte ** | imageBufferPP, |
Point2d * | imageSizeP, | ||
WCharCP | name, | ||
DgnPlatform::ImageFileFormat | fileType, | ||
Point2d * | requestedSizeP | ||
) |
Reads the image file specified by filename and fileType and returns an RGB image.
The image file can be either mapped or unmapped. The image buffer is allocated and the address is returned in imageBufferPP. This image memory should be freed by the calling routine when it is no longer required by using ~mmdlImage_freeImage. The size of the image is returned in imageSizeP. If NULL is specified for requestedSizeP, imageSizeP is set to the size of the file image, otherwise imageSizeP is set to requestedSizeP.
imageBufferPP | OUT memory to receive the RGB pixels. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
imageSizeP | OUT size of the image in X and Y pixels. |
name | IN image file name. |
fileType | IN type of file (from image.h), or -1 to use the file name extension to determine the disk format. |
requestedSizeP | IN target size for the image, or NULL for unmodified size. |
void mdlImage_remapToScreenPalette | ( | byte * | outP, |
byte * | inP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
int | screenNumber | ||
) |
Remaps a palettized image to the nearest colors in a screen's palette.
This function matches the user-supplied palette entries to the screen's palette, then converts each palette index in the source image data to the corresponding index in the destination image data.
[out] | outP | buffer that receives remapped image data. Both inP and outP can point to the same buffer. |
[in] | inP | buffer that contains the source image data which is remapped to the screen palette. |
[in] | sizeP | pointer to size of the image buffers in X and Y pixels. Both inP and outP must be a minimum of sizeP->x * sizeP->y bytes. |
[in] | redMapP | the red color palette for the image source. |
[in] | grnMapP | the green color palette for the image source. |
[in] | bluMapP | the blue color palette for the image source. |
[in] | paletteSize | the number of palette entries. |
[in] | screenNumber | the screen number on which the image data is to be displayed. 0 for the main screen, 1 for the secondary screen. |
int mdlImage_renderViewToRGB | ( | byte ** | imageBufferPP, |
Point2d * | sizeP, | ||
int | renderMode, | ||
bool | stereo, | ||
bool | antiAlias, | ||
int | view | ||
) |
Renders the specified view and stores the image in the RGB buffer pointed to by imageBufferPP.
If *imageBufferPP is NULL, the memory for the image buffer is allocated and imageBufferPP points to the allocated memory; otherwise the memory pointed to by imageBufferPP is expected to be large enough to hold the output image.
[in,out] | imageBufferPP | memory to receive the RGB pixels, or pointer to NULL to have it allocated. |
[in] | sizeP | pointer to size of image to render (in X and Y pixels). |
[in] | renderMode | the rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h. |
[in] | stereo | True for stereo image. |
[in] | antiAlias | True to anti-alias. |
[in] | view | number of view to render. |
IMAGELIB_EXPORT int mdlImage_resize | ( | byte ** | outputImagePP, |
Point2d * | outputSizeP, | ||
byte * | inputImageP, | ||
Point2d * | inputSizeP | ||
) |
Compresses or expands the RGB buffer specified by inputImageP and inputSizeP to the size specified by outputSizeP.
The process of resizing the image uses pixel averaging and can require substantial processing time. The resizing algorithm produces expanded or compressed images of significantly higher quality than those produced using simple pixel replication or decimation techniques.
outputImagePP | OUT resized output image (RGB) |
outputSizeP | IN output size |
inputImageP | IN input image (RGB) |
inputSizeP | IN input size |
IMAGELIB_EXPORT Public int mdlImage_resizeBand | ( | byte ** | outputImagePP, |
Point2d * | outputSizeP, | ||
int | outRowStart, | ||
int | outRowStop, | ||
byte * | inputImageP, | ||
Point2d * | inputSizeP | ||
) |
Resizes a portion of the specified image to the given size.
After processing all bands, ~mmdlImage_resizeCleanup should be called to free the internal buffers allocated during the resizing process.
outputImagePP | OUT the buffer to receive the resized RGB image. |
outputSizeP | IN the dimensions of the resized image, in X and Y pixels. |
outRowStart | IN the first row of the image to include in the resized area. |
outRowStop | IN the last row of the image to include in the resized area. |
inputImageP | IN the original RBG image to be resized. |
inputSizeP | IN the size of the original image. |
IMAGELIB_EXPORT Public void mdlImage_resizeCleanup | ( | void | ) |
Clean up after resizing operations performed by calling ~mmdlImage_resizeBand.
IMAGELIB_EXPORT StatusInt mdlImage_RGBSeparateToBGR | ( | byte * | bgrInterlacedP, |
byte * | rgbSeparateP, | ||
Point2d * | imageSizeP, | ||
DgnPlatform::ImageColorMode | colorMode | ||
) |
Converts the specified image from RBG separate to BGR interlaced format.
bgrInterlacedP | OUT the buffer to receive the image in BGRBGRBGR or BGRABGRABGRA format. |
rgbSeparateP | IN the RRRGGGBBB format image data. |
imageSizeP | IN the size of the image. |
colorMode | IN either ImageColorMode::RGB or ImageColorMode::RGBA. |
IMAGELIB_EXPORT StatusInt mdlImage_RGBSeparateToRGB | ( | byte * | rgbInterlacedP, |
byte * | rgbSeparateP, | ||
Point2d * | imageSizeP, | ||
DgnPlatform::ImageColorMode | colorMode | ||
) |
Converts the specified image from RBG separate to RGB interlaced format.
rgbInterlacedP | OUT the buffer to receive the image in RGBRGBRGB or RGBARGBARGBA format. |
rgbSeparateP | IN the RRRGGGBBB format image data. |
imageSizeP | IN the size of the image. |
colorMode | IN either ImageColorMode::RGB or ImageColorMode::RGBA. |
IMAGELIB_EXPORT int mdlImage_rgbToBitMap | ( | byte * | bitMapP, |
byte * | rgbP, | ||
Point2d * | sizeP, | ||
int | ditherMode | ||
) |
Converts an RGB image to an uncompressed bitmap by dithering the color image.
bitMapP | OUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer. The format of this buffer is IMAGEFORMAT_BitMap. |
rgbP | IN pointer to the RGB buffer to be converted to monochrome. The format of this buffer is IMAGEFORMAT_RGBSeparate. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
ditherMode | IN either DITHERMODE_Pattern to apply a Bayer dither or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm. |
IMAGELIB_EXPORT int mdlImage_rgbToGreyScale | ( | byte * | greyP, |
int * | minGreyP, | ||
int * | maxGreyP, | ||
byte * | rgbP, | ||
Point2d * | sizeP | ||
) |
Converts an RGB image to a byte-per-pixel greyscale image based on the formula:
greyP | OUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer. |
minGreyP | OUT the minimum greyscale value. If the pointer is NULL, this value is not returned. |
maxGreyP | OUT the maximum greyscale value. If the pointer is NULL, this value is not returned. |
rgbP | IN pointer to the RGB color image data to be converted to greyscale. The RGB data is in IMAGEFORMAT_RGBSeparate format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
IMAGELIB_EXPORT int mdlImage_RGBToMap | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize | ||
) |
Converts an RGB image to a mapped image.
imageMapPP | OUT pointer to converted image map, allocated by conversion function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
rgbBufferP | IN RGB image buffer to be converted. |
sizeP | IN pointer to image size in X and Y pixels. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
paletteSize | IN number of palette entries. |
IMAGELIB_EXPORT int mdlImage_RGBToMapWithGamma | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
double | gamma | ||
) |
Converts an RGB image to a mapped image, applying gamma correction to each pixel as it is converted.
imageMapPP | OUT pointer to converted image map, allocated by conversion function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
rgbBufferP | IN RGB image buffer to be converted. |
sizeP | IN pointer to image size in X and Y pixels. |
redMapP | IN red palette entries. |
grnMapP | IN green palette entries. |
bluMapP | IN blue palette entries. |
paletteSize | IN number of palette entries. |
gamma | IN gamma correction value. |
IMAGELIB_EXPORT int mdlImage_RGBToPackByte | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize | ||
) |
Converts an RGB image to a packbyte compressed byte-mapped image.
This function is similar to ~mmdlImage_RGBToMap, which converts from RGB to an uncompressed byte-mapped image.
imageMapPP | OUT address of an image buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
rgbBufferP | IN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
IMAGELIB_EXPORT int mdlImage_RGBToPackByteWithGamma | ( | byte ** | imageMapPP, |
byte * | rgbBufferP, | ||
Point2d * | sizeP, | ||
byte * | redMapP, | ||
byte * | grnMapP, | ||
byte * | bluMapP, | ||
int | paletteSize, | ||
double | gamma | ||
) |
Converts an RGB image to a packbyte compressed byte-mapped image and applies the supplied gamma value.
imageMapPP | OUT address of an image buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
rgbBufferP | IN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
redMapP | IN pointer to the red color palette entry. |
grnMapP | IN pointer to the green color palette entry. |
bluMapP | IN pointer to the blue color palette entry. |
paletteSize | IN the number of palette entries. |
gamma | IN gamma correction value that is applied to the RGB image prior to conversion. |
IMAGELIB_EXPORT StatusInt mdlImage_RGBToRGBSeparate | ( | byte * | rgbSeparateP, |
byte * | rgbInterlacedP, | ||
Point2d * | imageSizeP, | ||
DgnPlatform::ImageColorMode | colorMode | ||
) |
Converts the specified image from RBG interlaced to RGB separated format.
rgbSeparateP | OUT buffer to receive the RRRGGGBBB format image data. |
rgbInterlacedP | IN image in RGBRGBRGB or RGBARGBARGBA format. |
imageSizeP | IN size of the image. |
colorMode | IN either ImageColorMode::RGB or ImageColorMode::RGBA. |
Converts an RGB image to a mapped image, applying gamma correction to each pixel as it is converted, and dithered to the palette for the graphics device indicated by screen.
The mapped image is then suitable for display by mdlWindow_rasterDataDraw.
[out] | mapPP | pointer to converted image map, allocated by conversion function. |
[in] | rgbBufferP | RGB image buffer to be converted. |
[in] | sizeP | image size in X and Y pixels. |
[in] | screen | screen number. |
IMAGELIB_EXPORT int mdlImage_rotate | ( | byte ** | outBufferPP, |
Point2d * | outSizeP, | ||
byte * | inpBufferP, | ||
Point2d * | imageSizeP, | ||
int | imageFormat, | ||
int | rotation | ||
) |
Rotates the image about the origin in a counter clockwise direction by a specified number of degrees.
outBufferPP | OUT address of a pointer to the image buffer allocated by mdlImage_rotate. If outBufferPP points to inpBufferP and the rotation is successful, inpBufferP is freed, and the pointer returned in outBufferPP replaces the original image buffer. |
outSizeP | OUT size of the output image in X and Y pixels. |
inpBufferP | IN input image buffer. |
imageSizeP | IN size of the input image buffer in X and Y pixels. |
imageFormat | IN one the IMAGEFORMAT types defined in image.h. |
rotation | IN 90, 180 or 270 degrees. |
IMAGELIB_EXPORT void mdlImage_runLengthDecodeBitMapRow | ( | byte * | outP, |
UShort * | inP, | ||
int | nPixels | ||
) |
Decodes a bitmap row from an array of UShort integers into a row in format IMAGEFORMAT_BitMap.
outP | OUT pointer to the bitmap buffer. It should be BITMAP_ROWBYTES (nPixels) in length. |
inP | IN pointer to the first of an array of UShort integers that represent the compressed bitmap. The first UShort is the number of 0-bits, next the number of 1-bits, and so on. |
nPixels | IN number of pixels to decode. The number of pixels can be less that the total in the row. |
IMAGELIB_EXPORT int mdlImage_runLengthEncodeBitMap | ( | UShort *** | rlePPP, |
byte * | bitmapP, | ||
Point2d * | sizeP | ||
) |
Converts a bitmap in format IMAGEFORMAT_BitMap to its run-length-encoded format IMAGEFORMAT_RLEBitMap.
This buffer should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage.
rlePPP | OUT address of a pointer to a RLE bitmap buffer allocated by this function. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
bitmapP | IN source bitmap in IMAGEFORMAT_BitMap format. |
sizeP | IN size of the image in X and Y pixels. |
IMAGELIB_EXPORT void mdlImage_runLengthEncodeBitMapRow | ( | UShort * | outP, |
int * | compressedSizeP, | ||
byte * | inP, | ||
int | nPixels | ||
) |
Encodes a bitmap row in format IMAGEFORMAT_BitMap into any array of UShort integers.
Encoding starts with the number of continuous 0-bits, then alternates from 1-bits to 0-bits and back.
outP | OUT pointer to a buffer that receives the compressed bitmap. |
compressedSizeP | OUT pointer to the length of the output buffer in bytes. Normally, this length is used to allocate memory to hold the compressed image. |
inP | IN pointer to the bitmap image buffer that is compressed. |
nPixels | IN number of pixels to encode. |
int mdlImage_saveView | ( | WCharCP | fileNameP, |
Point2d * | sizeP, | ||
int | renderMode, | ||
DgnPlatform::ImageFileFormat | format, | ||
bool | stereo, | ||
bool | antiAlias, | ||
int | view | ||
) |
Renders an RGB image of a view to disk.
[in] | fileNameP | name of image file to create. |
[in] | sizeP | pointer to size of image to render (in X and Y pixels). |
[in] | renderMode | the rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h. |
[in] | format | image format of output file, defined in image.h. |
[in] | stereo | if non-zero, the view is rendered in stereo mode. |
[in] | antiAlias | if non-zero, the view is antialiased. |
[in] | view | number of view to save. |
int mdlImage_saveViewToRGB | ( | byte ** | imageBufferPP, |
Point2d * | sizeP, | ||
int | renderMode, | ||
bool | stereo, | ||
bool | antiAlias, | ||
int | view | ||
) |
Renders the specified view and stores the image in the RGB buffer pointed to by imageBufferPP.
If *imageBufferPP is NULL, the memory for the image buffer is allocated and the address of the allocated memory is returned in imageBufferPP; otherwise the memory pointed to by imageBufferPP is expected to be large enough to hold the output image.
[in,out] | imageBufferPP | memory to receive the RGB pixels, or pointer to NULL to have it allocated. |
[in] | sizeP | pointer to size of image to render (in X and Y pixels). |
[in] | renderMode | the rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h. |
[in] | stereo | if non-zero, the view is rendered in stereo mode. |
[in] | antiAlias | if non-zero, the view is antialiased. |
[in] | view | number of view to save. |
IMAGELIB_EXPORT void mdlImage_setMapIfRGBMatch | ( | byte * | mapP, |
int | value, | ||
byte * | rgbP, | ||
Point2d * | sizeP, | ||
RgbColorDef * | matchP, | ||
bool | packBytes | ||
) |
Modifies a corresponding byte mapped image every time pixels in a corresponding RGB image match a specified value.
This function is useful where an RGB value identifies a transparent color, but the image is displayed on a palettized display. It allow all pixels that match a given RGB value in the RGB representation of the image to change the corresponding pixels in the byte mapped representation of the image.
mapP | IN OUT pointer to the mapped image. |
value | IN palette index that will be placed in the mapped image whenever a match occurs between the RGB image and matchP. |
rgbP | IN pointer to the RGB image in IMAGEFORMAT_RGBSeparate format. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
matchP | IN the RGB value to be matched in the RGB image. |
packBytes | IN if true, the mapped image is in IMAGEFORMAT_PackByte compressed with packbytes compression. If false, the mapped image is in IMAGEFORMAT_ByteMap uncompressed format. |
IMAGELIB_EXPORT int mdlImage_setMapPolygon | ( | byte * | dataP, |
bool * | dataModifiedP, | ||
Point2d * | sizeP, | ||
int | imageFormat, | ||
DPoint2d * | pointP, | ||
int | nPoints, | ||
bool | outside, | ||
int | value | ||
) |
Masks a polygonal area within an image.
It fills the interior or exterior of a polygon with a user specified value. It works with byte-mapped and bit-mapped images, in both compressed and uncompressed formats.
~mmdlImage_setRGBPolygon should be used for RGB formats.
dataP | IN OUT pointer to the image buffer. |
dataModifiedP | OUT set to true if the image is modified because the mask polygon falls somewhere within the image. |
sizeP | IN size of the image in X and Y pixels. |
imageFormat | IN IMAGEFORMAT type identified in image.h. RGB formats are not allowed. |
pointP | IN pointer to the first element of an array of nPoints points. This array defines a closed masking polygon in pixel coordinates. |
nPoints | IN number of elements in the array starting at pointP. |
outside | IN flag that identifies whether values inside or outside of the polygon are filled. If true, values outside the polygon are filled with value. If false, values inside the polygon are filled with value. |
value | IN the fill value. |
IMAGELIB_EXPORT int mdlImage_setRGBPolygon | ( | byte * | dataP, |
bool * | dataModifiedP, | ||
Point2d * | sizeP, | ||
DPoint2d * | pointP, | ||
int | nPoints, | ||
bool | outside, | ||
RgbColorDef * | colorP | ||
) |
Masks a polygonal area within an image.
It fills the interior or exterior of a polygon with a user specified color. It works with images in IMAGEFORMAT_RGBSeparate format.
~mmdlImage_setMapPolygon should be used for byte-mapped and bit-mapped images.
dataP | IN OUT pointer to the image buffer. |
dataModifiedP | OUT set to true if the image is modified because the mask polygon falls somewhere within the image. |
sizeP | IN size of the image in X and Y pixels. |
pointP | IN pointer to the first element of an array of nPoints points. This array defines a closed masking polygon in pixel coordinates. |
nPoints | IN number of elements in the array starting at pointP. |
outside | IN flag that identifies whether values inside or outside of the polygon are filled. If true, values outside the polygon are filled with value. If false, values inside the polygon are filled with value. |
colorP | IN pointer to an RGBColorRef structure with the red, green and blue values that will be used as the fill value. |
IMAGELIB_EXPORT int mdlImage_stretchRLEToBitMap | ( | byte ** | imagePP, |
Point2d * | sizeP | ||
) |
Replaces a run-length encoded (RLE) bitmap representation of an image with its corresponding bitmap representation.
It converts from format IMAGEFORMAT_RLEBitMap to IMAGEFORMAT_BitMap.
imagePP | IN OUT pointer to the image buffer. On entry, points to an array of pointers to UShort integers (Ushort**), which is the RLE representation. On exit it points to a bitmap buffer. |
sizeP | IN pointer to the size of the image in X and Y pixels. |
IMAGELIB_EXPORT int mdlImage_subByteMapFromBitMap | ( | byte * | outMapP, |
Point2d * | outSizeP, | ||
byte * | inBitMapP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
int | foreground, | ||
int | background, | ||
bool | rle | ||
) |
Converts a bitmapped image to a byte mapped image and stretches or decimates it to fit a user-defined output image size.
outMapP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inBitMapP | IN source image buffer in IMAGEFORMAT_BitMap or IMAGEFORMAT_RLEBitMap format, depending on the value of the rle flag. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
foreground | IN color index of the foreground color. All 1-bits in the source image will be mapped to this color index. |
background | IN color index of the background color. All 0-bits in the source image will be mapped to this color index. |
rle | IN flag that identifies if the source bitmap is compressed. If true, a compressed bitmap in format IMAGEFORMAT_RLEBitMap is expected; if false, an uncompressed bitmap in format IMAGEFORMAT_BitMap is expected. |
IMAGELIB_EXPORT int mdlImage_subByteMapFromPackByte | ( | byte * | outMapP, |
Point2d * | outSizeP, | ||
byte ** | inRowPP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
byte * | mapP | ||
) |
Converts a packbyte image to a byte mapped image and stretches or decimates it to fit a user-defined output image size.
outMapP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inRowPP | IN source image buffer in IMAGEFORMAT_PackByte format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
mapP | IN optional array of color indices used to remap the colors. mapP is a pointer to an array of 256 elements, or NULL if no color mapping is to occur. |
IMAGELIB_EXPORT int mdlImage_subByteMapFromRLEBitMap | ( | byte * | outMapP, |
Point2d * | outSizeP, | ||
UShort ** | inBitMapPP, | ||
Point2d * | inSizeP, | ||
BSIRect * | rectP, | ||
int | foreground, | ||
int | background | ||
) |
Converts a RLE bitmapped image to a byte mapped image and stretches or decimates it to fit a user-defined output image size.
outMapP | OUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is: |
outSizeP | IN output image size in X and Y pixels. |
inBitMapPP | IN source image buffer in IMAGEFORMAT_RLEBitMap format. |
inSizeP | IN size of the source image in X and Y pixels. |
rectP | IN rectangular subimage in X and Y pixels. The rectangle defined by rectP should be a subset of the rectangle with origin at (0,0) and corner at (inSizeP->x - 1, inSizeP->y - 1). If rectP is NULL, the subimage rectangle is the entire image. |
foreground | IN color index of the foreground color. All 1-bits in the source image will be mapped to this color index. |
background | IN color index of the background color. All 0-bits in the source image will be mapped to this color index. |
IMAGELIB_EXPORT void mdlImage_tintImage | ( | byte * | imageP, |
Point2d * | imageSizeP, | ||
RgbColorDef * | tintRGBP | ||
) |
Tints an RGB image in format IMAGEFORMAT_RGBSeparate by adjusting values as defined below.
imageP | OUT pointer to an image buffer in format IMAGEFORMAT_RGBSeparate. |
imageSizeP | IN size of the image in X and Y pixels. |
tintRGBP | IN RGB value that will be used to tint the image. |
IMAGELIB_EXPORT void mdlImage_tintPalette | ( | byte * | redP, |
byte * | grnP, | ||
byte * | bluP, | ||
int | paletteSize, | ||
RgbColorDef * | tintRGBP | ||
) |
Tints each entry of an image palette by adjusting values as defined below.
redP | IN OUT the red color palette for the source image. |
grnP | IN OUT the green color palette for the source image. |
bluP | IN OUT the blue color palette for the source image. |
paletteSize | IN the number of palette entries. |
tintRGBP | IN RGB value that will be used to tint the palette. |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat mdlImage_typeFromExtension | ( | WCharCP | fileName | ) |
Returns the file type of the specified image file.
fileName | IN image file name |
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat mdlImage_typeFromFile | ( | WCharCP | fileNameP | ) |
Attempts to determine the type of file from header information within the file itself.
If it can successfully validate the file type, it returns one of the supported IMAGEFILE formats defined in image.h.
fileNameP | IN full path name of the image file. |
IMAGELIB_EXPORT void mdlImage_unpackByteBuffer | ( | byte * | outP, |
byte * | inP, | ||
int | numDecode | ||
) |
Unpacks a buffer in packbyte format to a sequence of bytes.
It performs the inverse of ~mmdlImage_packByteBuffer.
outP | OUT buffer that holds the decoded byte-mapped data. The caller should allocate numDecode bytes for this buffer. |
inP | IN pointer to the source compressed packbyte byte-mapped data in format IMAGEFORMAT_PackByte. |
numDecode | IN the number of pixels to decode. |
IMAGELIB_EXPORT int mdlImage_warp | ( | byte ** | outPP, |
Point2d * | outSizeP, | ||
byte * | inP, | ||
Point2d * | inSizeP, | ||
int | imageFormat, | ||
TransformP | inverseTransformP, | ||
byte * | transparentP | ||
) |
Warps an image by using an inverse transform from each pixel of the output image to find the corresponding pixel in the source image.
If source point cannot be found, the output image is filled with a user-specified fill value. The buffer return should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage.
outPP | OUT pointer to the warped image buffer allocated by this function. It will have the same format as the source image. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage. |
outSizeP | IN size of the warped image in X and Y pixels. To warp the entire image, the size should be the maximum extents of the forward transform from the source to the destination image. |
inP | IN pointer to the source image buffer. |
inSizeP | IN size of the source image in X and Y pixels. |
imageFormat | IN any of the IMAGEFORMAT types defined in image.h, except IMAGEFORMAT_RGB or IMAGEFORMAT_RGBA. The only valid RGB format supported is IMAGEFORMAT_RGBSeparate. |
inverseTransformP | IN 2-D Transform from each pixel of the output image used to compute the corresponding pixel of the source image. |
transparentP | IN the fill value. If the image is a bitmap and transparentP points to a non-zero value, the fill value is 1; otherwise it is zero. If the image is mapped, transparentP points to a palette index. If the image is RGB, transparentP points to a 3-byte array of red, green and blue values. |
StatusInt mdlWindow_capture | ( | byte ** | imageDataPP, |
Point2dP | imageSizeP, | ||
MSWindowP | windowP, | ||
int | imageFormat, | ||
BSIRectCP | rectP | ||
) |
Captures the image of the specified window or sub area of the window.
[out] | imageDataPP | the image data allocated by this function. |
[out] | imageSizeP | the size (in X and Y pixels) of the image data returned. |
[in] | windowP | the window to capture. |
[in] | imageFormat | the format of the image, either IMAGEFORMAT_ByteMap or IMAGEFORMAT_RGB (from image.h). |
[in] | rectP | the subimage rectangle or NULL for the entire window. |
int mdlWindow_transparentRasterDataDraw | ( | MSWindow * | windowP, |
BSIRect * | rectP, | ||
byte * | inP, | ||
int | srcPitch, | ||
int | monoChrome, | ||
int | foreground, | ||
int | background, | ||
BSIRect * | clipRectP, | ||
int | transparent | ||
) |
Draws a block of raster data to the window identified by windowP, and overwrites the window's background only when the raster data does not match the specified transparent color.
[in] | windowP | the window on which to draw the image data. |
[in] | rectP | the output rectangle to be drawn, specified in window coordinates. |
[in] | inP | source image data buffer, stored as a single byte per pixel. The value of each byte is index into the palette for the screen on which windowP is written. |
[in] | srcPitch | the width of each input row. If the width of each source row is greater than the width to be displayed as specified in rectP, then the row width is specified in srcPitch. If srcPitch is zero, the width is computed from rectP. srcPitch should be zero, or greater than or equal to the width identified by rectP. |
[in] | monoChrome | true if data is monochrome (currently unused). |
[in] | foreground | foreground color for monochrome (currently unused). |
[in] | background | background color for monochrome (currently unused). |
[in] | clipRectP | clipping rectangle in window coordinates. If clipRectP is NULL, the window's content rectangle is used. |
[in] | transparent | the hardware draw index used to specify the transparent color. This value is normally obtained from mdlColorDescr_setDrawIndex. Values in the source data that match the least significant byte of transparent will be skipped when image data is drawn to the window. |
int mdlWindow_transparentRgbDataDraw | ( | MSWindow * | windowP, |
BSIRect * | rectP, | ||
int | srcPitch, | ||
byte * | rgbBufferP, | ||
int | format, | ||
BSIRect * | clipRectP, | ||
RgbColorDef * | transparentRgbP | ||
) |
Draws a block of RGB data to the window identified by windowP, and overwrites the window's background only when the RGB data does not match the specified transparent color.
[in] | windowP | the window on which to draw the image data. | |||||||||||||||
[in] | rectP | the output rectangle to be drawn, specified in window coordinates. | |||||||||||||||
[in] | srcPitch | the width of each input row. If the width of each source row is greater than the width to be displayed as specified in rectP, then the row width is specified in srcPitch. If srcPitch is zero, the width is computed from rectP. srcPitch should be zero, or greater than or equal to the width identified by rectP. | |||||||||||||||
[in] | rgbBufferP | that source image data buffer, which contains a the red, green and blue color intensities for each pixel. | |||||||||||||||
[in] | format | the format of the RGB buffer. The possible values and meanings are as follow:
| |||||||||||||||
[in] | clipRectP | clipping rectangle in window coordinates. If clipRectP is NULL, the window's content rectangle is used. | |||||||||||||||
[in] | transparentRgbP | the RGB value used to specify the transparent color. RGB values in the source data that match this color will be skipped when image data is drawn to the window. |