home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk21
/
dir03
/
f012020.re_
/
f012020.re
Wrap
Text File
|
1996-04-02
|
18KB
|
555 lines
/*----------------------------------------------------------------------+
| |
| Copyright (c) 1985-93; Bentley Systems, Inc., All rights reserved. |
| |
| "MicroStation", "MDL", and "MicroCSL" are trademarks of Bentley |
| Systems, Inc. |
| |
| Limited permission is hereby granted to reproduce and modify this |
| copyrighted material provided that the resulting code is used only |
| in conjunction with Bentley Systems products under the terms of the |
| license agreement provided therein, and that this notice is retained |
| in its entirety in any such reproduction or modification. |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| $Workfile: msimage.fdf $
| $Revision: 6.3 $
| $Date: 23 Jun 1995 08:50:50 $
| |
+----------------------------------------------------------------------*/
#if !defined (__msimageFDF__)
#define __msimageFDF__
/*----------------------------------------------------------------------+
| |
| Header File Dependencies |
| |
+----------------------------------------------------------------------*/
#if !defined (__dloadlibH__)
#include "dloadlib.h"
#endif
#if !defined (__mdlH__)
#include "mdl.h"
#endif
#if !defined (__globalH__)
#include "global.h"
#endif
#if ! defined (__mselemsH__)
#include "mselems.h"
#endif
#if ! defined (__imageH__)
#include "image.h"
#endif
#if defined (__BSI__)
#include <miimage.fdf>
#endif
/*======================================================================+
| |
| Function Definitions |
| |
+======================================================================*/
void mdlDither_drawRow
(
MSWindow *windowP,
long x0,
long x1,
long y,
byte *red,
byte *grn,
byte *blu
);
int mdlImage_RGBToMapWithGamma
(
byte **imageMapPP, /* <= image map */
byte *rgbBuffer, /* => image buffer (RGB) */
Point2d *size, /* => image size */
byte *redMap, /* => red palette entries */
byte *grnMap, /* => green palette entries */
byte *bluMap, /* => blue palette entries */
int paletteSize, /* => number of palette entries */
double gamma, /* => gamma correction value */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_RGBToMap
(
byte **imageMap, /* <= image map */
byte *rgbBuffer, /* => image buffer (RGB) */
Point2d *size, /* => image size */
byte *redMap, /* <= red palette entries */
byte *grnMap, /* <= green palette entries */
byte *bluMap, /* <= blue palette entries */
int paletteSize, /* => number of palette entries */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_RGBToScreenMap
(
byte **mapPP,
byte *rgbBufferP,
Point2d *sizeP,
int screen,
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
Public int mdlImage_captureScreen
(
byte **image, /* <= returned image */
BSIRect *rectangleP, /* => rectangle to Capture */
int screenNum, /* => physical screen number */
int imageFormat /* => returned image format */
);
Public int mdlImage_captureScreenMap
(
byte **imageMap, /* <= image map */
BSIRect *rectangleP, /* => rectangle to Capture */
int screenNum /* => physical screen number */
);
void mdlImage_ditherCleanup
(
void
);
int mdlImage_ditherInitialize
(
int nColors, /* => number of palette entries */
byte *redMapP, /* => red palette entries */
byte *grnMapP, /* => green palette entries */
byte *bluMapP, /* => blue palette entries */
int width /* => width of scanlines */
);
int mdlImage_ditherRow
(
byte *outputLine, /* <= color map indices for each pixel */
byte *redP, /* => red values for each pixel */
byte *grnP, /* => green values for each pixel */
byte *bluP, /* => blue values for each pixel */
int width /* => number of pixels in scanline */
);
int mdlImage_getOptimizedPalette
(
byte *redMap, /* <= red values for optimized palette */
byte *grnMap, /* <= green values for optimized palette */
byte *bluMap, /* <= blue values for optimized palette */
int *paletteSize, /* <= number of palette entries used */
int maxColors, /* => maximum colors in optimized palette */
byte *imageBuffer, /* => RGB Values for each image pixel */
Point2d *size, /* => size of imageBuffer */
MdlFunctionP stopFunc /* => function to stop (or NULL) */
);
int mdlImage_getScreenPalette
(
byte *redMap, /* <= red palette entries */
byte *grnMap, /* <= green palette entries */
byte *bluMap, /* <= blue palette entries */
int *paletteSize, /* <= number of palette entries */
int screenNum /* => screen number */
);
int mdlImage_mapToRGB
(
byte **rgbBufferPP, /* <= image buffer (RGB) */
byte *map, /* => image map */
Point2d *size, /* => image size */
byte *redMap, /* => red palette entries */
byte *grnMap, /* => green palette entries */
byte *bluMap, /* => blue palette entries */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_mapToRGBBuffer
(
byte *rgbBufferP, /* <= image buffer (RGB) */
byte *mapP, /* => image map */
Point2d *size, /* => image size */
byte *redMap, /* => red palette entries */
byte *grnMap, /* => green palette entries */
byte *bluMap, /* => blue palette entries */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_resize
(
byte **outputImage, /* <= resized output image (RGB) */
Point2d *outputSize, /* => output size */
byte *inputImage, /* => input image (RGB) */
Point2d *inputSize, /* => input size */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_saveView
(
char *fileName, /* => name of file */
Point2d *size, /* => image size */
int renderMode, /* => 5=Constant, 6=Smooth, 7=Phong */
int format, /* => 1=RGB, 2=Targa, 3=Tiff, 4=Pict */
boolean stereo, /* => True for stereo image */
boolean antiAlias, /* => True to anti-alias */
int view /* => view number */
);
int mdlImage_saveViewToRGB
(
byte **imageBuffer, /* <= structure of r,g,b colors */
Point2d *size, /* => image size */
int renderMode, /* => 5=Constant, 6=Smooth, 7=Phong */
boolean stereo, /* => True for stereo image */
boolean antiAlias, /* => True to anti-alias */
int view /* => view number */
);
int mdlImage_renderViewToRGB
(
byte **imageBuffer, /* <= existing structure to get r,g,b colors */
Point2d *size, /* => image size */
int renderMode, /* => 5=Constant, 6=Smooth, 7=Phong */
boolean stereo, /* => True for stereo image */
boolean antiAlias, /* => True to anti-alias */
int view /* => view number */
);
/*----------------------------------------------------------------------+
| |
| File read functions |
| |
+----------------------------------------------------------------------*/
int mdlImage_readFileInfo
(
Point2d *imageSize, /* <= image size */
int *colorMode, /* <= color mode (see image.h) */
int *orientation, /* <= orientation (see image.h) */
char *fileName, /* => file name */
int fileType /* => file type */
);
int mdlImage_readFileToRGB
(
byte **imageBuffer, /* <= map indices for each pixel */
Point2d *imageSize, /* <= image size */
char *name, /* => image file name */
int fileType, /* => type of file (see image.h) */
Point2d *requestedSize, /* => size of output image (or NULL) */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_readFileToMap
(
byte **imageMap, /* <= image map */
Point2d *imageSize, /* <= image size */
byte *redMap, /* <= red palette entries */
byte *grnMap, /* <= green palette entries */
byte *bluMap, /* <= palette entries */
int *paletteSize, /* <= palette size */
char *fileName, /* => input file name */
int fileType, /* => input file type */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
/*----------------------------------------------------------------------+
| |
| File creation functions |
| |
+----------------------------------------------------------------------*/
int mdlImage_extCreateFileFromMap
(
char *name, /* => name of file */
int type, /* => type of file (see image.h) */
int colorMode, /* => color mode (see image.h) */
Point2d *size, /* => size of image */
byte *imageMap, /* => color map index for each pixel */
byte *redPalette, /* => red palette values */
byte *grnPalette, /* => green palette values */
byte *bluPalette, /* => blue palette values */
int paletteSize, /* => number of palette entries */
int compression, /* => quality of image after compression (1-90) */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_createFileFromMap
(
char *name, /* => name of file */
int type, /* => type of file (see image.h) */
int colorMode, /* => color mode (see image.h) */
Point2d *size, /* => size of image */
byte *imageMap, /* => color map index for each pixel */
byte *redPalette, /* => red palette values */
byte *grnPalette, /* => green palette values */
byte *bluPalette, /* => blue palette values */
int paletteSize, /* => number of palette entries */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_extCreateFileFromRGB
(
char *name, /* => name of file */
int type, /* => type of file (see image.h) */
int colorMode, /* => color mode (see image.h) */
Point2d *size, /* => size of image */
byte *imageBuffer, /* => RGB values for each pixel */
int compression, /* => degree of compression */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_createFileFromRGB
(
char *name, /* => name of file */
int type, /* => type of file (see image.h) */
int colorMode, /* => color mode (see image.h) */
Point2d *size, /* => size of image */
byte *imageBuffer, /* => RGB values for each pixel */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
/*----------------------------------------------------------------------+
| |
| Movie Functions |
| |
+----------------------------------------------------------------------*/
int mdlImage_saveMovie
(
char *fileName, /* => file name */
int fileType, /* => file type */
int colorMode, /* => color mode */
MSMovie *movieP, /* => movie to save */
MdlFunctionP stopFunc, /* => stop function (or NULL) */
MdlFunctionP frameFunc /* => frame function */
);
int mdlImage_extendedSaveMovie
(
char *fileName, /* => file name */
int fileType, /* => file type */
int colorMode, /* => color mode */
MSMovie *movieP, /* => movie to save */
int quality, /* => quality of compressed image (1-90) */
MdlFunctionP stopFunc, /* => stop function (or NULL) */
MdlFunctionP frameFunc /* => frame function */
);
int mdlImage_readMovie
(
MSMovie *movieP, /* <= movie */
char *fileName, /* => file name */
int fileType, /* => file type */
byte *redMap, /* => red map */
byte *grnMap, /* => green map */
byte *bluMap, /* => blue map */
int mapSize, /* => map size */
double gammaCorrection, /* => gamma correction (1.0 == NONE) */
boolean firstFrameOnly, /* => TRUE for only one frame */
MdlFunctionP stopFunc, /* => stop function (or NULL) */
MdlFunctionP frameFunc /* => frame function */
);
int mdlImage_insertMovie
(
MSMovie *movieP, /* <=> movie */
MSMovieFrame *insertFrameP, /* => frame in movieP to insert at */
MSMovie *insertMovieP, /* => movie to insert */
int transitionType, /* => type of transition */
int transitionFrames, /* => transition frames */
int stillTransition, /* => still transition */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_insertMovieFrame
(
MSMovie *movieP, /* <=> movie */
MSMovieFrame *insertFrameP, /* => frame in movieP to insert at */
byte *rgbFrameP, /* => rgb buffer for new frame */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_deleteMovieFrame
(
MSMovie *movieP, /* <=> movie */
MSMovieFrame **framePP /* => frame to delete */
);
void mdlImage_freeMovie
(
MSMovie *movieP /* <=> movie to free */
);
/*----------------------------------------------------------------------+
| |
| Miscellaneous functions |
| |
+----------------------------------------------------------------------*/
int mdlImage_getExtension
(
char *extension, /* <= default extension (3 characters) */
int type /* => image type (see image.h) */
);
int mdlImage_getOSFileType /* <= SUCCESS or error. */
(
ULong *osFileType, /* <= O.S. file type. */
int imageType /* => image type (see image.h) */
);
int mdlImage_getExportSupport
(
int *defaultMode, /* <= default color mode */
int *rgbSupport, /* <= support for 24 bit RGB */
int *palette256Support, /* <= support for 256 color palette */
int *palette16Support, /* <= support for 16 color palette */
int *greyScaleSupport, /* <= support for grey scale */
int *monochromeSupport, /* <= support for monochrome */
int imageType /* => image type (see image.h) */
);
int mdlImage_getExportFormat
(
char *formatName, /* <= image format name */
int *importType, /* <= IMAGEFILE_ type for returned format */
int index /* => index of export array to return */
);
int mdlImage_getImportFormat
(
char *formatName, /* <= image format name */
int *importType, /* <= IMAGEFILE_ type for returned format */
int index /* => index of import array to return */
);
int mdlImage_createRasterFromRGB
(
MSElementDescr **edP, /* <= raster element */
byte *imageBuffer, /* => RGB image buffer */
Point2d *imageSize, /* => image size (in pixels) */
Dpoint3d *origin, /* => origin in current coordinates */
double scale, /* => scale factor (current/pixels) */
int level, /* => level */
int useCurrentPalette, /* => use current color table */
int transparentBackground, /* => transparent background */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
void mdlImage_getBalancedPalette
(
byte *redMap, /* <= red map */
byte *grnMap, /* <= green map */
byte *bluMap, /* <= blue map */
int *numColors /* <= number of colors */
);
int mdlImage_typeFromExtension
(
char *fileName /* => image file name */
);
int mdlImage_getImageBgColor
(
byte *pixel, /* <= 4 bytes to store backround color */
char *name,
int fileType
);
/*----------------------------------------------------------------------+
| |
| FLI functions |
| |
+----------------------------------------------------------------------*/
int mdlImage_createFli
(
void **fliFilePP, /* <=> creates the fliFilePP for all access */
Point2d *size, /* => size of the frame in pixels */
int speed, /* => desired playback speed in jiffies */
char *fileName, /* => qualified pathname of file to create */
boolean flcFormat /* => TRUE to create FLC file */
);
int mdlImage_appendFliFromMap
(
void *fliP, /* => fli file */
byte *mapP, /* => image */
byte *redMap, /* => red map */
byte *grnMap, /* => green map */
byte *bluMap, /* => blue map */
int paletteSize, /* => palette size */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
int mdlImage_appendFliFromRGB
(
void *fliP, /* => fli file (returned by create) */
byte *redMap, /* => red map */
byte *grnMap, /* => grn map */
byte *bluMap, /* => blu map */
int mapSize, /* => map size */
byte *imageBuffer, /* => RGB buffer */
MdlFunctionP stopFunc /* => stop function (or NULL) */
);
void mdlImage_completeFli
(
void *fliP /* => close the fli file and compute delta for last frame */
);
void mdlImage_applyGamma
(
byte *rgbOutP, /* <= output buffer */
byte *rgbInP, /* => input buffer */
Point2d *sizeP, /* => buffer size */
double gamma /* => gamma value (1.0 == NONE) */
);
void mdlImage_applyGammaToPalette
(
byte *redMap, /* <=> red palette values */
byte *greenMap, /* <=> green palette values */
byte *blueMap, /* <=> blue palette values */
int paletteSize, /* => number of palette entries */
double gamma /* => gamma value */
);
void mdlImage_negate
(
byte *rgbOutP, /* <= output buffer */
byte *rgbInP, /* => input buffer */
Point2d *sizeP /* => buffer size */
);
void mdlImage_negatePalette
(
byte *redMap, /* <=> red palette values */
byte *greenMap, /* <=> green palette values */
byte *blueMap, /* <=> blue palette values */
int paletteSize /* => number of palette entries */
);
#endif