finish revising draw_line

This commit is contained in:
John Cupitt 2014-03-31 16:28:00 +01:00
parent d52d027c1a
commit a7e6c6e009
4 changed files with 32 additions and 17 deletions

14
TODO
View File

@ -1,21 +1,9 @@
- redo draw_line following the draw_circle model: have a simple
"iterator"-style line draw which calls a function per pixel
include a _direct version
get rid of draw_line_user and draw_line_mask
- hough_circle can use circle thing to incremet in circles
- test draw_mask on labq images
we probably need to unpack the ink back to double before blending
- vips_draw_image() might need a direct mode? see vips_flood_direct()
- need call operation along a circle, see line draw
- use with vips_draw_add() to make a mask image for each radius for
vips_hough_circle()
- think of a better way to support skipahead

View File

@ -4566,13 +4566,37 @@ im_draw_line( VipsImage *image, int x1, int y1, int x2, int y2, VipsPel *ink )
return( vips_draw_line( image, vec, n, x1, y1, x2, y2, NULL ) );
}
typedef struct _Line {
VipsPlotFn plot;
void *a;
void *b;
void *c;
} Line;
static void
draw_line_wrapper( VipsImage *image, int x, int y, void *client )
{
Line *line = (Line *) client;
line->plot( image, x, y, line->a, line->b, line->c );
}
int
im_draw_line_user( VipsImage *image,
int x1, int y1, int x2, int y2,
VipsPlotFn plot, void *a, void *b, void *c )
{
return( vips_draw_line_user( image, x1, y1, x2, y2,
plot, a, b, c, NULL ) );
Line line;
line.plot = plot;
line.a = a;
line.b = b;
line.c = c;
vips__draw_line_direct( image, x1, y1, x2, y2,
draw_line_wrapper, &line );
return( 0 );
}
int

View File

@ -56,6 +56,7 @@
#include <string.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "drawink.h"
@ -67,8 +68,6 @@ typedef struct _VipsDrawCircle {
int radius;
gboolean fill;
VipsDrawPoint draw_point;
VipsDrawScanline draw_scanline;
} VipsDrawCircle;
typedef struct _VipsDrawCircleClass {

View File

@ -60,6 +60,9 @@
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "drawink.h"
typedef struct _VipsDrawLine {
VipsDrawink parent_object;
@ -237,6 +240,7 @@ static int
vips_draw_line_build( VipsObject *object )
{
VipsDraw *draw = VIPS_DRAW( object );
VipsDrawink *drawink = VIPS_DRAWINK( object );
VipsDrawLine *line = (VipsDrawLine *) object;
VipsDrawPoint draw_point;