⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph.h

📁 freetype库的应用demo,里面包含freetype的很多实例
💻 H
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************** * *  graph.h * *    Graphics Subsystem interface * *  Copyright 1999, 2000, 2001, 2002 *     - The FreeType Development Team - www.freetype.org * ***************************************************************************/#ifndef GRAPH_H#define GRAPH_H#include "grevents.h" /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /********                                                         ********/ /********         GENERAL DEFINITIONS AND BLITTING ROUTINES       ********/ /********                                                         ********/ /********                                                         ********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/  /* define the global error variable */  extern int  grError;  /* initialisation */  extern int  grInit( void );  /* finalisation */  extern void grDone( void );  /* pixel mode constants */  typedef enum grPixelMode  {    gr_pixel_mode_none = 0,    gr_pixel_mode_mono,        /* monochrome bitmaps               */    gr_pixel_mode_pal4,        /* 4-bit paletted - 16 colors       */    gr_pixel_mode_pal8,        /* 8-bit paletted - 256 colors      */    gr_pixel_mode_gray,        /* 8-bit gray levels                */    gr_pixel_mode_rgb555,      /* 15-bits mode - 32768 colors      */    gr_pixel_mode_rgb565,      /* 16-bits mode - 65536 colors      */    gr_pixel_mode_rgb24,       /* 24-bits mode - 16 million colors */    gr_pixel_mode_rgb32,       /* 32-bits mode - 16 million colors */    gr_pixel_mode_lcd,         /* horizontal RGB-decimated         */    gr_pixel_mode_lcdv,        /* vertical RGB-decimated           */    gr_pixel_mode_lcd2,        /* horizontal BGR-decimated         */    gr_pixel_mode_lcdv2,       /* vertical BGR-decimated           */    gr_pixel_mode_max          /* don't remove */  } grPixelMode;  /* forward declaration of the surface class */  typedef struct grSurface_     grSurface; /*********************************************************************  *  * <Struct>  *   grBitmap  *  * <Description>  *   a simple bitmap descriptor  *  * <Fields>  *   rows   :: height in pixels  *   width  :: width in pixels  *   pitch  :: + or - the number of bytes per row  *   mode   :: pixel mode of bitmap buffer  *   grays  :: number of grays in palette for PAL8 mode. 0 otherwise  *   buffer :: pointer to pixel buffer  *  * <Note>  *   the 'pitch' is positive for downward flows, and negative otherwise  *   Its absolute value is always the number of bytes taken by each  *   bitmap row.  *  *   All drawing operations will be performed within the first  *   "width" pixels of each row (clipping is always performed).  *  ********************************************************************/  typedef struct grBitmap_  {    int             rows;    int             width;    int             pitch;    grPixelMode     mode;    int             grays;    unsigned char*  buffer;  } grBitmap;  typedef long   grPos;  typedef char   grBool;  typedef struct grVector_  {    grPos  x;    grPos  y;  } grVector;  typedef union grColor_  {    long           value;    unsigned char  chroma[4];  } grColor; /**********************************************************************  *  * <Function>  *    grNewBitmap  *  * <Description>  *    creates a new bitmap  *  * <Input>  *    pixel_mode   :: the target surface's pixel_mode  *    num_grays    :: number of grays levels for PAL8 pixel mode  *    width        :: width in pixels  *    height       :: height in pixels  *  * <Output>  *    bit          :: descriptor of the new bitmap  *  * <Return>  *    Error code. 0 means success.  *  * <Note>  *    This function really allocates a pixel buffer, zero it, then  *    returns a descriptor for it.  *  *    Call grDoneBitmap when you're done with it..  *  **********************************************************************/  extern  int  grNewBitmap( grPixelMode  pixel_mode,                            int          num_grays,                            int          width,                            int          height,                            grBitmap    *bit ); /**********************************************************************  *  * <Function>  *    grBlitGlyphToBitmap  *  * <Description>  *    writes a given glyph bitmap to a target surface.  *  * <Input>  *    target  :: handle to target bitmap  *    glyph   :: handle to source glyph bitmap  *    x       :: position of left-most pixel of glyph image in target surface  *    y       :: position of top-most pixel of glyph image in target surface  *    color   :: color to be used to draw a monochrome glyph  *  * <Return>  *   Error code. 0 means success  *  * <Note>  *   There are only two supported source pixel modes : monochrome  *   and gray. The 8-bit images can have any number of grays between  *   2 and 128, and conversions to the target surface is handled  *   _automatically_.  *  *   Note however that you should avoid blitting a gray glyph to a gray  *   bitmap with fewer levels of grays, as this would much probably  *   give unpleasant results..  *  *   This function performs clipping  *  **********************************************************************/  extern int  grBlitGlyphToBitmap( grBitmap*  target,                       grBitmap*  glyph,                       grPos      x,                       grPos      y,                       grColor    color ); /**********************************************************************  *  * <Function>  *    grFillRectangle  *  * <Description>  *    this function is used to fill a given rectangle on a surface  *  * <Input>  *    surface :: handle to target surface  *    x       :: x coordinate of the top-left corner of the rectangle  *    y       :: y coordinate of the top-left corner of the rectangle  *    width   :: rectangle width in pixels  *    height  :: rectangle height in pixels  *    color   :: fill color  *  **********************************************************************/  extern void  grFillRectangle( grBitmap*  surface,                                grPos      x,                                grPos      y,                                grPos      width,                                grPos      height,                                grColor    color ); /**********************************************************************  *  * <Function>  *    grWriteCellChar  *  * <Description>  *    The graphics sub-system contains an internal Latin1 8x8 font  *    which can be used to display simple strings of text without  *    using FreeType.  *  *    This function writes a single 8x8 character on the target bitmap.  *  * <Input>  *    target   :: handle to target surface  *    x        :: x pixel position of character cell's top left corner  *    y        :: y pixel position of character cell's top left corner  *    charcode :: Latin-1 character code  *    color    :: color to be used to draw the character  *  **********************************************************************/  extern  void  grWriteCellChar( grBitmap*  target,                         int        x,                         int        y,                         int        charcode,                         grColor    color ); /**********************************************************************  *  * <Function>  *    grWriteCellString  *  * <Description>  *    The graphics sub-system contains an internal Latin1 8x8 font  *    which can be used to display simple strings of text without  *    using FreeType.  *  *    This function writes a string with the internal font  *  * <Input>  *    target       :: handle to target bitmap  *    x            :: x pixel position of string's top left corner  *    y            :: y pixel position of string's top left corner  *    string       :: Latin-1 text string  *    color        :: color to be used to draw the character  *  **********************************************************************/  extern  void  grWriteCellString( grBitmap*   target,                           int         x,                           int         y,                           const char* string,                           grColor     color ); /**********************************************************************  *  * <Function>  *    grDoneBitmap  *  * <Description>  *    destroys a bitmap  *  * <Input>  *    bitmap :: handle to bitmap descriptor  *  * <Note>  *    This function does NOT release the bitmap descriptor, only  *    the pixel buffer.  *  **********************************************************************/  extern  void  grDoneBitmap( grBitmap*  bit ); /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /********                                                         ********/ /********         DEVICE-SPECIFIC DEFINITIONS AND ROUTINES        ********/ /********                                                         ********/ /********                                                         ********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/  /* forward declaration - the definition of grDevice is not visible */  /* to clients..                                                    */  typedef struct grDevice_  grDevice; /**********************************************************************  *  * <Struct>  *    grDeviceChain  *  * <Description>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -