This commit is contained in:
John Cupitt 2010-09-26 15:33:58 +00:00
parent d991f177ca
commit 9330273f51
5 changed files with 41 additions and 2 deletions

5
TODO
View File

@ -3,6 +3,11 @@
still need a rect for x/y/w/h of mask, since we use it with userline and an
offset circle to draw fatlines
- im_draw_line() should clip x1/y1 x2/y2, cf. im_draw_line_user()
perhaps just put a clip in the plot thing, or have two plotters and pick the
clip one if start/end are within the image
- rename most of the inplace ops as im_draw_line() etc.

View File

@ -518,3 +518,9 @@ im_insertplace( IMAGE *main, IMAGE *sub, int x, int y )
{
return( im_draw_image( main, x, y, sub ) );
}
int
im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel )
{
return( im_draw_line( im, x1, y1, x2, y2, pel ) );
}

View File

@ -239,6 +239,8 @@ int im_flood_blob_copy( IMAGE *in, IMAGE *out, int x, int y, PEL *ink );
int im_flood_other_copy( IMAGE *test, IMAGE *mark, IMAGE *out,
int x, int y, int serial );
int im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -47,7 +47,8 @@ int im_draw_circle( IMAGE *im,
int cx, int cy, int radius, gboolean fill, PEL *ink );
int im_draw_image( IMAGE *main, int x, int y, IMAGE *sub );
int im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel );
int im_draw_line( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel );
int im_fastlineuser( IMAGE *im,
int x1, int y1, int x2, int y2,
int (*fn)(), void *client1, void *client2, void *client3 );

View File

@ -91,8 +91,33 @@
/* Draw a line on a image.
*/
/**
* im_draw_line:
* @im: image to draw on
* @x1: start point
* @y1: start point
* @x2: end point
* @y2: end point
* @ink: value to draw
*
* Draws a 1-pixel-wide line on an image. @x1, @y1 and @x2, @y2 must be
* within the image.
*
* @ink is an array of bytes
* containing a valid pixel for the image's format.
* It must have at least IM_IMAGE_SIZEOF_PEL( @im ) bytes.
*
* This an inplace operation, so @im is changed. It does not thread and will
* not work well as part of a pipeline. On 32-bit machines it will be limited
* to 2GB images.
*
* See also: im_draw_circle().
*
* Returns: 0 on success, or -1 on error.
*/
int
im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel )
im_draw_line( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel )
{
int es = IM_IMAGE_SIZEOF_ELEMENT( im );
int ps = es * im->Bands;