// The blocks API is needed if you want to display your owns BitMaps using
// the Light Lib Graphics system. A classical example is displaying incoming
// faxes ...
//
// The Block functions are compatible with the Exclusions and Inclusion areas.
//
// Be carefull using this API. We suggest you first study the sample code.
// You are responsible for all the memory allocations (lpPalette, lpStrip,
// lpUsedLUT... ).
//
// Because most of the BitMaps are greater than 64Kb, this will end with some
// stripping algo. Again, look in the code sample, a full stripping algo is
// available (In fact the sample is very close to the _gBmpDisp() function).
typedef struct
{
int iWidth; // Image Width
int iHeight; // Image Height
BYTE bBitsPerPixel; // BitsPerPixels (1|4|8|24)
int iBytesPerLine; // Byte/Line (ex width=23 in 8 bits means 3 Bytes)
LLG_LPPALETTE lpPalette; // Pointer on a palette structure
BYTEP lpStrip; // Image Data
BYTEP lpMask; // Used only for ICON , NULL Default
} LLG_BLOCK;
typedef LLG_BLOCK far * LLG_LPBLOCK;
DWORD
_gBlockPut
(
LLG_LPBLOCK lpBlock, // Pointer to a block structure
BYTEP lpUsedLUT, // Pointer to a Look Up Table (made with _gExclLUTMake or _gSharedLUTMake)
int iDstX1, // ─┐ Destination coordinates
int iDstY1, // ─┘ on the screen
int iSrcX1, // ─┐
int iSrcY1, // │ Rectangle of image (Block) to
int iSrcX2, // │ be displayed
int iSrcY2 // ─┘
);
DWORD
_gBlockGet
(
LLG_LPBLOCK lpBlock, // Pointer to an empty LLG_LPBLOCK, except lpStrip which must point on a such a large memory area to be able to store datas (see gBlockSize)
int iSrcX1, // ─┐ Screen rectangle.
int iSrcY1, // │ Warning if the result is more than
int iSrcX2, // │ 64K you are responsible for use
int iSrcY2 // ─┘ multiples calls to this function and create a stripping algo
);
// Palettes are usefull only for 16 and 256 colors video mode regardless the
// number of colors in your image.
//
// Palettes are not needed in RGB modes.
//
// 3 modes are available to display : Overwrite, Exclusive, Shared.
//
// In 16 colors mode , Overwrite : replace the 16 original colors with
// your image palette.
//
// , Exclusive and Shared :give the same effect, and try to
// find the nearest colors in the
// system palette corresponding to
// your image palette.
//
// In 256 colors mode, Overwrite : replace the 256 original colors with your
// image palette
// , Exclusive : the first 16 colors are preserved, and the
// next 240 colors match the first 240 colors of
// your image, the last 16 will be mapped
// to the nearest colors available
// , Shared : the first 16 colors are preserved, and the
// next 240 colors come from a standard
// linear color/grayscale palette.
// Each color of your image is mapped to the
// nearest color in this linear palette. As
// this shared palette is fixed it is possible
// to display multiple 256 colors images in a
// 256 color screen at the same time.
// 3 ways to display :
// - Overwrite : generally used in full screen display, No LUT needed,
// : just use a _gPalSet() to set the colors of the screen
// : and pass NULL for lpUsedLUT in the _gBlockPut()
// - Exclusive Pal : Preserve the first 16 colors (text display and ICO/BMP).
// : Call _gExclLUTMake() to create the look up table.
// - Shared Palette : Preserve the first 16 colors (text display and ICO/BMP).
// : Call _gSharedLUTMake() to create the look up table.
// :
// :
// What happens when the number of colors in the image and the number of colors
// in the display are not the same ?
// If the number of colors in the image is smaller (ex 16) than the number of
// colors in the display (ex 256), it is quite easy and the displayed image is
// good.
//
// If the number of colors in the image is greater (ex 256) than the number of
// colors in the display (ex 16) , the 256 colors are mapped to the nearest 16
// colors available and the displayed image will be poor.
//
// Be aware that B&W images (1 bit) can have a palette. This allows reversed B&W
// or W&B images (common problem with faxes).
BYTEP
_gExclLUTMake // Return a lpLUT used by _gBlockPut
// _gExclPalSet must be used
( //
LLG_LPPALETTE lpPalette, // A palette structure filled with the image values
BYTEP lpLUT // Pointer to n Bytes, n is the number of colors of the palette
); //
//
BYTEP
_gSharedLUTMake // Return a lpLUT used by _gBlockPut
// _gSharedPalSet must be used
(
LLG_LPPALETTE lpPalette, // A palette structure filled with the image values
BYTEP lpLUT // Pointer to n Bytes, n is the number of colors of the palette
); //
void
_gExclPalSet // Set Exclusive Palette
// ( preserve 16 first colors )
// Used before a _gBlockPut
(
LLG_LPPALETTE lpPalette
);
void
_gSharedPalSet // Set Shared Palette ( by default )
// Used before a _gBlockPut
(
void // No pointer needed as the palette is available in LLG