SetPaletteMode(mode)
mode
argument. This mode will be used whenever the output device is palette-based,
for example a palette mode display or a palette brush.
The following modes are currently supported:
#PALETTEMODE_REMAP:
#PALETTEMODE_PEN
instead (see below). The way graphics data is remapped to a
a palette output device can be configured by calling SetDitherMode().
This allows you to enable or disable dithering and you can also specify
the dithering algorithm to use. Note that when using #PALETTEMODE_REMAP
single-color drawing functions like Box(), Circle()
or TextOut() won't draw using the drawing pen set via
SetDrawPen() but using the RGB color that is passed to
the function.
#PALETTEMODE_PEN:
#PALETTEMODE_PEN
, all palette graphics will be copied to the output
device without any pixel remapping. This is very fast but of course, it requires the
palette of the graphics object that should be drawn and the palette of the
output device to be the same or the result will have messed up colors. So if
you use #PALETTEMODE_PEN
, you should make sure that all your graphics objects
share the same palette. Furthermore, when #PALETTEMODE_PEN
is active, all
single-color drawing functions like Box(), Circle()
and TextOut() won't draw in the RGB color that you pass to them
but they will all use the drawing pen set using SetDrawPen().
The same is true for the shadow and border color: When palette mode is set to
#PALETTEMODE_PEN
, all graphics functions that support shadows and borders won't
use the color specified in SetFormStyle(), SetFontStyle()
or in standard draw tags like ShadowColor
but they will use the pens that were specified using
functions like SetShadowPen(), SetBorderPen()
or draw tags like ShadowPen
and BorderPen
.
Furthermore, antialiasing of text and graphics primitives will be disabled when
#PALETTEMODE_PEN
is active because in most cases palettes don't have enough colors for
satisfactorily anti-aliasing edges.
Note, however, that even if #PALETTEMODE_PEN
is active, RGB graphics, of course,
still have to be remapped because it's obviously impossible to draw RGB graphics
to a palette output device without remapping the RGB colors to palette pens. Thus,
drawing 32-bit true color graphics to palette output devices should be avoided because
it will always be slow because remapping needs to be done for those graphics and there
is no way around this.
The default drawing mode is #PALETTEMODE_REMAP
but it is recommended to use
#PALETTEMODE_PEN
for performance reasons. See Palette displays for details.