In a truecolor video mode the red, green, and blue components for each pixel
are packed directly into the color value, rather than using a palette lookup
table. In a 15 bit mode there are 5 bits for each color, in 16 bit modes
there are 5 bits each of red and blue and six bits of green, and both 24 and
32 bit modes use 8 bits for each color (the 32 bit pixels simply have an
extra padding byte to align the data nicely). The layout of these components
can vary depending on your hardware, but will generally either be RGB or
BGR. Since the layout is not known until you select the video mode you will
be using, you must call set_gfx_mode() before using any of the following
routines!
These functions convert colors from a hardware independent form (red,
green, and blue values ranging 0-255) into various display dependent
pixel formats. Converting to 15, 16, 24, or 32 bit formats only takes a
few shifts, so it is fairly efficient. Converting to an 8 bit color
involves searching the palette to find the closest match, which is quite
slow unless you have set up an RGB mapping table (see below).
See also:
makeacol32,
makecol,
makecol_depth,
makecol15_dither,
rgb_map,
bestfit_color,
set_color_depth.
Converts an RGBA color into a 32 bit display pixel format, which includes
an alpha (transparency) value. There are no versions of this routine for
other color depths, because only the 32 bit format has enough room to
store a proper alpha channel. You should only use RGBA format colors as
the input to draw_trans_sprite() or draw_trans_rle_sprite() after calling
set_alpha_blender(), rather than drawing them directly to the screen.
See also:
makeacol,
set_alpha_blender,
set_write_alpha_blender.
Converts colors from a hardware independent format (red, green, and blue
values ranging 0-255) to the pixel format required by the current video
mode, calling the preceding 8, 15, 16, 24, or 32 bit makecol functions as
appropriate.
See also:
makeacol,
makecol8,
makecol_depth,
makecol15_dither,
rgb_map,
set_color_depth.
Converts colors from a hardware independent format (red, green, and blue
values ranging 0-255) to the pixel format required by the specified color
depth.
See also:
makeacol,
makecol,
makecol8,
makecol15_dither,
rgb_map,
set_color_depth.
int makeacol(int r, int g, int b, int a);
Convert RGBA colors into display dependent pixel formats. In anything
less than a 32 bit mode, these are the same as calling makecol() or
makecol_depth(), but by using these routines it is possible to create 32
bit color values that contain a true 8 bit alpha channel along with the
red, green, and blue components. You should only use RGBA format colors
as the input to draw_trans_sprite() or draw_trans_rle_sprite() after
calling set_alpha_blender(), rather than drawing them directly to the
screen.
See also:
makecol,
makecol_depth,
set_alpha_blender,
set_write_alpha_blender.
Given both a color value and a pixel coordinate, calculate a dithered 15
or 16 bit RGB value. This can produce better results when reducing images
from truecolor to hicolor. In addition to calling these functions
directly, hicolor dithering can be automatically enabled when loading
graphics by calling the set_color_conversion() function, for example
set_color_conversion (COLORCONV_REDUCE_TRUE_TO_HI | COLORCONV_DITHER).
See also:
makecol,
makecol8,
set_color_conversion.
Given a color in a display dependent format, these functions extract one
of the red, green, or blue components (ranging 0-255).
See also:
geta32,
getr,
getr_depth,
makecol,
set_color_depth.
Given a color in a 32 bit pixel format, this function extracts the alpha
component (ranging 0-255).
See also:
getr8.
Given a color in the format being used by the current video mode, these
functions extract one of the red, green, blue, or alpha components
(ranging 0-255), calling the preceding 8, 15, 16, 24, or 32 bit get
functions as appropriate. The alpha part is only meaningful for 32 bit
pixels.
See also:
getr8,
getr_depth,
makecol,
set_color_depth.
Given a color in the format being used by the specified color depth,
these functions extract one of the red, green, blue, or alpha components
(ranging 0-255). The alpha part is only meaningful for 32 bit pixels.
See also:
getr,
getr8,
geta32,
makecol,
set_color_depth.
Table mapping palette index colors (0-255) into whatever pixel format is
being used by the current display mode. In a 256 color mode this just
maps onto the array index. In truecolor modes it looks up the specified
entry in the current palette, and converts that RGB value into the
appropriate packed pixel format.
See also:
set_palette,
makecol,
set_color_depth.
Constants representing the colors used to mask transparent sprite pixels
for each color depth. In 256 color resolutions this is zero, and in
truecolor modes it is bright pink (maximum red and blue, zero green).
See also:
bitmap_mask_color,
makecol,
draw_sprite,
masked_blit.
Back to contents