Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

gfxcore.h File Reference

#include "bitmap.h"
#include "gfxfont.h"

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  Graphics
 Structure to hold information about a graphics context. More...


Defines

#define GFX_SCRATCH_SIZE   2048
 Scratch memory for internal use.


Typedefs

typedef Graphics Graphics
 Structure to hold information about a graphics context.


Functions

void GFX_Init (Graphics *gfx, Bitmap *bm)
void GFX_Init (Graphics *gfx, Graphics *gfx2)
 Copy a graphics context structure.

void GFX_SetFont (Graphics *gfx, Font *font)
 Set the current font.

void GFX_SetFillStyle (Graphics *gfx, char *style)
 Set the current fillStyle.

void GFX_SetColor (Graphics *gfx, int color)
void GFX_SetBlitMode (Graphics *gfx, int mode)
void GFX_MoveRel (Graphics *gfx, int dx, int dy)
 Move the current position by (dx,dy).

void GFX_MoveTo (Graphics *gfx, int x, int y)
 Set the current position to (x,y).

void GFX_HLine (Graphics *gfx, int x, int y, int w)
 Draw a horizontal line.

void GFX_VLine (Graphics *gfx, int x, int y, int h)
 Draw a vertical line.

void GFX_Line (Graphics *gfx, int x1, int y1, int x2, int y2)
 Draw a line using the bresenham algorithm.

void GFX_LineRel (Graphics *gfx, int dx, int dy)
 Draw a line relative from the current position.

void GFX_LineTo (Graphics *gfx, int x, int y)
 Draw a line from the current position to (x,y) and set (x,y) to be the new current position.

void GFX_Circle (Graphics *gfx, int xc, int yc, int r)
 Draw a circle.

void GFX_Rectangle (Graphics *gfx, int x, int y, int w, int h)
 Draws a rectangle with upper left corner at (x,y) and with width w and height h.

void GFX_FillRect (Graphics *gfx, int x, int y, int w, int h)
 Draw a filled rectangle.


Variables

Bitmap_gfx_scratch
char emptyFill []
 fillStyles

char solidFill []
char lineFill []
char ltSlashFill []
char slashFill []
char bkSlashFill []
char ltBkSlashFill []
char hatchFill []
char xHatchFill []
char xLeaveFill []
char wDotFill []
char cDotFill []


Define Documentation

#define GFX_SCRATCH_SIZE   2048
 

Scratch memory for internal use.

Definition at line 11 of file gfxcore.h.


Typedef Documentation

typedef struct Graphics Graphics
 

Structure to hold information about a graphics context.


Function Documentation

void GFX_Circle Graphics   gfx,
int    xc,
int    yc,
int    r
 

Draw a circle.

Parameters:
gfx  Graphics context to use.
xc,yc  coordinates of center point.
r  radius (in pixels)

Definition at line 416 of file gfxcore.cpp.

References Graphics::bitmap, BM_PutPixel(), and Graphics::color.

void GFX_FillRect Graphics   gfx,
int    x,
int    y,
int    w,
int    h
 

Draw a filled rectangle.

Parameters:
gfx  Graphics context to use.
x, y  coordinates for top-left corner
w, h  width and height
Bug:
the fillpattern does not move correctly, when clipped at the left or top border.

Definition at line 449 of file gfxcore.cpp.

References Graphics::bitmap, Graphics::blitMode, BM_FastBlit(), Bitmap::bmBits, Graphics::fillStyle, Bitmap::height, src, and Bitmap::width.

Referenced by GFX_ProgressBar().

void GFX_HLine Graphics   gfx,
int    x,
int    y,
int    w
 

Draw a horizontal line.

Note:
use this function directly instead of calling line whenever possible!

Definition at line 150 of file gfxcore.cpp.

References Graphics::bitmap, Bitmap::bmBits, Graphics::color, Bitmap::height, and Bitmap::width.

Referenced by GFX_Line(), GFX_Rectangle(), and GFX_RoundRect().

void GFX_Init Graphics   gfx,
Graphics   gfx2
 

Copy a graphics context structure.

This function is quite useful for creating a temporary context inside a drawing function. So You can change drawing modes without modifying the original context.

Parameters:
gfx  Pointer to Graphics structure.
bm  Pointer to Bitmap to work on.

Definition at line 81 of file gfxcore.cpp.

Referenced by GFX_ProgressBar(), and gfxTest().

void GFX_Init Graphics   gfx,
Bitmap   bm
 

void GFX_Line Graphics   gfx,
int    x1,
int    y1,
int    x2,
int    y2
 

Draw a line using the bresenham algorithm.

Parameters:
gfx  Graphics context to use.
x1, y1, x2, y2  line coordinates.
Note:
this function is quite slow, and optimizing it would take a somewhat great effort. (subpixel-accurate cohen- sutherland clipping should be implemented, assembler versions for 4 octants * 2 drawing colors..) If you really need a faster line implementation, drop a mail to thomas.kindler@gmx.de (a nice crate of beer might be helpful ;)

Definition at line 318 of file gfxcore.cpp.

References Graphics::bitmap, BM_PutPixel(), Graphics::color, GFX_HLine(), and GFX_VLine().

Referenced by GFX_LineRel(), GFX_LineTo(), and GFX_RoundRect().

void GFX_LineRel Graphics   gfx,
int    dx,
int    dy
 

Draw a line relative from the current position.

Parameters:
gfx  Graphics context to use.
dx, dy  distance from current position.

Definition at line 366 of file gfxcore.cpp.

References GFX_Line(), Graphics::x, and Graphics::y.

void GFX_LineTo Graphics   gfx,
int    x,
int    y
 

Draw a line from the current position to (x,y) and set (x,y) to be the new current position.

Parameters:
gfx  Graphics context to use.
x, y  end coordinates.

Definition at line 381 of file gfxcore.cpp.

References GFX_Line(), Graphics::x, and Graphics::y.

void GFX_MoveRel Graphics   gfx,
int    dx,
int    dy
 

Move the current position by (dx,dy).

Definition at line 137 of file gfxcore.cpp.

References Graphics::x, and Graphics::y.

void GFX_MoveTo Graphics   gfx,
int    x,
int    y
 

Set the current position to (x,y).

Definition at line 126 of file gfxcore.cpp.

References Graphics::x, and Graphics::y.

void GFX_Rectangle Graphics   gfx,
int    x,
int    y,
int    w,
int    h
 

Draws a rectangle with upper left corner at (x,y) and with width w and height h.

Parameters:
gfx  Graphics context to use.
x, y  coordinates for top-left corner
w, h  width and height

Definition at line 398 of file gfxcore.cpp.

References GFX_HLine(), and GFX_VLine().

Referenced by GFX_ProgressBar().

void GFX_SetBlitMode Graphics   gfx,
int    mode
 

Definition at line 116 of file gfxcore.cpp.

References Graphics::blitMode.

Referenced by GFX_ProgressBar().

void GFX_SetColor Graphics   gfx,
int    color
 

Definition at line 110 of file gfxcore.cpp.

References Graphics::color.

void GFX_SetFillStyle Graphics   gfx,
char *    style
 

Set the current fillStyle.

Definition at line 104 of file gfxcore.cpp.

References Graphics::fillStyle.

Referenced by GFX_ProgressBar().

void GFX_SetFont Graphics   gfx,
Font   font
 

Set the current font.

If font is NULL, the default font is set.

Definition at line 92 of file gfxcore.cpp.

References _font_sysfont, Graphics::font, and font.

Referenced by gfxTest().

void GFX_VLine Graphics   gfx,
int    x,
int    y,
int    h
 

Draw a vertical line.

Note:
use this function directly instead of calling line whenever possible!

Definition at line 227 of file gfxcore.cpp.

References Graphics::bitmap, Bitmap::bmBits, Graphics::color, fbm, Bitmap::height, lbm, pages, and Bitmap::width.

Referenced by GFX_Line(), GFX_Rectangle(), and GFX_RoundRect().


Variable Documentation

Bitmap* _gfx_scratch
 

Definition at line 12 of file gfxcore.h.

char bkSlashFill[]
 

Definition at line 23 of file gfxcore.h.

char cDotFill[]
 

Definition at line 29 of file gfxcore.h.

char emptyFill[]
 

fillStyles

Definition at line 18 of file gfxcore.h.

char hatchFill[]
 

Definition at line 25 of file gfxcore.h.

char lineFill[]
 

Definition at line 20 of file gfxcore.h.

char ltBkSlashFill[]
 

Definition at line 24 of file gfxcore.h.

char ltSlashFill[]
 

Definition at line 21 of file gfxcore.h.

char slashFill[]
 

Definition at line 22 of file gfxcore.h.

char solidFill[]
 

Definition at line 19 of file gfxcore.h.

Referenced by GFX_Init().

char wDotFill[]
 

Definition at line 28 of file gfxcore.h.

char xHatchFill[]
 

Definition at line 26 of file gfxcore.h.

char xLeaveFill[]
 

Definition at line 27 of file gfxcore.h.


Generated on Sun Aug 4 21:47:37 2002 for k/os mp3v2 by doxygen1.2.16