Binary Image Library
Functions
C:/Users/Malcolm/Documents/temp/binaryimagelibrary/drawbinary.c File Reference
#include <stdlib.h>
#include <string.h>

Functions

void binaryline (unsigned char *binary, int width, int height, int x0, int y0, int x1, int y1)
 
void binarycircle (unsigned char *binary, int width, int height, int xm, int ym, int r)
 
void binaryellipse (unsigned char *binary, int width, int height, int x0, int y0, int x1, int y1)
 
void binarybezier (unsigned char *binary, int width, int height, float *x, float *y)
 
void binarycatmullrom (unsigned char *binary, int width, int height, float *x, float *y, int N)
 
int floodfill4 (unsigned char *grey, int width, int height, int x, int y, unsigned char target, unsigned char dest)
 
int floodfill8 (unsigned char *grey, int width, int height, int x, int y, unsigned char target, unsigned char dest)
 

Detailed Description

Basic drawing routines for binary images.

Unlikely to want to draw many binary images for human viewing, but the roi=utines are useful for itnermediates steps. They are also good simple reference implementations of algorithms.

Function Documentation

void binarybezier ( unsigned char *  binary,
int  width,
int  height,
float *  x,
float *  y 
)

Draw a cubic Bezier curve

Parameters
[in,out]biary- the bianry image
width- image width
height- image height
[in]x- 4 Bezier control points x
[in]y- 4 Bezier control points y
void binarycatmullrom ( unsigned char *  binary,
int  width,
int  height,
float *  x,
float *  y,
int  N 
)

Draw a Catmull-Rom curve

Parameters
void binarycircle ( unsigned char *  binary,
int  width,
int  height,
int  xm,
int  ym,
int  r 
)

Draw an open circle using quadrant mirroring

Parameters
[in,out]binary- the binary image
width- image width
height- image height
xm- origin x
ym- origin y
r- radius.

Notes: interger only algorithm

void binaryellipse ( unsigned char *  binary,
int  width,
int  height,
int  x0,
int  y0,
int  x1,
int  y1 
)

Draw an ellipse.

Parameters
void binaryline ( unsigned char *  binary,
int  width,
int  height,
int  x0,
int  y0,
int  x1,
int  y1 
)

Draw a line using Brasenham's algorithm.

Parameters
[in,out]binary- the binary image
width- image width
height- image height
x0- start x co-ordinate
y0- start y co-ordiante
x1- end x co-ordinate
y1- end y co-ordinate
int floodfill4 ( unsigned char *  grey,
int  width,
int  height,
int  x,
int  y,
unsigned char  target,
unsigned char  dest 
)

Floodfill4 - floodfill, 4 connectivity.

Parameters
[in,out]grey- the image (formally it's greyscale but it could be binary or indexed)
width- image width
height- image height
x- seed point x
y- seed point y
target- the colour to flood
dest- the colur to replace it by.
Returns
Number of pixels flooded.