Image-Imlib2
view release on metacpan or search on metacpan
lib/Image/Imlib2.xs view on Meta::CPAN
Imlib2_query_pixel(image, x, y)
Image::Imlib2 image
int x
int y
PROTOTYPE: $$
PREINIT:
Imlib_Color color_return;
PPCODE:
imlib_context_set_image(image);
imlib_image_query_pixel(x, y, &color_return);
XPUSHs(sv_2mortal(newSViv(color_return.red)));
XPUSHs(sv_2mortal(newSViv(color_return.green)));
XPUSHs(sv_2mortal(newSViv(color_return.blue)));
XPUSHs(sv_2mortal(newSViv(color_return.alpha)));
void
Imlib2_autocrop_dimensions(image)
lib/Image/Imlib2.xs view on Meta::CPAN
PREINIT:
Imlib_Color c, bg, tl, tr, bl, br;
int width, height;
int cx = 0;
int cy = 0;
int cw, ch;
int x1, y1, x2, y2;
int i;
bool abort;
PPCODE:
imlib_context_set_image(image);
width = imlib_image_get_width();
height = imlib_image_get_height();
cw = width;
ch = height;
/* guess the background colour
algorithm from gimp's autocrop.c, originally pinched from
pnmcrop: first see if three corners are equal, then if two are equal,
otherwise give up */
lib/Image/Imlib2.xs view on Meta::CPAN
PROTOTYPE: $$
PREINIT:
Imlib_Color c;
int r, g, b, a;
int width, height;
int x = 0;
int y = 0;
bool abort;
PPCODE:
imlib_context_set_image(image);
width = imlib_image_get_width();
height = imlib_image_get_height();
imlib_context_get_color(&r, &g, &b, &a);
// warn("pr = %i, pg = %i, pb = %i", r, g, b);
abort = FALSE;
for (y = 0; y < height && !abort; y++) {
for (x = 0; x < width && !abort; x++) {
imlib_image_query_pixel(x, y, &c);
lib/Image/Imlib2.xs view on Meta::CPAN
PREINIT:
Imlib_Color c;
int r, g, b, a;
int or, og, ob, oa;
int width, height, px, py, west, east;
AV* coords;
SV* sv;
int length;
bool abort;
PPCODE:
imlib_context_set_image(image);
width = imlib_image_get_width();
height = imlib_image_get_height();
imlib_image_query_pixel(x, y, &c);
or = c.red; og = c.green; ob = c.blue;
imlib_context_get_color(&r, &g, &b, &a);
// warn("pr = %i, pg = %i, pb = %i", r, g, b);
lib/Image/Imlib2.xs view on Meta::CPAN
char * text
int direction
double angle
PROTOTYPE: $$
PREINIT:
int text_w;
int text_h;
PPCODE:
imlib_context_set_image(image);
imlib_context_set_direction(direction);
imlib_context_set_angle(angle);
imlib_get_text_size(text, &text_w, &text_h);
XPUSHs(sv_2mortal(newSViv(text_w)));
XPUSHs(sv_2mortal(newSViv(text_h)));
( run in 0.708 second using v1.01-cache-2.11-cpan-5511b514fd6 )