Chapter 20:
Export Functions
 

ExportBMP(); Export a chart image as a bit-map to a file

 

ExportBMPtoRamFile(); Export a chart image as a bit-map to a RAM file

 

ExportGIF(); Export a chart image as a .GIF file

 

ExportGIFtoMemory(); Export a chart image as a .GIF image to memory

 

ExportPNG(); Export a chart image as a PNG image to a file

 

ExportPNGToMemory(); Export a chart image as a PNG image to memory

 

SaveImageToFile(); Save the image of a graph to a file in any format

 

SaveImageToMemory(); Save the image of a graph to memory in any format

ExportBMP()

 

This function exports a chart as a Windows 8-bit bitmap (.BMP) file at szOutFile.

Syntax:

INT16 PUBLIC ExportBMP (
     GraphPtr pGraph,
     LPSTR szOutFile,
     UINT16 cxBounds,
     UINT16 cyBounds
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr

 

szOutFile: File where chart image will be written

 

cxBounds: X-coordinate size of graph in pixels

 

cyBounds: Y-coordinate size of graph in pixels

Return:

INT16

 

Value

Description

 

E00_OK =

Successful

 

Any other value =

Failure

Also See:

ExportBMPToRamFile(), ExportGIF(), ExportGIFToMemory(), ExportPNG(), ExportPNGToMemory()

ExportBMPtoRamFile()

 

This function exports a chart as a Windows 8-bit bitmap (.BMP) image file to a RAM file.

Syntax:

INT16 PUBLIC
ExportBMPtoRamFile(
     GraphPtr pGraph,
     RamFilePtr *ppRamFile,
     UINT32 *pnSize,
     UINT16 cxBounds,
     UINT16 cyBounds,
     BOOLEAN16 bWantFileHeader
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr

 

ppRamFile: Pointer to a RamFilePtr where a RAM file pointer will be stored on return.

 

pnSize; Pointer to an unsigned 32-bit integer where the size of the BMP will be stored on return.

 

cxBounds/cyBounds: x/y coordinate size of graph in pixels

 

bWantFileHeader: TRUE = File stream starts with BITMAPFILEHADER information

Return:

INT16

 

Value

Description

 

E00_OK =

Successful

 

Any other value =

Failure

Also See:

ExportBMP(), ExportGIF(), ExportGIFToMemory(), ExportPNG(), ExportPNGToMemory()

   

ExportGIF()

 

This function exports the appearance of the graph identified by pGraph to the .GIF file identified by szOutFile.

Syntax:

INT16 PUBLIC
ExportGIF(
     GraphPtr pGraph,
     char * szOutFile,
     UINT16 cxBounds,
     UINT16 cyBounds,
     BOOLEAN16 bTransparent,
     BOOLEAN16 bInterlaced,
     LPGDPALETTE pPalette,
     BOOLEAN16 bUseLZWCompression
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

 

szOutFile: File where chart image will be written

 

cxBounds: x-coordinate size of graph in pixels. Must be a multiple of 8.

 

cyBounds: y-coordinate size of graph in pixels.

 

bTransparent: TRUE = Unpainted pixels are transparent / FALSE = Unpainted pixels are not transparent

 

bInterlaced: TRUE = GIF image is interlaced / FALSE = GIF image is not interlaced

 

pPalette: External Palette

 

bUseLZWCompression: TRUE = Use LZW compression / FALSE = Run-Length Encoded

Return:

INT16:

 

Value

Description

 

E00_OK =

Successful

 

E00_FILE_WRITE_ERROR=

Failure

Notes:

1.

This function is PLATFORM-SPECIFIC since the format of a color bitmap image differs from system to system

 

2.

The X-dimension must be a multiple of eight. PGSDK does not handle partial bytes in its GIF imaging code.

Also See:

ExportBMP(), ExportBMPToRamFile(), ExportGIFToMemory(), ExportPNG(), ExportPNGToMemory()

   

ExportGIFtoMemory()

 

This function allocates and opens a RAM file and exports the graph (pGraph) as a .GIF image in memory.

Syntax:

INT16 PUBLIC ExportGIFtoMemory (
     GraphPtr pGraph,
     MEMPTR *ppMemAd,
     UINT32 *pnSize,
     UINT16 cxBounds, UINT16 cyBounds,
     BOOLEAN16 bTransparent,
     BOOLEAN16 bInterlaced,
     LPGDPALETTE pPalette,
     BOOLEAN16 bUseLZWCompression);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

 

ppMemAd: Address of File in Memory

 

pnSize; Pointer to an unsigned 32-bit integer where the size of the GIF will be stored on return.

 

cxBounds: x-coordinate size of graph in pixels. Must be a multiple of 8.

 

cyBounds: y-coordinate size of graph in pixels

 

bTransparent: TRUE = Unpainted pixels are transparent / FALSE = Unpainted pixels are not transparent

 

bInterlaced: TRUE = GIF image is interlaced / FALSE = GIF image is not interlaced

 

pPalette: External Palette

 

bUseLZWCompression: TRUE = Use LZW compression / FALSE = Run-Length Encoded

Return:

INT16:

 

Value

Description

 

E00_OK =

Successful

 

E00_FILE_WRITE_ERROR=

Failure

 

E00_MEM_ERROR=

Memory Error

Notes:

1.

This function is PLATFORM-SPECIFIC since the format of a color bitmap image differs from system to system

 

2.

The X-dimension must be a multiple of eight. PGSDK does not handle partial bytes in its GIF imaging code.

Also See:

ExportBMP(), ExportBMPToRamFile(), ExportGIF(), ExportPNG(), ExportPNGToMemory()

ExportPNG()

 

This function exports a chart as a PNG image to a file.

Syntax:

INT16 PUBLIC
ExportPNG (
     GraphPtr graphPtr,
     char* file,
     UINT16 imgWidth,
     UINT16 imgHeight,
     BOOLEAN16 transBackground,
     LPGDPALETTE palettePtr
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

 

file: File where chart image will be written

 

imgWidth: Image width (in pixels)

 

imgHeight: Image height (in pixels)

 

transBackground: TRUE = Make chart background area transparent.

 

palettePtr: External Palette

Return:

INT16:

 

Value

Description

 

E00_OK =

Successful

 

Any other value =

Failure

Notes:

Your environment must provide the Freeware PNG Compression Library (LibPNG.LIB).

Also See:

ExportBMP(), ExportBMPToRamFile(), ExportGIF(), ExportGIFToMemory(), ExportPNGToMemory()

   

ExportPNGToMemory()

 

This function exports a chart as a PNG image to memory.

Syntax:

INT16 PUBLIC
ExportPNGToMemory (
     GraphPtr graphPtr,
     MEMPTR* memAddress,
     UINT32* fileSize, /* size of PNG file in memory */
     UINT16 imgWidth,
     UINT16 imgHeight,
     BOOLEAN16 transBackground,
     LPGDPALETTE palettePtr
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

 

memAddress: Pointer to a MEMPTR where the address of the PNG file in memory will be stored on return.

 

fileSize; Pointer to an unsigned 32-bit integer where the size of the PNG image will be stored on return.

 

imgWidth: Image width (in pixels)

 

imgHeight: Image height (in pixels)

 

transBackground: TRUE = Make chart background area transparent.

 

palettePtr: External Palette

Return:

INT16:

 

Value

Description

 

E00_OK =

Successful

 

Any other value =

Failure

Notes:

Your environment must provide the Freeware PNG Compression Library (LibPNG.LIB).

Also See:

ExportBMP(), ExportBMPToRamFile(), ExportGIF(), ExportGIFToMemory(), ExportPNG()

   

SaveImageToFile()

 

This function saves an image of a graph in any file format and copies it to a file.

Syntax:

INT16 PUBLIC
SaveImageToFile(
     GraphPtr pGraph,
     INT16 nWidth,
     INT16 nHeight,
     INT16 nFormat,
     INT16 nDepth,
     INT16 nResolution,
     LPSTR szFilename
);

Input:

pGraph; Pointer to a Graph structure

 

nWidth; Width in pixels

 

nHeight; Height in pixels

 

nFormat; A value from the FileType enum:

 

FileType

Value

Description

 

EXPORT_FILE_JPEG

0=

JPEG file format

 

EXPORT_FILE_PNG

1=

PNG file format

 

EXPORT_FILE_PCT

2=

PCT file format

 

EXPORT_FILE_PCX

3=

PCX file format

 

EXPORT_FILE_PSD

4=

PSD file format

 

EXPORT_FILE_TGA

5=

TGA file format

 

EXPORT_FILE_TIF

6=

TIFF file format

 

EXPORT_FILE_BMP

7=

BMP file format

 

nDepth; Depth of image

 

nResolution; Image resolution

 

szFileName; File Name

Return:

INT16; E00_OK, ERROR_MEMORY_TOO_LOW, E00_MEM_ERROR, E00_INVALID_PARAMETER, E00_NOT_IMPLEMENTED

Notes:

This function requires the LeadTools v.11 libraries (ltdis_n.lib, ltkrn_n.lib, ltfil_n.lib)

Also See:

SaveImageToMemory()

SaveImageToMemory()

 

This function saves an image of a graph in any file format and copies it to memory.

Syntax:

INT16 PUBLIC
SaveImageToMemory(
     GraphPtr pGraph,
     INT16 nWidth,
     INT16 nHeight,
     INT16 nFormat,
     INT16 nBitDepth,
     INT16 nResolution,
     HGLOBAL * pMemory,
     UINT32 * pSize
);

Input:

pGraph; Pointer to a Graph structure

 

nWidth; Width in pixels

 

nHeight; Height in pixels

 

nFormat; A value from the FileType enum:

 

FileType

Value

Description

 

EXPORT_FILE_JPEG

0=

JPEG file format

 

EXPORT_FILE_PNG

1=

PNG file format

 

EXPORT_FILE_PCT

2=

PCT file format

 

EXPORT_FILE_PCX

3=

PCX file format

 

EXPORT_FILE_PSD

4=

PSD file format

 

EXPORT_FILE_TGA

5=

TGA file format

 

EXPORT_FILE_TIF

6=

TIFF file format

 

EXPORT_FILE_BMP

7=

BMP file format

 

nDepth; Depth of image

 

nResolution; Image resolution

 

pMemory; Memory pointer

 

pSize; Size of memory at pMemory

Return:

INT16; E00_OK, ERROR_MEMORY_TOO_LOW, E00_MEM_ERROR, E00_INVALID_PARAMETER, E00_NOT_IMPLEMENTED

Notes:

This function requires the LeadTools v.11 libraries (ltdis_n.lib, ltkrn_n.lib, ltfil_n.lib)

Also See:

SaveImageToFile()