diff --git a/TODO b/TODO index cd0f2eef..0019cd2a 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index d909826d..be351172 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -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 diff --git a/libvips/draw/draw_circle.c b/libvips/draw/draw_circle.c index 237dca8e..bbd8a527 100644 --- a/libvips/draw/draw_circle.c +++ b/libvips/draw/draw_circle.c @@ -56,6 +56,7 @@ #include #include +#include #include "drawink.h" @@ -67,8 +68,6 @@ typedef struct _VipsDrawCircle { int radius; gboolean fill; - VipsDrawPoint draw_point; - VipsDrawScanline draw_scanline; } VipsDrawCircle; typedef struct _VipsDrawCircleClass { diff --git a/libvips/draw/draw_line.c b/libvips/draw/draw_line.c index 7e18faf1..f13b4f05 100644 --- a/libvips/draw/draw_line.c +++ b/libvips/draw/draw_line.c @@ -60,6 +60,9 @@ #include #include +#include + +#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;