forked from old/legacy-imlib2
parent
965982c5c0
commit
456a035996
1
AUTHORS
1
AUTHORS
|
@ -11,3 +11,4 @@ Dan Maas <dmaas@dcine.com>
|
||||||
Platon Fomichev <pla@cland.ru>
|
Platon Fomichev <pla@cland.ru>
|
||||||
boris (Chris Ross) <chris@darkrock.co.uk>
|
boris (Chris Ross) <chris@darkrock.co.uk>
|
||||||
Martin Grimm <grimm.martin@gmx.de>
|
Martin Grimm <grimm.martin@gmx.de>
|
||||||
|
Matt McClanahan <cardinal@dodds.net>
|
||||||
|
|
20
src/api.c
20
src/api.c
|
@ -2210,9 +2210,23 @@ imlib_image_fill_rectangle(int x, int y, int width, int height)
|
||||||
return;
|
return;
|
||||||
__imlib_DirtyImage(im);
|
__imlib_DirtyImage(im);
|
||||||
__imlib_DirtyPixmapsForImage(im);
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
__imlib_draw_filled_box(im, x, y, width, height, ctxt_color.red,
|
if (ctxt_cliprect.w)
|
||||||
ctxt_color.green, ctxt_color.blue,
|
{
|
||||||
ctxt_color.alpha, ctxt_operation);
|
__imlib_draw_filled_box_clipped(im, x, y, width, height,
|
||||||
|
ctxt_cliprect.x,
|
||||||
|
ctxt_cliprect.x + ctxt_cliprect.w,
|
||||||
|
ctxt_cliprect.y,
|
||||||
|
ctxt_cliprect.y + ctxt_cliprect.h,
|
||||||
|
ctxt_color.red, ctxt_color.green,
|
||||||
|
ctxt_color.blue, ctxt_color.alpha,
|
||||||
|
ctxt_operation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__imlib_draw_filled_box(im, x, y, width, height, ctxt_color.red,
|
||||||
|
ctxt_color.green, ctxt_color.blue,
|
||||||
|
ctxt_color.alpha, ctxt_operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
108
src/rgbadraw.c
108
src/rgbadraw.c
|
@ -1261,6 +1261,114 @@ __imlib_draw_box_clipped(ImlibImage * im, int x, int y, int w, int h,
|
||||||
b, a, op, 0);
|
b, a, op, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_draw_filled_box_clipped(ImlibImage * im, int x, int y, int w, int h,
|
||||||
|
int clip_xmin, int clip_xmax, int clip_ymin,
|
||||||
|
int clip_ymax, DATA8 r, DATA8 g, DATA8 b,
|
||||||
|
DATA8 a, ImlibOp op)
|
||||||
|
{
|
||||||
|
int yy, xx, tmp;
|
||||||
|
DATA32 *p;
|
||||||
|
DATA8 nr, ng, nb, rr, gg, bb, aa, na;
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
w += x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (w <= 0)
|
||||||
|
return;
|
||||||
|
if ((x + w) > im->w)
|
||||||
|
w = (im->w - x);
|
||||||
|
if (w <= 0)
|
||||||
|
return;
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
h += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
if (h <= 0)
|
||||||
|
return;
|
||||||
|
if ((y + h) > im->h)
|
||||||
|
h = (im->h - y);
|
||||||
|
if (h <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (clip_xmin < 0)
|
||||||
|
clip_xmin = 0;
|
||||||
|
if (clip_xmax > im->w)
|
||||||
|
clip_xmax = im->w;
|
||||||
|
if (clip_ymin < 0)
|
||||||
|
clip_ymin = 0;
|
||||||
|
if (clip_ymax > im->h)
|
||||||
|
clip_ymax = im->h;
|
||||||
|
|
||||||
|
if (x < clip_xmin)
|
||||||
|
{
|
||||||
|
w -= (clip_xmin - x);
|
||||||
|
x = clip_xmin;
|
||||||
|
}
|
||||||
|
if ((x + w) > clip_xmax)
|
||||||
|
w = clip_xmax - x;
|
||||||
|
if (y < clip_ymin)
|
||||||
|
{
|
||||||
|
h -= (clip_ymin - y);
|
||||||
|
y = clip_ymin;
|
||||||
|
}
|
||||||
|
if ((y + h) > clip_ymax)
|
||||||
|
h = clip_ymax - y;
|
||||||
|
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case OP_COPY:
|
||||||
|
for (yy = 0; yy < h; yy++)
|
||||||
|
{
|
||||||
|
p = im->data + ((y + yy) * im->w) + x;
|
||||||
|
for (xx = 0; xx < w; xx++)
|
||||||
|
{
|
||||||
|
BLEND(r, g, b, a, p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OP_ADD:
|
||||||
|
for (yy = 0; yy < h; yy++)
|
||||||
|
{
|
||||||
|
p = im->data + ((y + yy) * im->w) + x;
|
||||||
|
for (xx = 0; xx < w; xx++)
|
||||||
|
{
|
||||||
|
BLEND_ADD(r, g, b, a, p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OP_SUBTRACT:
|
||||||
|
for (yy = 0; yy < h; yy++)
|
||||||
|
{
|
||||||
|
p = im->data + ((y + yy) * im->w) + x;
|
||||||
|
for (xx = 0; xx < w; xx++)
|
||||||
|
{
|
||||||
|
BLEND_SUB(r, g, b, a, p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OP_RESHADE:
|
||||||
|
for (yy = 0; yy < h; yy++)
|
||||||
|
{
|
||||||
|
p = im->data + ((y + yy) * im->w) + x;
|
||||||
|
for (xx = 0; xx < w; xx++)
|
||||||
|
{
|
||||||
|
BLEND_RE(r, g, b, a, p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
__imlib_draw_filled_box(ImlibImage * im, int x, int y, int w, int h, DATA8 r,
|
__imlib_draw_filled_box(ImlibImage * im, int x, int y, int w, int h, DATA8 r,
|
||||||
DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
||||||
|
|
Loading…
Reference in New Issue