MHEG5  15.3.0
source/graphics/src/mg_dla.inl File Reference

Dynamic Line-Art utility functions. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "dla_inl.h"
#include "glue_memory.h"
#include "glue_debug.h"
#include "mg_osd.h"
#include "mg_api.h"
#include "mh5assert.h"

Data Structures

struct  point_list_header
struct  hline
struct  hline_list
struct  S_64_BIT

Defines

#define ABS(x)   ((x) < 0 ? -(x) : (x))
#define SGN(x)   ((x) < 0 ? -1 : 1)
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define INDEX_FORWARD(index)   index = (index + 1) % vertex_list->length;
#define INDEX_BACKWARD(index)   index = (index - 1 + vertex_list->length) % vertex_list->length;
#define INDEX_MOVE(index, direction)
#define DEBUG_DLA   0

Typedefs

typedef struct point_list_header S_POINT_LIST_HEADER
typedef struct hline S_HLINE
typedef struct hline_list S_HLINE_LIST

Functions

void DLA_FUNCTION() Line (DLA_Surface *canvas, S16BIT x1, S16BIT y1, S16BIT x2, S16BIT y2, U16BIT width, DLAColor colour)
 Draw a line on the canvas.
void DLA_FUNCTION() Polygon (DLA_Surface *canvas, S_POLYGON poly, U16BIT width, DLAColor fill_colour, DLAColor line_colour)
 Draw a polygon on the canvas.
void DLA_FUNCTION() Polyline (DLA_Surface *canvas, S_POLYGON poly, U16BIT width, DLAColor colour)
 Draw a polyline (sequence of connected lines) on the canvas.
void DLA_FUNCTION() Rectangle (DLA_Surface *canvas, S16BIT x1, S16BIT y1, S16BIT x2, S16BIT y2, U16BIT x_lw, U16BIT y_lw, DLAColor fill_colour, DLAColor line_colour)
 Draw a rectangle on the canvas.
void DLA_FUNCTION() Ellipse (DLA_Surface *canvas, S16BIT x, S16BIT y, U16BIT w, U16BIT h, U16BIT width, DLAColor fill_colour, DLAColor line_colour)
 Draw an ellipse ("oval") on the canvas.
void DLA_FUNCTION() Arc (DLA_Surface *canvas, S16BIT x, S16BIT y, U16BIT w, U16BIT h, U16BIT start, U16BIT arc, U16BIT width, DLAColor colour)
 Draw an arc on the canvas.
void DLA_FUNCTION() Sector (DLA_Surface *canvas, S16BIT x, S16BIT y, U16BIT w, U16BIT h, U16BIT start, U16BIT arc, U16BIT width, DLAColor fill_colour, DLAColor line_colour)
 Draw a sector ("pie slice") on the canvas.
void DLA_FUNCTION() Border (DLA_Surface *canvas, U16BIT x1_bw, U16BIT y1_bw, U16BIT x2_bw, U16BIT y2_bw, DLAColor line_colour)
 Draw a border around the canvas.

Detailed Description

Dynamic Line-Art utility functions.

Date:
10th July 2008
Author:
Adam Sturtridge

Define Documentation

#define INDEX_MOVE (   index,
  direction 
)
Value:
if (direction > 0)                                                   \
      index = (index + 1) % vertex_list->length;                        \
   else                                                                 \
      index = (index - 1 + vertex_list->length) % vertex_list->length;

Function Documentation

void DLA_FUNCTION() Arc ( DLA_Surface canvas,
S16BIT  x,
S16BIT  y,
U16BIT  w,
U16BIT  h,
U16BIT  start,
U16BIT  arc,
U16BIT  width,
DLAColor  colour 
)

Draw an arc on the canvas.

Parameters:
S16BITx Left position of bounding rect
S16BITy Top position of bounding rect
U16BITw Width of bounding rect
U16BITh Height of bounding rect
U16BITstart Start angle in 64ths of a degree
U16BITarc Arc angle in 64ths of a degree
U16BITwidth Width of ellipse outline
DLAColorcolour Colour to use for arc
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Border ( DLA_Surface canvas,
U16BIT  x1_bw,
U16BIT  y1_bw,
U16BIT  x2_bw,
U16BIT  y2_bw,
DLAColor  line_colour 
)

Draw a border around the canvas.

Parameters:
U16BITx1_bw left horizontal border width
U16BITy1_bw top vertical border width
U16BITx2_bw right horizontal border width
U16BITy2_bw bottom vertical border width
DLAColorline_colour Colour to use for border
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Ellipse ( DLA_Surface canvas,
S16BIT  x,
S16BIT  y,
U16BIT  w,
U16BIT  h,
U16BIT  width,
DLAColor  fill_colour,
DLAColor  line_colour 
)

Draw an ellipse ("oval") on the canvas.

Parameters:
S16BITx Left position of bounding rect
S16BITy Top position of bounding rect
U16BITw Width of bounding rect
U16BITh Height of bounding rect
U16BITwidth Width of ellipse outline
DLAColorfill_colour Colour to use for filling
DLAColorline_colour Colour to use for outline
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Line ( DLA_Surface canvas,
S16BIT  x1,
S16BIT  y1,
S16BIT  x2,
S16BIT  y2,
U16BIT  width,
DLAColor  colour 
)

Draw a line on the canvas.

Parameters:
S16BITx1 x-coordinate of first point
S16BITy1 y-coordinate of first point
S16BITx2 x-coordinate of second point
S16BITy2 y-coordinate of second point
U16BITwidth Width of line in pixels
DLAColorcolour Colour for line
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Polygon ( DLA_Surface canvas,
S_POLYGON  poly,
U16BIT  width,
DLAColor  fill_colour,
DLAColor  line_colour 
)

Draw a polygon on the canvas.

Parameters:
S_POINT* points List of points
U16BITnum_points Number of points in list
U16BITwidth Width of polygon outline
DLAColorfill_colour Colour to use for filling
DLAColorline_colour Colour to use for outline
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Polyline ( DLA_Surface canvas,
S_POLYGON  poly,
U16BIT  width,
DLAColor  colour 
)

Draw a polyline (sequence of connected lines) on the canvas.

Parameters:
S_POINT* points List of points
U16BITnum_points Number of points in list
U16BITwidth Width of lines in polyline
DLAColorcolour Colour to use for lines
Returns:
BOOLEAN Success status of operation
void DLA_FUNCTION() Rectangle ( DLA_Surface canvas,
S16BIT  x1,
S16BIT  y1,
S16BIT  x2,
S16BIT  y2,
U16BIT  x_lw,
U16BIT  y_lw,
DLAColor  fill_colour,
DLAColor  line_colour 
)

Draw a rectangle on the canvas.

Parameters:
S16BITx1 Left position of rectangle
S16BITy1 Top position of rectangle
S16BITx2 Right position of rectangle
S16BITy2 Bottom position of rectangle
U16BITx_lw horizontal outline width
U16BITy_lw vertical outline width
DLAColorfill_colour Colour to use for filling
DLAColorline_colour Colour to use for outline
Returns:
BOOLEAN Success status of operation 8 pixels high and 8 pixels wide rectangle.
void DLA_FUNCTION() Sector ( DLA_Surface canvas,
S16BIT  x,
S16BIT  y,
U16BIT  w,
U16BIT  h,
U16BIT  start,
U16BIT  arc,
U16BIT  width,
DLAColor  fill_colour,
DLAColor  line_colour 
)

Draw a sector ("pie slice") on the canvas.

Parameters:
S16BITx Left position of bounding rect
S16BITy Top position of bounding rect
U16BITw Width of bounding rect
U16BITh Height of bounding rect
U16BITstart Start angle in 64ths of a degree
U16BITarc Arc angle in 64ths of a degree
U16BITwidth Width of ellipse outline
DLAColorfill_colour Colour to use for filling
DLAColorline_colour Colour to use for outline
Returns:
BOOLEAN Success status of operation the sector is not rendered properly.
 All Data Structures Files Functions Variables Typedefs Defines