Functions
Image Functions

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...
 
MSDisplayDescrmdlImage_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...
 

Detailed Description

Function Documentation

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.

Parameters
[out]windowPpoints 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]x0the X-coordinate of the first pixel (or column) in the dithered row.
[in]x1the X-coordinate of the last pixel in the dithered row.
[in]ythe Y-coordinate of all pixels in the dithered row.
[in]redsPan array of red color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array.
[in]greensPan array of green color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array.
[in]bluesPan array of blue color components corresponding to each pixel in the row. There are (x1 - x0 + 1) elements in each array.
See also
mdlImage_ditherInitialize mdlImage_ditherRow mdlImage_ditherCleanup
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.

Parameters
rgbOutPOUT output image buffer (may be the same as rgbInP).
rgbInPIN input image buffer.
sizePIN pointer to image size in X and Y pixels.
gammaIN gamma value to be applied to image (1.0 means no correction).
See also
usmthmdlImage_RGBToMapWithGammaC
IMAGELIB_EXPORT void mdlImage_applyGammaToPalette ( byte redMapP,
byte greenMapP,
byte blueMapP,
int  paletteSize,
double  gamma 
)

Applies gamma correction to an existing palette.

Parameters
redMapPIN OUT red palette entries.
greenMapPIN OUT green palette entries.
blueMapPIN OUT blue palette entries.
paletteSizeIN number of palette entries.
gammaIN gamma value to be applied to palette (1.0 means no correction).
See also
usmthmdlImage_getOptimizedPaletteC usmthmdlImage_getBalancedPaletteC
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.

Parameters
bitMapPOUT 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.
byteMapPIN pointer to the uncompressed byte-mapped buffer to be converted to monochrome. The format of the buffer is IMAGEFORMAT_ByteMap.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
sizePIN pointer to the size of the image in X and Y pixels.
ditherModeIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid DITHERMODE is detected.
See also
usmthmdlImage_packByteToBitMapC usmthmdlImage_greyScaleToBitMapC usmthmdlImage_rgbToBitMapC
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:

grey = 0.30 * red + 0.59 * green + 0.11 * blue
Parameters
greyPOUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer.
minGreyPOUT the minimum greyscale value. If the pointer is NULL, this value is not returned.
maxGreyPOUT the maximum greyscale value. If the pointer is NULL, this value is not returned.
byteMapPIN pointer to the byte-mapped color image data to be converted to greyscale.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
sizePIN pointer to the size of the image in X and Y pixels.
Returns
SUCCESS when operation is complete.
See also
usmthmdlImage_paletteToGreyScaleC usmthmdlImage_packByteToGreyScaleC usmthmdlImage_rgbToGreyScaleC
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.

Parameters
[out]imagePPpointer to the allocated image data buffer. When the user no longer needs this buffer, this memory should be freed.
[in]rectanglePpointer to a rectangular portion of the screen to be captured (in screen coordinates).
[in]screenNumnumber of physical screen to capture.
[in]imageFormateither IMAGEFORMAT_RGB or IMAGEFORMAT_ByteMap. Use mdlImage_getScreenPalette to determine the RGB colors for a byte-mapped image.
Returns
SUCCESS if image is successfully captured.
MDLERR_BADARG if an invalid image format is specified.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_captureScreenMap
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.

The image map is allocated and the base address returned in imageMapPP.

Remarks
The image map memory should be freed by the calling program when it is no longer required.
mdlImage_getScreenPalette should be used to get the associated color palette.
Parameters
[out]imageMapPPpointer to the allocated image data buffer. When the user no longer needs this buffer, this memory should be freed.
[in]rectanglePpointer to a rectangular portion of the screen to be captured (in screen coordinates).
[in]screenNumnumber of physical screen to capture.
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_computeScreenMap mdlImage_getScreenPalette
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.

Remarks
Many of the mdlImage_ functions allow a programmer to specify a custom stop function, or none at all. mdlImage_checkStop is a function that can be specified for the stopFunc parameter in any function that accepts it. It calls the built-in function mdlSystem_abortRequested and returns MDLIMAGE_PROCESSABORTED if the user presses <Ctrl-C>. A "spinning" character is displayed in the error field to give the user visual confirmation that processing is continuing. If mdlImage_checkStop is used, mdlSystem_userAbortEnable(false) must be called first so that the MDL application itself is not aborted completely, mdlSystem_userAbortEnable(true) should be called subsequently to re-enable the user abort functionality.
Returns
MDLIMAGE_PROCESSABORTED if the user has requested an abort, otherwise zero.
See also
mdlSystem_userAbortEnable
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.

Parameters
[out]screenMaparray 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]screenNumberthe screen number on which the image data is to be displayed; 0 for the main screen, 1 for the secondary screen.
[in]redMapPred color palatte for the image.
[in]grnMapPgreen color palatte for the image.
[in]bluMapPblue color palette for the image.
[in]paletteSizethe number of palette entries. Only paletteSize entries of screenMap are filled.
Returns
SUCCESS when operation is complete.
See also
mdlImage_getScreenPalette mdlImage_remapToScreenPalette
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.

Parameters
dstDataPOUT pointer to the buffer to receive the greyscale image.
redMapPIN OUT red palette entries (changed to greyscale if srcP == dstP).
grnMapPIN OUT green palette entries (changed to greyscale if srcP == dstP).
bluMapPIN OUT blue palette entries (changed to greyscale if srcP == dstP).
paletteSizePIN OUT number of palette entries (changed to 256 if srcP == dstP).
srcDataPIN the source image to be converted to greyscale.
imageSizePIN the size of the input image.
imageFormatIN the format of the source image (and destination) data.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_NOTAVAILABLE if the image format is not valid for the operation.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
imagePPIN 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.
sizePIN pointer to the size of the image in X and Y pixels.
ingrOrientationIN orientation of the original image; an INGR_ORIENT_... constant in image.h.
imageFormatIN format of the original image; an IMAGEFORMAT_... defined constant in image.h.
Remarks
This function is normally used with Intergraph files which allow 8 possible image orientations, but it can be used with any other type of image as well.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_transformToUpperLeftHorizontalC
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.

Parameters
namePIN full path name of the file to be written.
typeIN 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.
sizePIN size of the bitmap in X and Y pixels.
bitMapPIN pointer to the bitmap image data. Data must be in either IMAGEFORMAT_BitMap or IMAGEFORMAT_RLEBitMap formats.
runLengthEncodeIN indicates whether the data has been compressed or not. The following data formats are assumed depending on the value of runLengthEncode:
runLengthEncode Image Format Type Description
true IMAGEFORMAT_RLEBitMap Run length encoded (generally most compressed)
false IMAGEFORMAT_BitMap Bits per pixel (generally least compressed)
foregroundColorPIN RGB value for the foreground color. This value is used only if type is not one of the monochrome types listed above.
backgroundColorPIN RGB value for the background color. This value is used only if type is not one of the monochrome types listed above.
Returns
SUCCESS if the file is created successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromMapC usmthmdlImage_createFileFromRGBC
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.

Parameters
saveAsFileNamePIN full path name of the file to be created by this function.
fileTypeIN 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.
colorModeIN one of the COLORMODE_ constants in image.h identifying the color mode of the source buffer.
sizePIN source image size in X and Y pixels.
imageDataPIN pointer to the source data in one of the indicated formats.
imageFormatIN one of the IMAGEFORMAT_ constants in image.h identifying the memory storage format.
param1PIN a pointer that has several uses depending on the imageFormat. (see below)
param2PIN a pointer that has several uses depending on the imageFormat. (see below)
param3PIN a pointer that has several uses depending on the imageFormat. (see below)
paletteSizeIN the number of palette entries if the image format is IMAGEFORMAT_ByteMap, IMAGEFORMAT_GreyScale or IMAGEFORMAT_PackByte.
compressTypeIN compression ratio for JPEG images. Otherwise, it is not used.
compressRatioIN the ratio of compression to use in creating the file (from image.h)
Remarks
Depending on the value of fileType, the following sub-functions are called:
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
Depending on the value of fileType, param1P has the following use:
imageFormat Value param1P usage
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap RgbColorDef *foregroundColorP
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte byte *redMapP
Other unused
Depending on the value of fileType, param2P has the following use:
imageFormat Value param2P usage
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap RgbColorDef *backgroundColorP
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte byte *grnMapP
Other unused
Depending on the value of fileType, param3P has the following use:
imageFormat Value param3P usage
IMAGEFORMAT_BitMap IMAGEFORMAT_RLEBitMap unused
IMAGEFORMAT_ByteMap IMAGEFORMAT_GreyScale IMAGEFORMAT_PackByte byte *bluMapP
Other unused
Returns
SUCCESS if the file is created successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromBitMapC usmthmdlImage_extCreateFileFromMapC usmthmdlImage_extCreateFileFromRGBC
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.

Parameters
nameIN name of file.
typeIN type of file (from image.h).
colorModeIN color mode (from image.h).
sizePIN pointer to size of image in X and Y pixels.
imageMapPIN address of the image map with a single-byte color palette index for each of the (sizeP->x * sizeP->y) pixels.
redPalettePIN red palette values.
grnPalettePIN green palette values.
bluPalettePIN blue palette values.
paletteSizeIN specifies number of color palette entries.
Returns
SUCCESS if the file is created successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromRGB usmthmdlImage_createFileFromBitMapC usmthmdlImage_createFileFromBufferC
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.

Parameters
nameIN name of file.
typeIN type of file (from image.h).
colorModeIN color mode (from image.h).
sizePIN pointer to size of image in X and Y pixels.
imageBufferPIN 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).
Returns
SUCCESS if the file is created successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromMapC usmthmdlImage_createFileFromBufferC usmthmdlImage_createFileFromBitMapC
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.

Parameters
fileNamePIN the name of the file to create.
fileTypeIN the type of the file (from image.h)
imageSizePIN the size of the image in X and Y pixels.
imageDataPIN the image data for each pixel.
imageFormatIN the format of the image data.
redMapPIN red palette entries (or NULL).
grnMapPIN green palette entries (or NULL).
bluMapPIN blue palette entries (or NULL).
paletteSizeIN the number of palette entries.
compressTypeIN the type of compression to apply (from image.h)
compressRatioIN the ratio of compression to use in creating the file (from image.h)
Returns
SUCCESS if the operation is completed successfully.
MDLERR_NOTAVAILABLE if the image format is not valid for the operation.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
saveAsFileNamePIN the name of the raster file to be created.
fileTypeIN the type of the file to be created (IMAGEFILE types in image.h).
colorModeIN the color model to use (COLORMODE in image.h).
compressTypeIN the compression type to use (COMPRESSTYPE in image.h).
compressRatioIN the ratio of compression to use in creating the file (from image.h)
imageSizePIN the size of the image (in X and Y pixels).
imageDataPIN the image data for each pixel.
imageFormatIN the image buffer format (IMAGEFORMAT in image.h).
param1PIN a pointer that has several uses depending on the imageFormat. (see below)
param2PIN a pointer that has several uses depending on the imageFormat. (see below)
param3PIN a pointer that has several uses depending on the imageFormat. (see below)
paletteSizeIN the number of palette entries.
Remarks
Depending on the value of fileType, the following sub-functions are called:
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
Depending on the value of fileType, param1P has the following use:
imageFormat Value param1P usage
IMAGEFORMAT_BitMap
IMAGEFORMAT_RLEBitMap
RgbColorDef *foregroundColorP
IMAGEFORMAT_ByteMap
IMAGEFORMAT_GreyScale
IMAGEFORMAT_PackByte
byte *redMapP
Other unused
Depending on the value of fileType, param2P has the following use:
imageFormat Value param2P usage
IMAGEFORMAT_BitMap
IMAGEFORMAT_RLEBitMap
RgbColorDef *backgroundColorP
IMAGEFORMAT_ByteMap
IMAGEFORMAT_GreyScale
IMAGEFORMAT_PackByte
byte *grnMapP
Other unused
Depending on the value of fileType, param3P has the following use:
imageFormat Value param3P usage
IMAGEFORMAT_BitMap
IMAGEFORMAT_RLEBitMap
unused
IMAGEFORMAT_ByteMap
IMAGEFORMAT_GreyScale
IMAGEFORMAT_PackByte
byte *bluMapP
Other unused
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromBitMapC usmthmdlImage_extCreateFileFromMapC usmthmdlImage_extCreateFileFromRGBC
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.

Parameters
[out]edPPset to point to the raster element descriptor.
[in]imageBufferPRGB image buffer.
[in]imageSizePimage size (in X and Y pixels).
[in]originPspecifies the upper left corner of the raster element in the design file.
[in]scalespecifies the ratio of design file coordinates in the current coordinate system to pixels.
[in]levelspecifies the level of the raster element.
[in]useCurrentPaletteIf 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]transparentBackgroundIf non-zero, the background (black) pixels are transparent.
Remarks
This function is used by the plaimage example to implement the Place Image tool.
Returns
SUCCESS if the raster element is successfully created.
If processing is aborted by a non-zero return value from stopfunc, this value is returned.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Remarks
This function is similar to mdlWindow_displayDescrGet, except that during image processing, it is sometimes useful to obtain information about the display attributes without necessarily having an associated window.
Parameters
[in]screenthe screen number on which the image data is to be displayed; 0 for the main screen, 1 for the secondary screen.
Returns
pointer to the display descriptor for the selected screen.
See also
mdlWindow_displayDescrGet
IMAGELIB_EXPORT void mdlImage_ditherCleanup ( void  )

Frees the internal buffers allocated during the dithering process.

Remarks
The mdlImage_dither... functions convert unmapped RGB pixel data into color palette indices for a user-specified color palette. A Floyd-Steinberg filter is used to diffuse pixel error in both directions. When used along with ~mmdlImage_getOptimizedPalette, the conversion from RGB to mapped images can be accomplished with minimal image degradation. This process is used internally when creating mapped files from RGB data using ~mmdlImage_createFileFromRGB or converting from RGB to mapped images with ~mmdlImage_RGBToMap.
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlDither_drawRowC usmthmdlImage_getOptimizedPaletteC usmthmdlImage_RGBToMapC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowWithOffsetC usmthmdlImage_ditherInitializeWithGammaC
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.

Remarks
The mdlImage_dither... functions convert unmapped RGB pixel data into color palette indices for a user-specified color palette. A Floyd-Steinberg filter is used to diffuse pixel error in both directions. When used along with ~mmdlImage_getOptimizedPalette, the conversion from RGB to mapped images can be accomplished with minimal image degradation. This process is used internally when creating mapped files from RGB data using ~mmdlImage_createFileFromRGB or converting from RGB to mapped images with ~mmdlImage_RGBToMap.
Parameters
nColorsIN number of palette entries.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
widthIN width of scanlines (in pixels).
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlDither_drawRowC usmthmdlImage_getOptimizedPaletteC usmthmdlImage_RGBToMapC usmthmdlImage_ditherCleanupC usmthmdlImage_ditherRowWithOffsetC usmthmdlImage_ditherInitializeWithGammaC
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.

Remarks
The mdlImage_dither... functions convert unmapped RGB pixel data into color palette indices for a user-specified color palette. A Floyd-Steinberg filter is used to diffuse pixel error in both directions. When used along with ~mmdlImage_getOptimizedPalette, the conversion from RGB to mapped images can be accomplished with minimal image degradation. This process is used internally when creating mapped files from RGB data using ~mmdlImage_createFileFromRGB or converting from RGB to mapped images with ~mmdlImage_RGBToMap.
Parameters
nColorsIN the number of palette entries.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
widthIN the width of scanlines.
gammaValueIN the gamma correction value to be applied to the dithered pixels.
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlDither_drawRowC usmthmdlImage_getOptimizedPaletteC usmthmdlImage_RGBToMapC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowWithOffsetC usmthmdlImage_ditherInitializeWithGammaC
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.

Remarks
The mdlImage_dither... functions convert unmapped RGB pixel data into color palette indices for a user-specified color palette. A Floyd-Steinberg filter is used to diffuse pixel error in both directions. When used along with ~mmdlImage_getOptimizedPalette, the conversion from RGB to mapped images can be accomplished with minimal image degradation. This process is used internally when creating mapped files from RGB data using ~mmdlImage_createFileFromRGB or converting from RGB to mapped images with ~mmdlImage_RGBToMap.
Parameters
outputLinePOUT pointer to row in the image map to receive color map indices for each pixel.
redPIN red values for each pixel.
grnPIN green values for each pixel.
bluPIN blue values for each pixel.
widthIN number of pixels in scanline.
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlDither_drawRowC usmthmdlImage_getOptimizedPaletteC usmthmdlImage_RGBToMapC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowWithOffsetC usmthmdlImage_ditherInitializeWithGammaC
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.

Remarks
The mdlImage_dither... functions convert unmapped RGB pixel data into color palette indices for a user-specified color palette. A Floyd-Steinberg filter is used to diffuse pixel error in both directions. When used along with ~mmdlImage_getOptimizedPalette, the conversion from RGB to mapped images can be accomplished with minimal image degradation. This process is used internally when creating mapped files from RGB data using ~mmdlImage_createFileFromRGB or converting from RGB to mapped images with ~mmdlImage_RGBToMap.
Parameters
outputLinePOUT pointer to row in the image map to receive color map indices for each pixel.
redPIN the red values for each pixel.
grnPIN the green values for each pixel.
bluPIN the blue values for each pixel.
widthIN the number of pixels in the scanline.
channelOffsetIN the number of bytes between channels.
Returns
-1 when operation is complete.
See also
usmthmdlDither_drawRowC usmthmdlImage_getOptimizedPaletteC usmthmdlImage_RGBToMapC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowWithOffsetC usmthmdlImage_ditherInitializeWithGammaC
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.

Parameters
outMapPOUT 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:
4 * sizeP->x * sizeP->y * bytesPerPixel
inMapPIN pointer to the source image, formatted as either IMAGEFORMAT_ByteMap or IMAGEFORMAT_RGB.
sizePIN pointer to the size of the image in X and Y pixels.
bytesPerPixelIN 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.
See also
usmthmdlVideo_readMovieC
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.

Parameters
nameIN name of file.
typeIN type of file (from image.h).
colorModeIN color mode (from image.h).
sizePIN pointer to size of image in X and Y pixels.
imageMapPIN address of the image map with a single-byte color palette index for each of the (sizeP->x * sizeP->y) pixels.
redPalettePIN red palette values.
grnPalettePIN green palette values.
bluPalettePIN blue palette values.
paletteSizeIN specifies number of color palette entries.
compressTypeIN the type of compression to use in creating the file (from image.h)
compressRatioIN the ratio of compression to use in creating the file (from image.h)
transparencyPIN the index of the transparency value, or the RGB triple to use for the transparency value.
Returns
SUCCESS if the file is created successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromRGB usmthmdlImage_createFileFromBitMapC usmthmdlImage_createFileFromBufferC
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.

Parameters
nameIN name of file.
typeIN type of file (from image.h).
colorModeIN color mode (from image.h).
sizePIN pointer to size of image in X and Y pixels.
imageBufferPIN 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).
compressTypeIN the type of compression to use in creating the file (from image.h)
compressRatioIN the ratio of compression to use in creating the file (from image.h)
transparencyPIN the index of the transparency value, or the RGB tripple to use for the transparency value.
Returns
SUCCESS if the file is created successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_createFileFromMapC usmthmdlImage_createFileFromBufferC usmthmdlImage_createFileFromBitMapC
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.

Parameters
nameIN name of file.
typeIN type of file (from image.h).
sizePIN pointer to size of image in X and Y pixels.
imageBufferPIN 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).
compressTypeIN the type of compression to use in creating the file (from image.h)
compressRatioIN the ratio of compression to use in creating the file (from image.h)
transparencyPIN the index of the transparency value, or the RGB tripple to use for the transparency value.
backgroundColorPIN background color used in monochrome mode. Must be set if the colorMode is Monochrome, can be NULL with all other colorMode.
Returns
SUCCESS if the file is created successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_extCreateFileFromRGB
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.

Parameters
rgbBufferPPOUT 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.
mapPIN address of the byte-mapped image data that is converted to RGB format.
sizePIN pointer to the size of the image in X and Y pixels.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
packBytesIN flag to indicate if bytes should be packed (run length encoded).
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_mapToRGBC usmthmdlImage_extRGBToMapC usmthmdlImage_freeImageC
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.

Parameters
outMapPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_BitMap and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_BitMap)
outSizePIN output image size in X and Y pixels.
inBitMapPIN source image buffer in IMAGEFORMAT_BitMap format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_extractSubImageC usmthmdlImage_extractByteMapSubImageC usmthmdlImage_extractPackByteSubImageC usmthmdlImage_extractRGBSubImageC usmthmdlImage_extractRLEBitMapSubImageC usmthmdlImage_memorySizeC
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.

Parameters
outMapPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_ByteMap)
outSizePIN output image size in X and Y pixels.
inMapPIN source image buffer in IMAGEFORMAT_ByteMap format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
mapPIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_extractSubImageC usmthmdlImage_extractPackByteSubImageC usmthmdlImage_extractBitMapSubImageC usmthmdlImage_extractRGBSubImageC usmthmdlImage_extractRLEBitMapSubImageC usmthmdlImage_memorySizeC
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.

Parameters
outRowPPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_PackByte and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_PackByte)
outSizePIN output image size in X and Y pixels.
inRowPPIN source image buffer in IMAGEFORMAT_PackByte format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
mapPIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_extractSubImageC usmthmdlImage_extractByteMapSubImageC usmthmdlImage_extractBitMapSubImageC usmthmdlImage_extractRGBSubImageC usmthmdlImage_extractRGBASubImageC usmthmdlImage_memorySizeC usmthmdlImage_extractRLEBitMapSubImageC
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.

Parameters
outPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_RGBA and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_RGBA)
outSizePIN output image size in X and Y pixels.
inPIN source image buffer in IMAGEFORMAT_RGBA format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
Returns
SUCCESS when operation is complete.
See also
usmthmdlImage_extractSubImageC usmthmdlImage_extractByteMapSubImageC usmthmdlImage_extractPackByteSubImageC usmthmdlImage_extractBitMapSubImageC usmthmdlImage_extractRLEBitMapSubImageC usmthmdlImage_memorySizeC usmthmdlImage_extractRGBSubImageC
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.

Parameters
outPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_RGBSeparate and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_RGBSeparate)
outSizePIN output image size in X and Y pixels.
inPIN source image buffer in IMAGEFORMAT_RGBSeparate format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
Returns
SUCCESS when operation is complete.
See also
usmthmdlImage_extractSubImageC usmthmdlImage_extractByteMapSubImageC usmthmdlImage_extractPackByteSubImageC usmthmdlImage_extractBitMapSubImageC usmthmdlImage_extractRLEBitMapSubImageC usmthmdlImage_memorySizeC usmthmdlImage_extractRGBASubImageC
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.

Parameters
outPOUT pointer to a buffer allocated by the caller. The format of this buffer is defined by imageFormat and the size of this buffer is:
mdlImage_memorySize (outSizeP, imageFormat)
outSizePIN output image size in X and Y pixels.
inPIN source image buffer.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
imageFormatIN IMAGEFORMAT type defined in image.h.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_extractByteMapSubImageC usmthmdlImage_extractPackByteSubImageC usmthmdlImage_extractRGBSubImageC usmthmdlImage_extractBitMapSubImageC usmthmdlImage_extractRLEBitMapSubImageC usmthmdlImage_memorySizeC
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.

Parameters
imageMapPPOUT 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.
imageSizePOUT returned with the size of the image in X and Y pixels.
redMapPOUT pointer to the red color palette entry.
grnMapPOUT pointer to the green color palette entry.
bluMapPOUT pointer to the blue color palette entry.
paletteSizePOUT the number of palette entries.
fileNamePIN full path name of the file to be read.
fileTypeIN 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.
packBytesIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADFILETYPE if file does not contain byte-map color data.
See also
usmthmdlImage_readFileToMapC usmthmdlImage_freeImageC
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.

Parameters
imageMapPPOUT 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.
rgbBufferPIN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format.
sizePIN pointer to the size of the image in X and Y pixels.
redMapPIN pointer to the red color palette entry
grnMapPIN pointer to the green color palette entry
bluMapPIN pointer to the blue color palette entry
paletteSizeIN the number of palette entries.
packBytesIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_RGBToMapC usmthmdlImage_RGBToPackByteC usmthmdlImage_mapToRGBC usmthmdlImage_extMapToRGBC usmthmdlImage_freeImageC
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.

Parameters
[out]imageMapPPaddress 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]rgbBufferPpointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format.
[in]sizePpointer to the size of the image in X and Y pixels.
[in]screenthe screen number on which the image data is to be displayed. Screen is 0 for the main screen, 1 for the secondary screen.
[in]packBytesflag 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.
Returns
SUCCESS if the operation is completed successfully.
If processing is aborted by a non-zero return value from stopFunc, this value is returned.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_RGBToScreenMap mdlImage_RGBToMap mdlImage_mapToRGB mdlWindow_rasterDataDraw mdlImage_freeImage
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat mdlImage_fileType ( DgnPlatform::ImageFileFormat  fileType,
WCharCP  fileNameP 
)

Determines the format of the specified image file.

Parameters
fileTypeIN 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.
fileNamePIN the name of the file to verify or determine type
Returns
IMAGEFILE_UNKNOWN if the file is not found or is invalid, otherwise file type of file (from image.h)
IMAGELIB_EXPORT void mdlImage_freeImage ( void *  imageP,
Point2d *  sizeP,
int  imageFormat 
)

Frees the memory buffer identified by imageP.

Parameters
imagePIN pointer to the image memory to be freed.
sizePIN 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.
imageFormatIN an IMAGEFORMAT type defined in image.h.
Remarks
Since some memory formats, such as run-length-encoded formats, allocate more than a single block of memory, the only safe way to free all memory associated with an image memory is to use this function.
In most situations, memory should be allocated by calling malloc, and freed using mdlImage_freeImage, as follows:
imageP = malloc (mdlImage_memorySize (sizeP, imageFormat));
.
.
.
mdlImage_freeImage (imageP, sizeP, imageFormat);
See also
usmthmdlImage_memorySizeC
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.

Parameters
redMapPOUT red values for balanced palette.
grnMapPOUT green values for balanced palette.
bluMapPOUT blue values for balanced palette.
numColorsPOUT number of colors in the palette.
See also
usmthmdlImage_readFileToRGBC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowC usmthmdlImage_ditherCleanupC usmthmdlImage_getOptimizedPaletteC
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.

Parameters
formatNameOUT image format name
importTypePOUT IMAGEFILE_ type for returned format, from image.h
indexIN index of export array to return
Returns
SUCCESS if index is supported. If ERROR is returned for an index, all higher indicies will also return ERROR.
Remarks
Below is an example of filling in the labels of a file type option button for an image output application.
Example:
WChar formatName[256];
int exportType, i = 0;
while (! mdlImage_getExportFormat (formatName, &exportType, i++))
{
mdlDialog_optionButtonInsertItem (formatName, NULL, NULL,NULL,
&importType, NULL, NULL, NULL,
dimP->dialogItemP->rawItemP, -1);
}
See also
usmthmdlImage_getExtensionC usmthmdlImage_getExportSupportC
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.

Parameters
defaultModePOUT default color mode.
rgbSupportPOUT support for 24 bit RGB.
palette256SupportPOUT support for 256 color palette.
palette16SupportPOUT support for 16 color palette.
greyScaleSupportPOUT support for grey scale.
monochromeSupportPOUT support for monochrome.
imageTypeIN image type (from image.h).
Returns
SUCCESS if the file type is supported; MDLERR_BADARG if it is not.
See also
usmthmdlImage_getExtensionC usmthmdlImage_typeFromExtensionC usmthmdlFile_setFileTypeC usmthmdlImage_getOSFileTypeC
IMAGELIB_EXPORT int mdlImage_getExtension ( WCharP  ext,
DgnPlatform::ImageFileFormat  type 
)

Returns the default three character file extension for the specified image format.

Parameters
extOUT default file extension (MAXEXTENSIONLENGTH characters).
typeIN image type (from image.h).
Returns
SUCCESS if the file type is found; MDLERR_BADARG if it is not.
See also
usmthmdlImage_getExportSupportC usmthmdlImage_getOSFileTypeC
IMAGELIB_EXPORT StatusInt mdlImage_getImageBgColor ( byte pixelP,
WCharCP  name 
)

Retrieves the background color information from the specified image file.

Parameters
pixelPOUT a 4 byte buffer that receives the background color.
nameIN name of the image file to get the background color from.
Returns
SUCCESS unless an error occurred.
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.

Parameters
formatNameOUT image format name
importTypePOUT IMAGEFILE_ type for returned format, from image.h
indexIN index of export array to return
Returns
SUCCESS if index is supported. If ERROR is returned for an index, all higher indicies will also return ERROR.
Remarks
Below is an example of filling in the labels of a file type option button for an image display application.
Example:
WChar formatName[256];
int importType, i = 0;
while (! mdlImage_getImportFormat (formatName, &importType, i++))
{
mdlDialog_optionButtonInsertItem (formatName, NULL, NULL,NULL,
&importType, NULL, NULL, NULL,
dimP->dialogItemP->rawItemP, -1);
}
See also
usmthmdlImage_getExtensionC usmthmdlImage_getExportSupportC
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.

Parameters
mapUsedOUT 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.
mapPIN pointer to the byte-mapped image data.
sizePIN pointer to the size of the image in X and Y pixels.
packBytesIN 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.
See also
usmthmdlImage_setMapIfRGBMatchC
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.

Parameters
redMapPOUT red values for optimized palette.
grnMapPOUT green values for optimized palette.
bluMapPOUT blue values for optimized palette.
paletteSizePOUT number of palette entries used.
maxColorsIN maximum colors in optimized palette.
imageBufferPIN 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.
sizePIN pointer to size of imageBuffer in X and Y pixels
Returns
SUCCESS if the palette is calculated successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_readFileToRGBC usmthmdlImage_ditherInitializeC usmthmdlImage_ditherRowC usmthmdlImage_ditherCleanupC usmthmdlImage_getBalancedPaletteC
IMAGELIB_EXPORT int mdlImage_getOSFileType ( UInt32 osFileTypeP,
DgnPlatform::ImageFileFormat  imageType 
)

Returns the operating system file type for the specified image type.

Remarks
The only operating system that currently supports file types is the Macintosh Finder.
Parameters
osFileTypePOUT O.S. file type.
imageTypeIN image type (from image.h)
Returns
SUCCESS if the file type is supported; MDLERR_BADARG if it is not.
See also
usmthmdlImage_getExtensionC usmthmdlImage_typeFromExtensionC usmthmdlFile_setFileTypeC usmthmdlImage_getExportSupportC
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.

Parameters
[out]redMapPred palette entries.
[out]grnMapPgreen palette entries.
[out]bluMapPblue palette entries.
[out]paletteSizePnumber of palette entries.
[in]screenNumscreen number.
Returns
SUCCESS if the process is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_computeScreenMap mdlImage_captureScreenMap
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.

Parameters
bitMapPOUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer.
greyPIN pointer to the greyscale source image buffer to be converted to monochrome.
sizePIN pointer to the size of the image in X and Y pixels.
minGreyIN the minimum greyscale value.
maxGreyIN the maximum greyscale value.
ditherModeIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_BADARG if an invalid DITHERMODE is detected.
See also
usmthmdlImage_byteMapToBitMapC usmthmdlImage_packByteToBitMapC usmthmdlImage_rgbToBitMapC
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.

Parameters
rgbBufferPPOUT 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.
mapPIN image map.
sizePIN pointer to size of the image in X and Y pixels.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
Returns
SUCCESS if the palette is calculated successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_RGBToMapC usmthmdlImage_RGBToMapWithGammaC usmthmdlImage_RGBToScreenMapC usmthmdlImage_applyGammaC usmthmdlImage_extMapToRGBC
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.

Parameters
rgbBufferPOUT image buffer (RGB). When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage.
mapPIN image map.
sizePIN pointer to size of the image in X and Y pixels.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
Returns
SUCCESS: if the palette is calculated successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_RGBToMapC usmthmdlImage_RGBToMapWithGammaC usmthmdlImage_RGBToScreenMapC usmthmdlImage_applyGammaC usmthmdlImage_extMapToRGBC
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.

Parameters
sizePIN pointer to the size of the image in X and Y pixels.
imageFormatIN any of the IMAGEFORMAT types defined in image.h.
Returns
if successful, the positive number of bytes required to hold the input image.
MDLERR_BADARG if an invalid image format is detected.
See also
usmthmdlImage_freeImageC
IMAGELIB_EXPORT int mdlImage_mirror ( byte inpBufferP,
Point2d *  imageSizeP,
int  imageFormat,
bool  vertical 
)

Mirrors an image by reversing the pixels, either horizontally or vertically.

Parameters
inpBufferPIN OUT pointer to the image buffer. The original buffer is overwritten during the mirror operation.
imageSizePIN size of the image buffer in X and Y pixels.
imageFormatIN one of the IMAGEFORMAT types defined in image.h.
verticalIN if true, the image is mirrored vertically; if false, the image is mirrored horizontally.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_rotateC usmthmdlImage_warpC
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.

Parameters
rgbOutPOUT output image buffer (may be the same as rgbInP).
rgbInPIN input image buffer.
sizePIN pointer to image size in X and Y pixels.
See also
usmthmdlImage_negatePaletteC
IMAGELIB_EXPORT void mdlImage_negatePalette ( byte redMapP,
byte greenMapP,
byte blueMapP,
int  paletteSize 
)

Returns a negated version of the supplied color palette.

Parameters
redMapPIN OUT red palette entries.
greenMapPIN OUT green palette entries.
blueMapPIN OUT blue palette entries.
paletteSizeIN number of palette entries.
See also
usmthmdlImage_negateC usmthmdlImage_tintPaletteC
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.

Parameters
outPOUT 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.
encodeSizePOUT the actual encoded size required. This value is normally used to allocate space to hold a row of encoded image data.
inPIN pointer to the source uncompressed byte-mapped data in format IMAGEFORMAT_ByteMap.
rawSizeIN the number of pixels to encode.
See also
usmthmdlImage_unpackByteBufferC
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.

Parameters
bitMapPOUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer. The format of this buffer is IMAGEFORMAT_BitMap.
packBytePIN pointer to the compressed byte-mapped buffer to be converted to monochrome. The format of the buffer is IMAGEFORMAT_PackByte.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN number of palette entries.
sizePIN pointer to the size of the image in X and Y pixels.
ditherModeIN DITHERMODE_Pattern to apply a Bayer dither; or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid DITHERMODE is detected.
See also
usmthmdlImage_byteMapToBitMapC usmthmdlImage_greyScaleToBitMapC usmthmdlImage_rgbToBitMapC
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:

grey = 0.30 * red + 0.59 * green + 0.11 * blue
Parameters
greyPOUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer.
minGreyPOUT the minimum greyscale value. If the pointer is NULL, this value is not returned.
maxGreyPOUT the maximum greyscale value. If the pointer is NULL, this value is not returned.
packBytePIN pointer to the compressed byte-mapped color image data to be converted to greyscale.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
sizePIN pointer to the size of the image in X and Y pixels.
Returns
SUCCESS when operation is complete.
See also
usmthmdlImage_paletteToGreyScaleC usmthmdlImage_byteMapToGreyScaleC usmthmdlImage_rgbToGreyScaleC
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:

grey = 0.30 * red + 0.59 * green + 0.11 * blue
Parameters
greyPalettePOUT pointer to an array of greyscale values.
minGreyPOUT the minimum greyscale value. If the pointer is NULL, this value is not returned.
maxGreyPOUT the maximum greyscale value. If the pointer is NULL, this value is not returned.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
See also
usmthmdlImage_byteMapToGreyScaleC usmthmdlImage_packByteToGreyScaleC usmthmdlImage_rgbToGreyScaleC
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.

Parameters
imageSizePOUT size of the image in X and Y pixels. If the pointer is NULL, this value is not returned.
colorModePOUT color mode of the image (from image.h). If the pointer is NULL, this value is not returned.
orientationPOUT orientation of the image (from image.h). If the pointer is NULL, this value is not returned.
fileNameIN file name to examine.
fileTypeIN type of the file (from image.h), or -1 to use the file name extension to determine the disk format.
Returns
SUCCESS if the information is successfully extracted from the image file.
MDLERR_BADFILETYPE if filetype is not supported for import.
MDLERR_CANNOTOPENFILE if the file cannot be opened.
See also
usmthmdlImage_readFileToMapC usmthmdlImage_readFileToRGBC
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.

Remarks
Generally, ~mmdlImage_readFileInfo is first used to determine the file type, then mdlImage_readFileToBitMap is called if the image color mode is ImageColorMode::Monochrome.
Parameters
imageBitMapOUT 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.
imageSizeOUT returned with the size of the image in X and Y pixels.
fileNameIN full path name of the file to be read.
fileTypeIN 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.
runLengthEncodeIN 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:
runLengthEncode Image Format Type Description
true IMAGEFORMAT_RLEBitMap Run length encoded (generally most compressed)
false IMAGEFORMAT_BitMap Bits per pixel (generally least compressed)
Returns
SUCCESS if the image file could be successfully read into the memory buffer.
MDLERR_BADFILETYPE if file does not contain monochrome bitmap data.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_readFileToMapC usmthmdlImage_readFileToRGBC usmthmdlImage_readFileInfoC mdlImage_freeImageC
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.

Parameters
imageMapPPOUT memory to receive the pixels. When this memory is no longer required, it should be freed by the calling routine by using ~mmdlImage_freeImage.
imageSizePOUT size of the image in X and Y pixels.
redMapPOUT red palette entries. Buffer should be 256 bytes to accept the largest supported color palette.
grnMapPOUT green palette entries. Buffer should be 256 bytes to accept the largest supported color palette.
bluMapPOUT blue palette entries. Buffer should be 256 bytes to accept the largest supported color palette.
paletteSizePOUT returned with the number of color palette entries.
fileNameIN input file name.
fileTypeIN type of file (from image.h), or -1 to use the file name extension to determine the disk format.
Returns
SUCCESS if the file is read successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_readFileInfo mdlImage_readFileToRGB mdlImage_extReadFileToMap
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.

Parameters
imageBufferPPOUT 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.
imageSizePOUT size of the image in X and Y pixels.
nameIN image file name.
fileTypeIN type of file (from image.h), or -1 to use the file name extension to determine the disk format.
requestedSizePIN target size for the image, or NULL for unmodified size.
Remarks
The process of resizing the image uses pixel averaging and can substantially increase the time required to read the image. The resizing algorithm produces excellent results, producing expanded or compressed images of significantly higher quality than those produced using simple pixel replication or decimation.
Returns
SUCCESS if the file is read successfully.
MDLERR_BADFILETYPE: if filetype is not supported.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_readFileInfoC usmthmdlImage_readFileToMapC usmthmdlImage_extReadFileToRGBC
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.

Parameters
[out]outPbuffer that receives remapped image data. Both inP and outP can point to the same buffer.
[in]inPbuffer that contains the source image data which is remapped to the screen palette.
[in]sizePpointer 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]redMapPthe red color palette for the image source.
[in]grnMapPthe green color palette for the image source.
[in]bluMapPthe blue color palette for the image source.
[in]paletteSizethe number of palette entries.
[in]screenNumberthe screen number on which the image data is to be displayed. 0 for the main screen, 1 for the secondary screen.
See also
mdlImage_computeScreenMap mdlImage_getScreenPalette
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.

Parameters
[in,out]imageBufferPPmemory to receive the RGB pixels, or pointer to NULL to have it allocated.
[in]sizePpointer to size of image to render (in X and Y pixels).
[in]renderModethe rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h.
[in]stereoTrue for stereo image.
[in]antiAliasTrue to anti-alias.
[in]viewnumber of view to render.
Returns
SUCCESS if the view is successfully rendered
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
outputImagePPOUT resized output image (RGB)
outputSizePIN output size
inputImagePIN input image (RGB)
inputSizePIN input size
Returns
SUCCESS if the image is resized successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
outputImagePPOUT the buffer to receive the resized RGB image.
outputSizePIN the dimensions of the resized image, in X and Y pixels.
outRowStartIN the first row of the image to include in the resized area.
outRowStopIN the last row of the image to include in the resized area.
inputImagePIN the original RBG image to be resized.
inputSizePIN the size of the original image.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
bgrInterlacedPOUT the buffer to receive the image in BGRBGRBGR or BGRABGRABGRA format.
rgbSeparatePIN the RRRGGGBBB format image data.
imageSizePIN the size of the image.
colorModeIN either ImageColorMode::RGB or ImageColorMode::RGBA.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
rgbInterlacedPOUT the buffer to receive the image in RGBRGBRGB or RGBARGBARGBA format.
rgbSeparatePIN the RRRGGGBBB format image data.
imageSizePIN the size of the image.
colorModeIN either ImageColorMode::RGB or ImageColorMode::RGBA.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
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.

Parameters
bitMapPOUT pointer to the resulting bitmap image buffer. The caller must allocate memory for this buffer. The format of this buffer is IMAGEFORMAT_BitMap.
rgbPIN pointer to the RGB buffer to be converted to monochrome. The format of this buffer is IMAGEFORMAT_RGBSeparate.
sizePIN pointer to the size of the image in X and Y pixels.
ditherModeIN either DITHERMODE_Pattern to apply a Bayer dither or DITHERMODE_ErrorDiffusion to apply a Floyd and Steinberg dithering algorithm.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid DITHERMODE is detected.
See also
usmthmdlImage_byteMapToBitMapC usmthmdlImage_packByteToBitMapC usmthmdlImage_greyScaleToBitMapC
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:

grey = 0.30 * red + 0.59 * green + 0.11 * blue
Parameters
greyPOUT pointer to the resulting greyscale image buffer. The caller must allocate memory for this buffer.
minGreyPOUT the minimum greyscale value. If the pointer is NULL, this value is not returned.
maxGreyPOUT the maximum greyscale value. If the pointer is NULL, this value is not returned.
rgbPIN pointer to the RGB color image data to be converted to greyscale. The RGB data is in IMAGEFORMAT_RGBSeparate format.
sizePIN pointer to the size of the image in X and Y pixels.
Returns
SUCCESS when operation is complete.
See also
usmthmdlImage_paletteToGreyScaleC usmthmdlImage_byteMapToGreyScaleC usmthmdlImage_packByteToGreyScaleC
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.

Remarks
The output image is allocated by the conversion routine and the base address is returned in imageMapPP. This buffer should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage.
Parameters
imageMapPPOUT 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.
rgbBufferPIN RGB image buffer to be converted.
sizePIN pointer to image size in X and Y pixels.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
paletteSizeIN number of palette entries.
Returns
SUCCESS if the palette is calculated successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_mapToRGBC usmthmdlImage_mapToRGBBufferC usmthmdlImage_applyGammaC usmthmdlImage_RGBToPackByteWithGammaC usmthmdlImage_RGBToMapWithGammaC usmthmdlImage_RGBToScreenMapC
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.

Remarks
The output image buffer is allocated by the conversion routine and the base address is returned in imageMapPP. This buffer should be freed by the calling application when it is no longer required by using ~mmdlImage_freeImage.
Parameters
imageMapPPOUT 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.
rgbBufferPIN RGB image buffer to be converted.
sizePIN pointer to image size in X and Y pixels.
redMapPIN red palette entries.
grnMapPIN green palette entries.
bluMapPIN blue palette entries.
paletteSizeIN number of palette entries.
gammaIN gamma correction value.
Returns
SUCCESS if the palette is calculated successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_mapToRGBC usmthmdlImage_mapToRGBBufferC usmthmdlImage_applyGammaC usmthmdlImage_RGBToPackByteWithGammaC usmthmdlImage_RGBToMapC usmthmdlImage_RGBToScreenMapC
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.

Parameters
imageMapPPOUT 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.
rgbBufferPIN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format.
sizePIN pointer to the size of the image in X and Y pixels.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_RGBToMapC usmthmdlImage_mapToRGBC usmthmdlImage_extMapToRGBC usmthmdlImage_freeImageC
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.

Parameters
imageMapPPOUT 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.
rgbBufferPIN pointer to the source RGB buffer in IMAGEFORMAT_RGBSeparate format.
sizePIN pointer to the size of the image in X and Y pixels.
redMapPIN pointer to the red color palette entry.
grnMapPIN pointer to the green color palette entry.
bluMapPIN pointer to the blue color palette entry.
paletteSizeIN the number of palette entries.
gammaIN gamma correction value that is applied to the RGB image prior to conversion.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_applyGammaC usmthmdlImage_freeImageC
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.

Parameters
rgbSeparatePOUT buffer to receive the RRRGGGBBB format image data.
rgbInterlacedPIN image in RGBRGBRGB or RGBARGBARGBA format.
imageSizePIN size of the image.
colorModeIN either ImageColorMode::RGB or ImageColorMode::RGBA.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
Remarks
If the input image is RGBA, the alph channel is discarded.
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.

The mapped image is then suitable for display by mdlWindow_rasterDataDraw.

Remarks
The output image buffer is allocated by the conversion routine and the base address is returned in imageMapPP. This buffer should be freed by the calling application when it is no longer required.
Parameters
[out]mapPPpointer to converted image map, allocated by conversion function.
[in]rgbBufferPRGB image buffer to be converted.
[in]sizePimage size in X and Y pixels.
[in]screenscreen number.
Returns
SUCCESS if the palette is calculated successfully.
If processing is aborted by a non-zero return value from stop/// func, this value is returned.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
mdlImage_mapToRGB mdlImage_mapToRGBBuffer mdlImage_applyGamma mdlImage_RGBToPackByteWithGamma mdlImage_RGBToMap usmtmdlImage_RGBToMapWithGammaC
Remarks
Required Library: mdlbltin.lib
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.

Parameters
outBufferPPOUT 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.
outSizePOUT size of the output image in X and Y pixels.
inpBufferPIN input image buffer.
imageSizePIN size of the input image buffer in X and Y pixels.
imageFormatIN one the IMAGEFORMAT types defined in image.h.
rotationIN 90, 180 or 270 degrees.
Remarks
Currently, only 90, 180 and 270 degree rotations are supported.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid image format is detected.
See also
usmthmdlImage_mirrorC usmthmdlImage_warpC
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.

Parameters
outPOUT pointer to the bitmap buffer. It should be BITMAP_ROWBYTES (nPixels) in length.
inPIN 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.
nPixelsIN number of pixels to decode. The number of pixels can be less that the total in the row.
See also
usmthmdlImage_stretchRLEToBitMapC usmthmdlImage_runLengthEncodeBitMapRowC
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.

Parameters
rlePPPOUT 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.
bitmapPIN source bitmap in IMAGEFORMAT_BitMap format.
sizePIN size of the image in X and Y pixels.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_runLengthDecodeBitMapRowC
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.

Remarks
The worst case compression is a sequence of alternating 0 and 1 bits, in which case an entire Ushort (16-bits) will be required to hold each bit of information. Since this case is possible, although highly improbable, the user is responsible for allocating an output buffer sizeP->x * sizeof (UShort) bytes. For most bitmaps, the compression sizes will be considerably less than this.
Parameters
outPOUT pointer to a buffer that receives the compressed bitmap.
compressedSizePOUT pointer to the length of the output buffer in bytes. Normally, this length is used to allocate memory to hold the compressed image.
inPIN pointer to the bitmap image buffer that is compressed.
nPixelsIN number of pixels to encode.
See also
usmthmdlImage_runLengthEncodeBitMapC usmthmdlImage_runLengthDecodeBitMapRowC
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.

Parameters
[in]fileNamePname of image file to create.
[in]sizePpointer to size of image to render (in X and Y pixels).
[in]renderModethe rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h.
[in]formatimage format of output file, defined in image.h.
[in]stereoif non-zero, the view is rendered in stereo mode.
[in]antiAliasif non-zero, the view is antialiased.
[in]viewnumber of view to save.
Returns
SUCCESS: if the view is rendered successfully.
MDLERR_BADVIEWNUMBER: if the view number is invalid.
MDLERR_INSFMEMORY: if a memory error occurs.
MDLERR_CANNOTOPENFILE: if the file cannot be created.
See also
mdlImage_saveViewToRGB mdlView_renderSingle mdlView_setRenderMode
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.

Parameters
[in,out]imageBufferPPmemory to receive the RGB pixels, or pointer to NULL to have it allocated.
[in]sizePpointer to size of image to render (in X and Y pixels).
[in]renderModethe rendering mode (SMOOTH, MSRenderMode::Phong, CONSTANT, etc.), defined in msdefs.h.
[in]stereoif non-zero, the view is rendered in stereo mode.
[in]antiAliasif non-zero, the view is antialiased.
[in]viewnumber of view to save.
Returns
SUCCESS if the view is rendered successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
Remarks
After rendering, the image buffer can be saved to disk using functions like mdlImage_createFileFromRGB.
See also
mdlImage_saveView mdlImage_createFileFromRGB mdlView_renderSingle mdlView_setRenderMode
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.

Parameters
mapPIN OUT pointer to the mapped image.
valueIN palette index that will be placed in the mapped image whenever a match occurs between the RGB image and matchP.
rgbPIN pointer to the RGB image in IMAGEFORMAT_RGBSeparate format.
sizePIN pointer to the size of the image in X and Y pixels.
matchPIN the RGB value to be matched in the RGB image.
packBytesIN if true, the mapped image is in IMAGEFORMAT_PackByte compressed with packbytes compression. If false, the mapped image is in IMAGEFORMAT_ByteMap uncompressed format.
See also
usmthmdlImage_getMapUsageC
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.

Parameters
dataPIN OUT pointer to the image buffer.
dataModifiedPOUT set to true if the image is modified because the mask polygon falls somewhere within the image.
sizePIN size of the image in X and Y pixels.
imageFormatIN IMAGEFORMAT type identified in image.h. RGB formats are not allowed.
pointPIN pointer to the first element of an array of nPoints points. This array defines a closed masking polygon in pixel coordinates.
nPointsIN number of elements in the array starting at pointP.
outsideIN 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.
valueIN the fill value.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid image format is detected.
See also
usmthmdlImage_setRGBPolygonC
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.

Parameters
dataPIN OUT pointer to the image buffer.
dataModifiedPOUT set to true if the image is modified because the mask polygon falls somewhere within the image.
sizePIN size of the image in X and Y pixels.
pointPIN pointer to the first element of an array of nPoints points. This array defines a closed masking polygon in pixel coordinates.
nPointsIN number of elements in the array starting at pointP.
outsideIN 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.
colorPIN pointer to an RGBColorRef structure with the red, green and blue values that will be used as the fill value.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_setMapPolygonC
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.

Parameters
imagePPIN 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.
sizePIN pointer to the size of the image in X and Y pixels.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_runLengthEncodeBitMapC usmthmdlImage_runLengthDecodeBitMapRowC
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.

Parameters
outMapPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_ByteMap)
outSizePIN output image size in X and Y pixels.
inBitMapPIN source image buffer in IMAGEFORMAT_BitMap or IMAGEFORMAT_RLEBitMap format, depending on the value of the rle flag.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
foregroundIN color index of the foreground color. All 1-bits in the source image will be mapped to this color index.
backgroundIN color index of the background color. All 0-bits in the source image will be mapped to this color index.
rleIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_subByteMapFromRLEBitMapC usmthmdlImage_subByteMapFromPackByteC usmthmdlImage_memorySizeC
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.

Parameters
outMapPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_ByteMap)
outSizePIN output image size in X and Y pixels.
inRowPPIN source image buffer in IMAGEFORMAT_PackByte format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
mapPIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_subByteMapFromBitMapC usmthmdlImage_subByteMapFromRLEBitMapC
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.

Parameters
outMapPOUT pointer to a buffer allocated by the caller. The format of this buffer is IMAGEFORMAT_ByteMap and the size of this buffer is:
mdlImage_memorySize (outSizeP, IMAGEFORMAT_ByteMap)
outSizePIN output image size in X and Y pixels.
inBitMapPPIN source image buffer in IMAGEFORMAT_RLEBitMap format.
inSizePIN size of the source image in X and Y pixels.
rectPIN 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.
foregroundIN color index of the foreground color. All 1-bits in the source image will be mapped to this color index.
backgroundIN color index of the background color. All 0-bits in the source image will be mapped to this color index.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
See also
usmthmdlImage_subByteMapFromBitMapC usmthmdlImage_subByteMapFromPackByteC usmthmdlImage_memorySizeC
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.

Parameters
imagePOUT pointer to an image buffer in format IMAGEFORMAT_RGBSeparate.
imageSizePIN size of the image in X and Y pixels.
tintRGBPIN RGB value that will be used to tint the image.
Remarks
The image pixels are adjusted as follows:
*imageP = (tintRGBP->red * (UInt)*imageP) / 255u;
imageP += imageSizeP->x;
*imageP = (tintRGBP->green * (UInt)*imageP) / 255u;
imageP += imageSizeP->x;
*imageP = (tintRGBP->blue * (UInt)*imageP) / 255u;
See also
usmthmdlImage_tintPaletteC
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.

Parameters
redPIN OUT the red color palette for the source image.
grnPIN OUT the green color palette for the source image.
bluPIN OUT the blue color palette for the source image.
paletteSizeIN the number of palette entries.
tintRGBPIN RGB value that will be used to tint the palette.
Remarks
The palette entries are adjusted as follows:
*redP = (tintRGBP->red * (UInt)*redP) / 255;
*grnP = (tintRGBP->green * (UInt)*grnP) / 255;
*bluP = (tintRGBP->blue * (UInt)*bluP) / 255;
See also
usmthmdlImage_tintImageC
IMAGELIB_EXPORT DgnPlatform::ImageFileFormat mdlImage_typeFromExtension ( WCharCP  fileName)

Returns the file type of the specified image file.

Parameters
fileNameIN image file name
Returns
the image file type from the filename extension (defined in image.h). If the extension does not have a match, IMAGEFILE_UNKNOWN is returned.
See also
usmthmdlImage_getExportSupportC usmthmdlImage_getOSFileTypeC
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.

Remarks
Currently, this function recognizes the following types of files: FLI, GIF, PNG, JPEG, IMG, IMG (24-bit), all Intergraph files and TIFF files. These files have magic number and special check bytes that easily identify the type of image file.
The mdlImage_typeFromFile function is the preferred way to determine the format of a source (import) image file. It should be checked before calling ~mmdlImage_typeFromExtension, since image types returned by this function are more likely to be correct.
Parameters
fileNamePIN full path name of the image file.
Returns
an IMAGEFILE type (from in image.h).
IMAGEFILE_UNKNOWN if no valid image format can be determined.
See also
usmthmdlImage_typeFromExtensionC usmthmdlImage_getImportFormatC
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.

Parameters
outPOUT buffer that holds the decoded byte-mapped data. The caller should allocate numDecode bytes for this buffer.
inPIN pointer to the source compressed packbyte byte-mapped data in format IMAGEFORMAT_PackByte.
numDecodeIN the number of pixels to decode.
See also
usmthmdlImage_packByteBufferC
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.

Parameters
outPPOUT 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.
outSizePIN 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.
inPIN pointer to the source image buffer.
inSizePIN size of the source image in X and Y pixels.
imageFormatIN any of the IMAGEFORMAT types defined in image.h, except IMAGEFORMAT_RGB or IMAGEFORMAT_RGBA. The only valid RGB format supported is IMAGEFORMAT_RGBSeparate.
inverseTransformPIN 2-D Transform from each pixel of the output image used to compute the corresponding pixel of the source image.
transparentPIN 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.
Returns
SUCCESS if the operation is completed successfully.
MDLERR_INSFMEMORY if there is not enough memory available to perform the operation.
MDLERR_BADARG if an invalid image format is detected.
See also
usmthmdlImage_rotateC usmthmdlImage_mirrorC
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.

Parameters
[out]imageDataPPthe image data allocated by this function.
[out]imageSizePthe size (in X and Y pixels) of the image data returned.
[in]windowPthe window to capture.
[in]imageFormatthe format of the image, either IMAGEFORMAT_ByteMap or IMAGEFORMAT_RGB (from image.h).
[in]rectPthe subimage rectangle or NULL for the entire window.
Remarks
Required Library: mdlbltin.lib
Returns
SUCCESS if windowP is valid.
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.

Remarks
Source data is a single byte per pixel, mapped to the screen palette for the specified window.
Each byte of source data is mapped to a single output pixel, starting at the upper left corner and going to the right and downward.
monoChrome, foreground, background are currently unused.
Parameters
[in]windowPthe window on which to draw the image data.
[in]rectPthe output rectangle to be drawn, specified in window coordinates.
[in]inPsource 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]srcPitchthe 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]monoChrometrue if data is monochrome (currently unused).
[in]foregroundforeground color for monochrome (currently unused).
[in]backgroundbackground color for monochrome (currently unused).
[in]clipRectPclipping rectangle in window coordinates. If clipRectP is NULL, the window's content rectangle is used.
[in]transparentthe 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.
Returns
SUCCESS when operation is complete.
See also
mdlWindow_rasterDataDraw mdlWindow_transparentRgbDataDraw mdlColorDescr_getDrawIndex
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.

Remarks
Source data contain the red, blue and green color intensities in one of several possible formats. If the display supports true color, data will be written with these values. If the display does not support true color, colors will be dithered.
Each RGB source data value is mapped to a single output pixel, starting at the upper left corner and going to the right and downward.
Parameters
[in]windowPthe window on which to draw the image data.
[in]rectPthe output rectangle to be drawn, specified in window coordinates.
[in]srcPitchthe 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]rgbBufferPthat source image data buffer, which contains a the red, green and blue color intensities for each pixel.
[in]formatthe format of the RGB buffer. The possible values and meanings are as follow:
Format Value Meaning 4 pixel row example
TRUECOLOR_Seperate Data stored separately RRRRGGGGBBBB
IMAGEFORMAT_RGBSeparate
TRUECOLOR_RGB Data interleaved RGBRGBRGBRGB
IMAGEFORMAT_RGB
TRUECOLOR_RGBA Data interleaved w/Alpha
(Alpha data is actually ignored)
RGBARGBARGBARGBA
IMAGEFORMAT_RGBA
[in]clipRectPclipping rectangle in window coordinates. If clipRectP is NULL, the window's content rectangle is used.
[in]transparentRgbPthe 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.
Returns
SUCCESS if no error is detected.
MDLERR_NOMATCH if an invalid format is detected.
See also
mdlWindow_rgbDataDraw mdlWindow_transparentRasterDataDraw

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.