Raster Image Home

Raster images consist of a rectangular grid (or raster) of small squares or dots known as pixels. LiteCAD does not keep raster images stored inside of its file format. It only keeps a reference to the name of the image file which is inserted into the drawing.
Litecad.dll internally supports only Windows BMP format, but if the Litecad.dll directory contains the FreeImage.dll file (http://freeimage.sourceforge.net), it will be used to load many various raster formats (jpeg, tiff, gif, png, etc...). Note that the FreeImage.dll file works as a plugin, and LiteCAD can work without it, therefore redistribute this file only if your LiteCAD-based application requires support for various raster image formats.
In order a raster image become visible in a drawing, in a certain place, with certain scale and rotation, you have to add an image reference object.

These are the functions used to manage raster images in a drawing:

Function Meaning
lcDrwAddImage Adds a new image (from a file) into a drawing
lcDrwAddImage2 Adds a new image (bitmap) into a drawing
lcDrwAddImage3 Adds a new image (as a copy from bitmap) into a drawing

lcDrwDeleteObject Deletes an object from a drawing
lcDrwCountObjects Counts a number of objects, by type
lcDrwSortObjects Sorts objects by LC_PROP_TABLE_PRIORITY
Used to sequentially retrieve all objects
lcDrwGetObjectByName Retrieves an object by its name
Retrieves object by its identifier

Image functions:

Function Meaning
lcImageSetPixelRGB Sets RGB color of image pixel
lcImageSetPixelI Sets color index of image pixel
lcImageGetPixelRGB Retrieves RGB color of image pixel
lcImageGetPixelI Retrieves color index of image pixel
lcImageSetPalColor Sets palette color
lcImageGetPalColor Retrieves palette color
lcImageLoad Loads an image from a file

Raster image object has the following properties:

Property Type Access Meaning
LC_PROP_TABLE_...    Base class properties
R Unique Identifier
Hexadecimal string (up to 16 characters)
LC_PROP_IMAGE_NAME string RW Image name
LC_PROP_IMAGE_DESCR string RW Image description
LC_PROP_IMAGE_DRW handle R Handle to owner drawing
LC_PROP_IMAGE_FILENAME string RW Image filename
LC_PROP_IMAGE_SIZE int R Image size, bytes
LC_PROP_IMAGE_WPIX int R Image width (pixels)
LC_PROP_IMAGE_HPIX int R Image height (pixels)
LC_PROP_IMAGE_CBIT int R Number of color bits
LC_PROP_IMAGE_RGB bool R If true, then image has RGB colors,
if false, then image has palette colors
LC_PROP_IMAGE_EMBEDDED bool RW If true, then image will be saved inside a drawing
LC_PROP_IMAGE_CREATED bool R Flag "Image was created programmaticaly" (by lcDrwAddImage2)
LC_PROP_IMAGE_COLORS handle RW Pointer to a color palette (RGBQUAD*)
LC_PROP_IMAGE_BITS handle RW Pointer to a bitmap memory (BYTE*). The memory size is LC_PROP_IMAGE_SIZE

See also

  Named objects