Insert_Compressed_Image

Functions

HC_KEY DInsert_Compressed_Image (double x, double y, double z, const char *format, int width, int height, int size, const void *data)
 Similar to Insert_Compressed_Image(), but operates on double-precision data. More...
 
HC_KEY Insert_Compressed_Image (double x, double y, double z, const char *format, int width, int height, int size, const void *data)
 Inserts a compressed pixel-based image in the HOOPS database. More...
 

Detailed Description

Function Documentation

◆ DInsert_Compressed_Image()

HC_KEY DInsert_Compressed_Image ( double  x,
double  y,
double  z,
const char *  format,
int  width,
int  height,
int  size,
const void *  data 
)

Similar to Insert_Compressed_Image(), but operates on double-precision data.

Parameters
x- The x-coordinate of the center of the image.
y- The y-coordinate of the center of the image.
z- The z-coordinate of the center of the image.
format- A description of how data in the data array is packed
width- The number of columns of pixels in this image. For TGA or JPEG images of unknown width, -1 can be used as an indication that HOOPS should derive the dimensions by decoding the data.
height- The number of rows of pixels in this image. For TGA or JPEG images of unknown height, -1 can be used as an indication that HOOPS should derive the dimensions by decoding the data.
size- The number of bytes required to hold the compressed data.
data- An array of bytes, packed in accordance with format, that describes the colors of each pixel in the image.
\return The key to the inserted geometry.

◆ Insert_Compressed_Image()

HC_KEY Insert_Compressed_Image ( double  x,
double  y,
double  z,
const char *  format,
int  width,
int  height,
int  size,
const void *  data 
)

Inserts a compressed pixel-based image in the HOOPS database.

Parameters
x- The x-coordinate of the center of the image.
y- The y-coordinate of the center of the image.
z- The z-coordinate of the center of the image.
format- A description of how data in the data array is packed
width- The number of columns of pixels in this image. For TGA or JPEG images of unknown width, -1 can be used as an indication that HOOPS should derive the dimensions by decoding the data.
height- The number of rows of pixels in this image. For TGA or JPEG images of unknown height, -1 can be used as an indication that HOOPS should derive the dimensions by decoding the data.
size- The number of bytes required to hold the compressed data.
data- An array of bytes, packed in accordance with format, that describes the colors of each pixel in the image.
\return The key to the inserted geometry.
Supported Options:
discard, down-sample, grayscale, local, name, mapped 16, mapped 8, mapped, RGB, RGBA, size, jpg, tga, dxt1, dxt3, dxt5, compression quality, texture options,

DETAILS

This API has the same capabilities as Insert_Compressed_Image but additionally allows you to insert images which are already in a compressed form. JPEG, TGA and the DXT1, DXT3 and DXT5 formats are the only currently supported compression schemes.

The following choices for "format" are:

discard
If set, then the image data will be purged from the HOOPS data once the texture is loaded into video memory. This will result in the memory associated with that image being returned to the system. Note, the image database item will remain in the HOOPS database and can be returned to the user via a call to Show_Image().

[no] down-sample
If this is set, images will have a bilinear filter applied to them. This typically makes images look smoother, especially if zoomed in. However, if there are hard edges (e.g. a checker board) it can make the image look unnecessarily blurry. Default = "down-sample"

grayscale
Treats data as a two-dimensional array of single byte entries where each byte defines the luminance of the pixel.

[no] local
If set, the implicit texture created will be local to the currently open segment. Default = "no local"
name = <identifier>
The name which will be applied to the texture that will be implicitly defined with the options specified in 'texture options'. Providing no texture option string will mean that a texture is then created with default texture options. If you do not want an implicitly texture created you should not provide a name to the image.
mapped 16
Treats data as a two-dimensional array of 16-bit color map indices (two consecutive bytes per pixel). The byte ordering within data is identical to casting an array of short integers. The pixel values defined here are not full-fledged HOOPS color triplets or strings; they are just look-up indices. This lets you "color by number", while the actual colors are defined indirectly by the current "Color Map" attribute. You must define an appropriate color map to match your image. Also, the color look-up is performed at Update time, not just at declaration time—changes to the color map will be reflected in the appearance of images that already exist.
mapped 8
Identical to "mapped 16", but treats data as a two-dimensional array of 8-bit color map indices.

mapped
"Mapped" is a convenience synonym for "mapped 8".
RGB
Treats data as a two-dimensional array of pixels, where each pixel's color is described by three bytes: one for the red, green, and blue intensities. The first three bytes in data describe the red, green, and blue components of the upper-left-most image pixel. The following three data bytes describe the next pixel to the right. The next scan line begins at (width*3) in the array. When using RGB formatted images on color-mapped devices (such as 8-bit plane displays), HOOPS will "dither" the image using fixed colors. The larger a fixed color table you choose via Set_Driver_Options() , the more accurate the dither will be. If you plan on using the virtual "image driver", you must select the RGB format for the image into which the driver will draw. For full information on scan-converting into a HOOPS image, see the "Image Driver" section of your installation guide.
RGBA
Treats data as a two-dimensional array of pixels, where each pixel's color is described by four bytes: one for each of the red, green, and blue intensities, along with one for alpha. A non-zero alpha value indicates that the pixel is illuminated using the RGB. The layout of the data matches that of RGB with the exception that four instead of three bytes per pixel are used.
size = ((float) width units, (float) height units)
size = <float> units

Scale for an image where units is either "oru", "sru" or "pixels". "size = &lt;float&gt; units" will preserve aspect ratio.
jpg
The image in the data array is compressed in JPEG form.

tga
The image in the data array is compressed in TGA form. Color mapped TGA images are not supported.

dxt1
The image in the data array is compressed in DXT1 form.

dxt3
The image in the data array is compressed in DXT3 form.

dxt5
The image in the data array is compressed in DXT5 form.

compression quality = <float>
Compression quality is a floating point value between 0 and 1. This option will allow HOOPS to choose from one of the compression schemes offered by the underlying hardware drivers. This option can be ignored depending on the capabilities of the underlying hardware. The default will be 1, i.e. no compression.

texture options = (...)
Options for the implicit texture created for the image. See Define_Texture() for the list of recognized options.

NOTES

TGA and JPEG images are the only compressed image types that can be modified via Edit_Image. Editing either of these will result in it being converted to an uncompressed form. You cannot use compressed images for render to image purposes (i.e. in situations where the image key is passed to "use window ID").

See also
Edit_Image, Show_Compressed_Image, Define_Texture.