[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

In addition to setfont(), there are three rastport control functions that
set attributes for text rendering:

    void SetAPen( struct RastPort *rp, ULONG pen );
    void SetBPen( struct RastPort *rp, ULONG pen );
    void SetDrMd( struct RastPort *rp, ULONG drawMode );

The color of the text depends upon the rastport's current drawing mode and
pen colors.  You set the draw mode with the setdrmd() function passing it
a pointer to a rastport and a drawing mode: jam1, jam2, complement or
inverseid.

If the drawing mode is jam1, the text will be rendered in the
rastport.fgpen color.  wherever there is a set bit in the character's
bitmap image, text() will set the corresponding bit in the rastport to the
FgPen color.  This is known as overstrike mode.  You set the FgPen color
with the setapen() function by passing it a pointer to the rastport and a
color number.

If the drawing mode is set to jam2, text() will place the fgpen color as
in the jam1 mode, but it will also set the bits in the rastport to the
rastport.bgpen color wherever there is a corresponding cleared bit in the
character's bitmap image.  Basically, this prints the character themselves
in the FgPen color and fills in the surrounding parts of the character
image with the BgPen color.   You set the BgPen color with the setbpen()
function by passing it a pointer to the rastport and a color number.

If the drawing mode is complement, for every bit set in the character's
bitmap image, the corresponding bits in the rastport (in all of the
rastport's bitplanes) will have their state reversed.  cleared bits in the
character's bitmap image have no effect on the destination rastport.  As
with the other drawing modes, the write mask can be used to protect
certain bitplanes from being modified (see the "graphics primitives"
chapter for more details).

The jam1, jam2, and complement drawing modes are mutually exclusive of
each other but each can be modified by the inversvid drawing mode.  if you
combine any of the drawing modes with INVERSVID, the Amiga will reverse
the state of all the bits in the source drawing area before writing
anything into the rastport.

The idea of using a rastport structure to hold all the rendering
attributes is convenient if the rastport's drawing attributes aren't going
to change much.  This is not the case where several processes need to
render into a rastport using very different drawing attributes.  An easy
way around this problem is to clone the RastPort.  By making an exact
duplicate of a RastPort, you can change the various rendering parameters
of your RastPort without effecting other programs that render into the
RastPort you cloned.  Because a RastPort only contains a pointer to the
rendering area (the bitmap), the original RastPort and the cloned RastPort
both render into the bitmap, but they can use different drawing parameters
(font, drawing mode, colors, etc.).