301 |
return item; |
return item; |
302 |
} |
} |
303 |
|
|
304 |
|
/* place the image in pix centered on x/y on the canvas */ |
305 |
canvas_item_t *canvas_image_new(canvas_t *canvas, canvas_group_t group, |
canvas_item_t *canvas_image_new(canvas_t *canvas, canvas_group_t group, |
306 |
GdkPixbuf *pix, gint x, gint y, float hscale, float vscale) { |
GdkPixbuf *pix, gint x, gint y, float hscale, float vscale) { |
307 |
|
|
308 |
canvas_item_t *item = goo_canvas_image_new(canvas->group[group], pix, |
canvas_item_t *item = goo_canvas_image_new(canvas->group[group], pix, |
309 |
x/hscale, y/vscale, NULL); |
x/hscale - gdk_pixbuf_get_width(pix)/2, |
310 |
|
y/vscale - gdk_pixbuf_get_height(pix)/2, NULL); |
311 |
goo_canvas_item_scale(item, hscale, vscale); |
goo_canvas_item_scale(item, hscale, vscale); |
312 |
|
|
313 |
#ifdef CANVAS_CUSTOM_ITEM_AT |
#ifdef CANVAS_CUSTOM_ITEM_AT |
314 |
if(CANVAS_SELECTABLE & (1<<group)) { |
if(CANVAS_SELECTABLE & (1<<group)) { |
315 |
gint radius = MAX(gdk_pixbuf_get_width(pix), gdk_pixbuf_get_height(pix)); |
gint radius = 0.75 * hscale * MAX(gdk_pixbuf_get_width(pix), gdk_pixbuf_get_height(pix)); /* hscale and vscale are the same */ |
316 |
canvas_item_info_attach_circle(canvas, group, item, x, y, radius); |
canvas_item_info_attach_circle(canvas, group, item, x, y, radius); |
317 |
} |
} |
318 |
#endif |
#endif |