Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>gwriteat()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 GWRITEAT()
 Draw graphic text without background
------------------------------------------------------------------------------
 Syntax

     GWRITEAT(<nColStart>, <nLnStart>, <cString>, [<nColor>],
        [<nMode>], [<aFont>]) --> nWidth

 Arguments

     <nColStart> and <nLnStart> define graphic text coordinates in
     pixels.

     <cString>is a character value representing the character string to
     be displayed.

     <nColor>is a numeric value representing the display color.  If the
     parameter is missing, the last color specified in a call to a CA-Clipper
     graphic function is used.

     The range of values is limited to the number of colors available in the
     selected video mode.  In 16-color modes, valid values are between 0 and
     15.  In 256-color modes, valid values are between 0 and 255.

     <nMode> is a numeric value representing the display mode.  The
     following are valid <nMode> values.  They are all #defines in
     Llibg.ch.Display color

     Display Mode Constants
     ------------------------------------------------------------------------
     Constant       Description
     ------------------------------------------------------------------------
     LLG_MODE_SET   Display in SET mode (ignores any pixels present under the
                    line displayed).  This is the most common display mode.
     LLG_MODE_AND   Display in AND mode (executes an AND on pixels present
                    under the line at display time and on the display color).
     LLG_MODE_OR    Display in OR mode (executes an OR on pixels present
                    under the line at display time and on the display color).
     LLG_MODE_XOR   Display in XOR mode (executes an XOR on pixels present
                    under the line at display time and on the display color).
                    See note.
     LLG_MODE_NIL   Allows you to compute the width of the string without
                    displaying anything on the screen.  Be aware that .FNT
                    fonts are proportional, which means that an "m" and an
                    "i" do not use the same number of pixels.
     ------------------------------------------------------------------------

     Note:  This method allows you to move objects around on the screen
     without damaging the background.  To retrieve the initial background,
     just repeat the call for display in XOR mode.  If the display mode
     parameter is missing, the last mode specified in a call to a CA-Clipper
     graphic function is used.

     <aFont> is an optional font array pointer which was created with the
     GFNTLOAD("MyFont.FND") function:

     FUNCTION ShowOneFont (cString)
        LOCAL aFont
        // Load a specific font file into memory
        aFont := GFNTLOAD("MyFont.FND")
        // Display cString using the loaded font

           GWRITEAT(X , Y , cString, nColor, LLG_MODE_SET, aFont)
           // *Important*
           // You must erase the font if it is no longer used.
           GFNTERASE(aFont)
           RETURN   NIL

 Returns

     GWRITEAT() returns the width of the written text in pixels.

 Description

     GWRITEAT() displays text in graphic mode without affecting the
     background.  It is important not to confuse the functions DEVOUT() and
     GWRITEAT().  Even when you are in graphic mode, you should continue to
     use DEVPOS(), DEVOUT(), and QOUT() for all "normal" displays.  The
     functions related to GETs, TBROWSE, etc. use both foreground and
     background colors, and text can only be displayed in areas whose size is
     a multiple of the selected font size.

 Notes

     GWRITEAT() should be used for graphic enhancements, such as a window
     title within its frame (as you do not want to overwrite the window
     frame's borders), or to display information in graphic areas where you
     want to explicitly handle whether or not the background is erased before
     a new display, as in adding a title to a bitmap.

     Unlike DEVOUT(), this function receives graphic coordinates only.  This
     allows you to display text pixel by pixel.  Since GWRITEAT() works with
     pixel coordinates instead of row and column coordinates, you may need to
     properly calculate nX and nY.  This function can be used only if you
     have set the screen to a graphic mode using SET VIDEOMODE().

     This function respects the constraints defined by GSETCLIP().

 Examples

     .  This example writes a see-through title on the frame of a 3-D
        box:

        // Switch to graphic mode
        SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16
        // Display a 3D box of constant width 16x16x16x16
        DISPBOX(nTop, nLeft, nBottom, nRight, LLG_BOX_GRAY_SQUARE)
        // Write the alias name transparently in the 3D frame
        GWRITEAT( nLeft * GMODE()[LLG_MODE_FONT_COL],;
        nTop  * GMODE()[LLG_MODE_FONT_ROW],;
        ALIAS(SELECT()),;
        4,;
        LLG_MODE_SET)
        QUIT                            // End of application

 Files   Library is LLIBG.LIB, header file is Llibg.ch.


See Also: GBMPDISP() GFNTLOAD() GLINE() GRECT()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson