This commit is contained in:
John Cupitt 2010-09-22 22:02:44 +00:00
parent 39a6a2c0b3
commit 3cae292f4f
8 changed files with 65 additions and 23 deletions

View File

@ -23,6 +23,7 @@
- moved the stupid _copy() versions of the inplace ops to deprecated, since
nip2 can call inplace ops directly now
- added im_draw_rect(), moved im_paintrect() to deprecated
- added im_draw_image(), moved im_insertplace() to deprecated
12/5/10 started 7.22.2
- the conditional image of ifthenelse can be any format, a (!=0) is added if

View File

@ -1372,6 +1372,37 @@ static im_function flood_other_copy_desc = {
flood_other_copy_args /* Arg list */
};
/* Args for im_insertplace.
*/
static im_arg_desc insertplace_args[] = {
IM_RW_IMAGE( "main" ),
IM_INPUT_IMAGE( "sub" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" )
};
/* Call im_insertplace via arg vector.
*/
static int
insertplace_vec( im_object *argv )
{
int x = *((int *) argv[2]);
int y = *((int *) argv[3]);
return( im_insertplace( argv[0], argv[1], x, y ) );
}
/* Description of im_insertplace.
*/
static im_function insertplace_desc = {
"im_insertplace", /* Name */
"draw image sub inside image main at position (x,y)",
0, /* Flags */
insertplace_vec, /* Dispatch function */
IM_NUMBER( insertplace_args ), /* Size of arg list */
insertplace_args /* Arg list */
};
/* Package up all these functions.
*/
static im_function *deprecated_list[] = {
@ -1421,6 +1452,7 @@ static im_function *deprecated_list[] = {
&erode_raw_desc,
&similarity_area_desc,
&similarity_desc,
&insertplace_desc,
&circle_desc
};

View File

@ -513,3 +513,8 @@ im_paintrect( IMAGE *im, Rect *r, PEL *ink )
r->left, r->top, r->width, r->height, 1, ink ) );
}
int
im_insertplace( IMAGE *main, IMAGE *sub, int x, int y )
{
return( im_draw_image( main, x, y, sub ) );
}

View File

@ -232,6 +232,7 @@ int im_circle( IMAGE *im, int cx, int cy, int radius, int intensity );
int im_line( IMAGE *, int, int, int, int, int );
int im_segment( IMAGE *test, IMAGE *mask, int *segments );
int im_paintrect( IMAGE *im, Rect *r, PEL *ink );
int im_insertplace( IMAGE *main, IMAGE *sub, int x, int y );
int im_flood_copy( IMAGE *in, IMAGE *out, int x, int y, PEL *ink );
int im_flood_blob_copy( IMAGE *in, IMAGE *out, int x, int y, PEL *ink );

View File

@ -46,7 +46,7 @@ int im_draw_rect( IMAGE *image,
int im_draw_circle( IMAGE *im,
int cx, int cy, int radius, gboolean fill, PEL *ink );
int im_insertplace( IMAGE *main, IMAGE *sub, int x, int y );
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_fastlineuser( IMAGE *im,
int x1, int y1, int x2, int y2,

View File

@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libinplace.la
libinplace_la_SOURCES = \
im_draw_circle.c \
flood.c \
im_insertplace.c \
im_draw_image.c \
im_draw_rect.c \
im_plotmask.c \
inplace_dispatch.c \

View File

@ -21,6 +21,8 @@
* level
* 25/8/10
* - cast and bandalike sub to main
* 22/9/10
* - rename to im_draw_image()
*/
/*
@ -95,12 +97,13 @@ im__inplace_base( const char *domain,
/**
* im_insertplace:
* @main: main image
* @sub: sub-image to insert
* @main: image to draw on
* @x: position to insert
* @y: position to insert
* @sub: image to draw
*
* Copy @sub into @main at position @x, @y. The two images must have the same
* Draw @sub on top of @main at position @x, @y. The two images must have the
* same
* Coding. If @sub has 1 band, the bands will be duplicated to match the
* number of bands in @main. @sub will be converted to @main's format, see
* im_clip2fmt().
@ -113,7 +116,7 @@ im__inplace_base( const char *domain,
* Returns: 0 on success, or -1 on error.
*/
int
im_insertplace( IMAGE *main, IMAGE *sub, int x, int y )
im_draw_image( IMAGE *main, int x, int y, IMAGE *sub )
{
Rect br, sr, clip;
PEL *p, *q;
@ -133,7 +136,7 @@ im_insertplace( IMAGE *main, IMAGE *sub, int x, int y )
if( im_rect_isempty( &clip ) )
return( 0 );
if( !(sub = im__inplace_base( "im_insertplace", main, sub, main )) ||
if( !(sub = im__inplace_base( "im_draw_image", main, sub, main )) ||
im_rwcheck( main ) ||
im_incheck( sub ) )
return( -1 );

View File

@ -54,35 +54,35 @@
*
*/
/* Args for im_insertplace.
/* Args for im_draw_image.
*/
static im_arg_desc insertplace_args[] = {
static im_arg_desc draw_image_args[] = {
IM_RW_IMAGE( "main" ),
IM_INPUT_IMAGE( "sub" ),
IM_INPUT_INT( "x" ),
IM_INPUT_INT( "y" )
IM_INPUT_INT( "y" ),
IM_INPUT_IMAGE( "sub" )
};
/* Call im_insertplace via arg vector.
/* Call im_draw_image via arg vector.
*/
static int
insertplace_vec( im_object *argv )
draw_image_vec( im_object *argv )
{
int x = *((int *) argv[2]);
int y = *((int *) argv[3]);
int x = *((int *) argv[1]);
int y = *((int *) argv[2]);
return( im_insertplace( argv[0], argv[1], x, y ) );
return( im_draw_image( argv[0], x, y, argv[3] ) );
}
/* Description of im_insertplace.
/* Description of im_draw_image.
*/
static im_function insertplace_desc = {
"im_insertplace", /* Name */
static im_function draw_image_desc = {
"im_draw_image", /* Name */
"draw image sub inside image main at position (x,y)",
0, /* Flags */
insertplace_vec, /* Dispatch function */
IM_NUMBER( insertplace_args ), /* Size of arg list */
insertplace_args /* Arg list */
draw_image_vec, /* Dispatch function */
IM_NUMBER( draw_image_args ), /* Size of arg list */
draw_image_args /* Arg list */
};
/* Args for im_lineset.
@ -372,7 +372,7 @@ static im_function *inplace_list[] = {
&flood_desc,
&flood_blob_desc,
&flood_other_desc,
&insertplace_desc,
&draw_image_desc,
&lineset_desc
};