Watcom C Library Reference : _getfontinfo, _getgtextextent, _getgtextvector, _getimage, _getimage_w, _getimage_wxy, _getlinestyle

 

 

 

 

_getfontinfo

 

Synopsis : #include <graph.h> 

              short _FAR _getfontinfo ( struct _fontinfo _FAR *info );

 


Description : The _getfontinfo function returns information about the currently selected font. Fonts are selected with the _setfont function. The font information is returned in the _fontinfo structure indicated by the argument info. The structure contains the following fields :

 type  1 for a vector font, 0 for a bit-mapped font
 ascent  distance from top of character to baseline in pixels
 pixwidth  character width in pixels (0 for a proportional font)
 pixheight  character height in pixels
 avgwidth  average character width in pixels
 filename  name of the file containing the current font
 facename  name of the current font

 

 

Returns : The _getfontinfo function returns zero if the font information is returned successfully: otherwise a negative value is returned.

 

 

See Also : _registerfonts, _unregisterfonts, _setfont, _outgtext, _getgtextextent, _setgtextvector, _getgtextvector

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    int     width;

    struct  _fontinfo info;


    _setvideomode ( _VRES16COLOR );

    _getfontinfo ( &info );

    _moveto ( 100, 100);

    _outgtext ( "WATCOM Graphics" );

    width = _getgtextextent ( "WATCOM Graphics" );

    _rectangle( _GBORDER, 100, 100, 100 + width, 100 + info.pixheight ); 

 

    getch( );

    _setvideomode ( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_getgtextextent

 

Synopsis : #include <graph.h> 

              short _FAR _getgtextextent( char _FAR *text );

 


Description : The _getgtextextent function returns the length in pixels of the argument text as it would be displayed in the current font by the function _outgtext. Note that the text is not displayed on the screen, only its length is determined.

 

 

Returns : The _getgtextextent function returns the length in pixels of a string.

 

 

See Also : _registerfonts, _unregisterfonts, _setfont, _getfontinfo, _outgtext, _setgtextvector, _getgtextvector

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    int     width;

    struct  _fontinfo info;


    _setvideomode( _VRES16COLOR );

    _getfontinfo( &info );

    _moveto( 100, 100 );

    _outgtext( "WATCOM Graphics" );

    width = _getgtextextent ( "WATCOM Graphics" );

    _rectangle ( _GBORDER, 100, 100, 100 + width, 100 + info.pixheight ); 

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_getgtextvector

 

Synopsis : #include <graph.h> 

              struct xycoord _FAR _getgtextvector( void );

 


Description : The _getgtextvector function returns the current value of the text orientation vector, This is the direction used when text is displayed by the _outgtext function.

 

 

Returns : The _getgtextvector function returns, as an xycoord structure, the current value of the text orientation vector.

 

 

See Also : _registerfonts, _unregisterfonts, _setfont, _getfontinfo, _outgtext, _getgtextextent, _setgtextvector

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    struct xycoord old_vec;

 
    _setvideomode( _VRES16COLOR );

    old_vec = _getgtextvector( );


    setgtextvector( 0, -1 );

    moveto( 100, 100 );

    _outgtext ( "WATCOM Graphics" );

    _setgtextvector( old_vec.xcoord, old_vec.ycoord );

 

    getch( );

    setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_getimage, _getimage_w, _getimage_wxy

 

Synopsis : #include <graph.h> 

              void _FAR _getimage( short x1, short y1, short x2, short y2, char _HUGE *image );


              void _FAR _getimage_w( double x1, double y1, double x2, double y2, char _HUGE *image );


              void _FAR _getimage_wxy( struct _wxycoord _FAR *p1,
                                            struct _wxycoord _FAR *p2,

                                            char _HUGE *image );

 


Description : The _getimage functions store a copy of an area of the screen into the buffer indicated by the image argument. The _getimage function uses the view coordinate system. The _getimage_w and _getimage_wxy functions use the window coordinate system.


The screen image is the rectangular area defined by the points (x1, y1) and (x2, y2). The buffer image must be large enough to contain the image (the size of the image can be determined by using the _imagesize function). The image may be displayed upon the screen at some later time by using the _putimage functions.

 

 

Returns : The _getimage functions do not return a value.

 

 

See Also : _imagesize, _putimage

 


Example :

#include <conio.h> #include 

<graph.h> #include <malloc.h>


main( )

{
    char    *buf;

    int      y;


    _setvideomode( _VRES16COLOR );

    _ellipse( _GFILLINTERIOR, 100, 100, 200, 200 );

 

    buf = malloc( _imagesize( 100, 100, 201, 201 ) );

    if( buf != NULL) {
        _getimage( 100, 100, 201, 201, buf );

        _putimage( 260, 200, buf, _GPSET );

        _putimage( 420, 100, buf, _GPSET );

        for( y = 100; y < 300; ) {
            _putimage( 420, y, buf, _GXOR );

            y += 20;

            _putimage( 420, y, buf, _GXOR );

        }
        free( buf );

    }
   

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : _getimage - DOS, QNX 

             _getimage_w - DOS, QNX

             _getimage_wxy - DOS, QNX

 

 

 

 

 

_getlinestyle

 

Synopsis : #include <graph.h> 

              unsigned short _FAR _getlinestyle( void );

 


Description : The _getlinestyle function returns the current line-style mask. The line-style mask determines the style by which lines and arcs are drawn. The mask is treated as an array of 16 bits. As a line is drawn, a pixel at a time, the bits in this array are cyclically tested.

 

When a bit in the array is 1, the pixel value for the current point is set using the current color according to the current plotting action; otherwise, the pixel value for the point is left unchanged. A solid line would result from a value of 0xFFFF and a dashed line would result from a value of 0xF0F0. The default line style mask is 0xFFFF

 

 

Returns : The _getlinestyle function returns the current line-style mask.

 

 

See Also : _lineto, _pie, _rectangle, _polygon, _setlinestyle

 


Example :

#include <conio.h> 

#include <graph.h>


#define DASHED     0xf0f0


void main( )

{
    unsigned old_style;

 

    _setvideomode( _VRES16COLOR );

    old_style = _getlinestyle( );

    _setlinestyle ( DASHED );

    _rectangle( _GBORDER, 100, 100, 540, 380 );

    _setlinestyle( old_style );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

 

728x90
반응형
Posted by 전화카드
,