parent
467aa42707
commit
bd2e3aecaf
|
@ -27,10 +27,10 @@ jpeg_la_LIBADD = -ljpeg
|
|||
bin_PROGRAMS = imlib2
|
||||
imlib2_SOURCES = rend.c ximage.c scale.c main.c rgba.c image.c \
|
||||
color.c grab.c blend.c file.c rgbadraw.c api.c draw.c \
|
||||
context.c updates.c colormod.c font.c format.c \
|
||||
context.c updates.c colormod.c font.c format.c grad.c \
|
||||
api.h image.h scale.h blend.h context.h updates.h \
|
||||
color.h draw.h rend.h ximage.h colormod.h file.h rgba.h \
|
||||
common.h grab.h rgbadraw.h font.h format.h
|
||||
common.h grab.h rgbadraw.h font.h format.h grad.h
|
||||
|
||||
imlib2_LDADD = @DLLDFLAGS@ $(top_builddir)/libltdl/libltdlc.la \
|
||||
-lX11 -lXext -lttf
|
||||
|
|
209
api.c
209
api.c
|
@ -200,6 +200,17 @@ imlib_image_get_data(Imlib_Image image)
|
|||
return im->data;
|
||||
}
|
||||
|
||||
DATA32 *
|
||||
imlib_image_get_data_for_reading_only(Imlib_Image image)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (!(im->data))
|
||||
im->loader->load(im, NULL, 0, 1);
|
||||
return im->data;
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_put_back_data(Imlib_Image image)
|
||||
{
|
||||
|
@ -271,6 +282,54 @@ imlib_image_set_format(Imlib_Image image, char *format)
|
|||
im->format = strdup(format);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_set_irrelevant_format(Imlib_Image image, char irrelevant)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (irrelevant)
|
||||
{
|
||||
SET_FLAG(im->flags, F_FORMAT_IRRELEVANT);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNSET_FLAG(im->flags, F_FORMAT_IRRELEVANT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_set_irrelevant_border(Imlib_Image image, char irrelevant)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (irrelevant)
|
||||
{
|
||||
SET_FLAG(im->flags, F_BORDER_IRRELEVANT);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNSET_FLAG(im->flags, F_BORDER_IRRELEVANT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_set_irrelevant_alpha(Imlib_Image image, char irrelevant)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (irrelevant)
|
||||
{
|
||||
SET_FLAG(im->flags, F_ALPHA_IRRELEVANT);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNSET_FLAG(im->flags, F_ALPHA_IRRELEVANT);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
imlib_image_format(Imlib_Image image)
|
||||
{
|
||||
|
@ -1233,3 +1292,153 @@ imlib_apply_color_modifier(Imlib_Image image,
|
|||
__imlib_DataCmodApply(im->data, im->w, im->h, 0,
|
||||
(ImlibColorModifier *)color_modifier);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_apply_color_modifier_to_rectangle(Imlib_Image image,
|
||||
Imlib_Color_Modifier color_modifier,
|
||||
int x, int y, int width,
|
||||
int height)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (x < 0)
|
||||
{
|
||||
width += x;
|
||||
x = 0;
|
||||
}
|
||||
if (width <= 0)
|
||||
return;
|
||||
if ((x + width) > im->w)
|
||||
width = (im->w - x);
|
||||
if (width <= 0)
|
||||
return;
|
||||
if (y < 0)
|
||||
{
|
||||
height += y;
|
||||
y = 0;
|
||||
}
|
||||
if (height <= 0)
|
||||
return;
|
||||
if ((y + height) > im->h)
|
||||
height = (im->h - y);
|
||||
if (height <= 0)
|
||||
return;
|
||||
__imlib_DataCmodApply(im->data + (y * im->w) + x, width, height,
|
||||
im->w - width,
|
||||
(ImlibColorModifier *)color_modifier);
|
||||
}
|
||||
|
||||
Imlib_Updates
|
||||
imlib_image_draw_line(Imlib_Image image, int x1, int y1, int x2, int y2,
|
||||
Imlib_Color *color, Imlib_Operation operation,
|
||||
int make_updates)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
return (Imlib_Updates)__imlib_draw_line(im, x1, y1, x2, y2,
|
||||
(DATA8)color->red,
|
||||
(DATA8)color->green,
|
||||
(DATA8)color->blue,
|
||||
(DATA8)color->alpha,
|
||||
(ImlibOp)operation,
|
||||
(char)make_updates);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_draw_rectangle(Imlib_Image image, int x, int y, int width,
|
||||
int height, Imlib_Color *color,
|
||||
Imlib_Operation operation)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
__imlib_draw_box(im, x, y, width, height, color->red, color->green,
|
||||
color->blue, color->alpha, (ImlibOp)operation);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_fill_rectangle(Imlib_Image image, int x, int y, int width,
|
||||
int height, Imlib_Color *color,
|
||||
Imlib_Operation operation)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
__imlib_draw_filled_box(im, x, y, width, height, color->red, color->green,
|
||||
color->blue, color->alpha, (ImlibOp)operation);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_copy_alpha_to_image(Imlib_Image image_source,
|
||||
Imlib_Image image_destination,
|
||||
int x, int y)
|
||||
{
|
||||
ImlibImage *im, *im2;
|
||||
|
||||
CAST_IMAGE(im, image_source);
|
||||
CAST_IMAGE(im2, image_destination);
|
||||
__imlib_copy_alpha_data(im, im2, 0, 0, im->w, im->h, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source,
|
||||
Imlib_Image image_destination,
|
||||
int x, int y, int width,
|
||||
int height, int destination_x,
|
||||
int destination_y)
|
||||
{
|
||||
ImlibImage *im, *im2;
|
||||
|
||||
CAST_IMAGE(im, image_source);
|
||||
CAST_IMAGE(im2, image_destination);
|
||||
__imlib_copy_alpha_data(im, im2, x, y, width, height, destination_x,
|
||||
destination_y);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_scroll_rect(Imlib_Image image, int x, int y, int width,
|
||||
int height, int delta_x, int delta_y)
|
||||
{
|
||||
ImlibImage *im;
|
||||
int xx, yy, w, h, nx, ny;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
if (delta_x > 0)
|
||||
{
|
||||
xx = x;
|
||||
nx = x + delta_x;
|
||||
w = width - delta_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
xx = x - delta_x;
|
||||
nx = x;
|
||||
w = width + delta_x;
|
||||
}
|
||||
if (delta_y > 0)
|
||||
{
|
||||
yy = y;
|
||||
ny = y + delta_y;
|
||||
h = height - delta_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
yy = y - delta_y;
|
||||
ny = y;
|
||||
h = height + delta_y;
|
||||
}
|
||||
|
||||
__imlib_copy_image_data(im, xx, yy, w, h, nx, ny);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_copy_rect(Imlib_Image image, int x, int y, int width, int height,
|
||||
int new_x,int new_y)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CAST_IMAGE(im, image);
|
||||
__imlib_copy_image_data(im, x, y, width, height, new_x, new_y);
|
||||
}
|
||||
|
|
46
api.h
46
api.h
|
@ -107,6 +107,7 @@ void imlib_free_image_and_decache(Imlib_Image image);
|
|||
int imlib_image_get_width(Imlib_Image image);
|
||||
int imlib_image_get_height(Imlib_Image image);
|
||||
DATA32 *imlib_image_get_data(Imlib_Image image);
|
||||
DATA32 *imlib_image_get_data_for_reading_only(Imlib_Image image);
|
||||
char imlib_image_has_alpha(Imlib_Image image);
|
||||
char *imlib_image_format(Imlib_Image image);
|
||||
void imlib_image_put_back_data(Imlib_Image image);
|
||||
|
@ -115,7 +116,9 @@ void imlib_image_set_never_changes_on_disk(Imlib_Image image);
|
|||
void imlib_image_get_border(Imlib_Image image, Imlib_Border *border);
|
||||
void imlib_image_set_border(Imlib_Image image, Imlib_Border *border);
|
||||
void imlib_image_set_format(Imlib_Image image, char *format);
|
||||
|
||||
void imlib_image_set_irrelevant_format(Imlib_Image image, char irrelevant);
|
||||
void imlib_image_set_irrelevant_border(Imlib_Image image, char irrelevant);
|
||||
void imlib_image_set_irrelevant_alpha(Imlib_Image image, char irrelevant);
|
||||
/* image drawing/rendering functions */
|
||||
|
||||
void imlib_render_pixmaps_for_whole_image(Imlib_Image image, Display *display,
|
||||
|
@ -311,24 +314,43 @@ void imlib_get_color_modifier_tables(Imlib_Color_Modifier color_modifier,
|
|||
void imlib_rset_color_modifier(Imlib_Color_Modifier color_modifier);
|
||||
void imlib_apply_color_modifier(Imlib_Image image,
|
||||
Imlib_Color_Modifier color_modifier);
|
||||
void imlib_apply_color_modifier_to_rectangle(Imlib_Image image,
|
||||
Imlib_Color_Modifier color_modifier,
|
||||
int x, int y, int width,
|
||||
int height);
|
||||
|
||||
|
||||
# if 0
|
||||
void imlib_image_draw_line(Imlib_Image image, int x1, int y1, int x1, int y2,
|
||||
Imlib_Color *color, Imlib_Operation operation);
|
||||
|
||||
void imlib_image_copy_alpha_to_image(Imlib_Image image_source,
|
||||
Imlib_Image image_destination,
|
||||
int x, int y);
|
||||
void imlib_image_scroll_rect(Imlib_Image image, int x, int y,
|
||||
int width, int height, int delta_x,
|
||||
int delta_y);
|
||||
Imlib_Updates imlib_image_draw_line(Imlib_Image image, int x1, int y1,
|
||||
int x2, int y2,
|
||||
Imlib_Color *color,
|
||||
Imlib_Operation operation,
|
||||
int make_updates);
|
||||
void imlib_image_draw_rectangle(Imlib_Image image, int x, int y, int width,
|
||||
int height, Imlib_Color *color,
|
||||
Imlib_Operation operation);
|
||||
void imlib_image_fill_rectangle(Imlib_Image image, int x, int y, int width,
|
||||
int height, Imlib_Color *color,
|
||||
Imlib_Operation operation);
|
||||
|
||||
void imlib_image_copy_alpha_to_image(Imlib_Image image_source,
|
||||
Imlib_Image image_destination,
|
||||
int x, int y);
|
||||
void imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source,
|
||||
Imlib_Image image_destination,
|
||||
int x, int y, int width,
|
||||
int height, int destination_x,
|
||||
int destination_y);
|
||||
void imlib_image_scroll_rect(Imlib_Image image, int x, int y,
|
||||
int width, int height, int delta_x,
|
||||
int delta_y);
|
||||
void imlib_image_copy_rect(Imlib_Image image, int x, int y,
|
||||
int width, int height, int new_x,
|
||||
int new_y);
|
||||
|
||||
# if 0
|
||||
/* need to add arbitary rotation */
|
||||
/* polygon fills */
|
||||
|
||||
|
||||
Imlib_Color_Range imlib_create_color_range(void);
|
||||
void imlib_free_color_range(Imlib_Color_Range color_range);
|
||||
void imlib_add_color_to_color_range(Imlib_Color_Range color_range,
|
||||
|
|
5
image.h
5
image.h
|
@ -33,7 +33,10 @@ enum _iflags
|
|||
F_UNCACHEABLE = (1 << 2),
|
||||
F_ALWAYS_CHECK_DISK = (1 << 3),
|
||||
F_INVALID = (1 << 4),
|
||||
F_DONT_FREE_DATA = (1 << 5)
|
||||
F_DONT_FREE_DATA = (1 << 5),
|
||||
F_FORMAT_IRRELEVANT = (1 << 6),
|
||||
F_BORDER_IRRELEVANT = (1 << 7),
|
||||
F_ALPHA_IRRELEVANT = (1 << 8)
|
||||
};
|
||||
|
||||
typedef enum _iflags ImlibImageFlags;
|
||||
|
|
|
@ -650,7 +650,6 @@ static int
|
|||
presym_close (handle)
|
||||
lt_dlhandle handle;
|
||||
{
|
||||
handle = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -974,7 +973,6 @@ load_deplibs(handle, deplibs)
|
|||
const char *deplibs;
|
||||
{
|
||||
/* FIXME: load deplibs */
|
||||
deplibs = NULL;
|
||||
handle->depcount = 0;
|
||||
handle->deplibs = 0;
|
||||
return 0;
|
||||
|
@ -985,7 +983,6 @@ unload_deplibs(handle)
|
|||
lt_dlhandle handle;
|
||||
{
|
||||
/* FIXME: unload deplibs */
|
||||
handle = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
27
main.c
27
main.c
|
@ -281,13 +281,36 @@ int main (int argc, char **argv)
|
|||
NULL, IMLIB_OP_COPY);
|
||||
first = 0;
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
Imlib_Updates uu;
|
||||
Imlib_Color col;
|
||||
|
||||
uu = (Imlib_Updates) __imlib_draw_line(im, 200, 200, x, y, 255, 255,
|
||||
255, 255, 0);
|
||||
col.red = 255;
|
||||
col.green = 255;
|
||||
col.blue = 255;
|
||||
col.alpha = 255;
|
||||
uu = imlib_image_draw_line(im, 200, 200, x, y, &col,
|
||||
IMLIB_OP_COPY, 1);
|
||||
up = imlib_updates_append_updates(up, uu);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
void *rg = NULL;;
|
||||
|
||||
if (!rg)
|
||||
{
|
||||
rg = __imlib_CreateRange();
|
||||
__imlib_AddRangeColor(rg, 255, 255, 255, 255, 0);
|
||||
__imlib_AddRangeColor(rg, 255, 255, 160, 200, 1);
|
||||
__imlib_AddRangeColor(rg, 255, 160, 120, 140, 1);
|
||||
__imlib_AddRangeColor(rg, 100, 80, 100, 80, 1);
|
||||
__imlib_AddRangeColor(rg, 32, 48, 80, 0, 1);
|
||||
}
|
||||
__imlib_DrawGradient(im, 30, 30, 256, 256, rg, (double)x,
|
||||
IMLIB_OP_COPY);
|
||||
up = imlib_update_append_rect(up, 40, 40, 256, 256);
|
||||
}
|
||||
if (fon)
|
||||
{
|
||||
int retw, reth, ty, nx, ny, cx, cy, cw, ch, cp;
|
||||
|
|
1087
rgbadraw.c
1087
rgbadraw.c
File diff suppressed because it is too large
Load Diff
|
@ -7,6 +7,10 @@ void __imlib_BlurImage(ImlibImage *im, int rad);
|
|||
void __imlib_SharpenImage(ImlibImage *im, int rad);
|
||||
void __imlib_TileImageHoriz(ImlibImage *im);
|
||||
void __imlib_TileImageVert(ImlibImage *im);
|
||||
ImlibUpdate * __imlib_draw_line(ImlibImage *im, int x1, int y1, int x2, int y2, DATA8 r, DATA8 g, DATA8 b, DATA8 a, char make_updates);
|
||||
|
||||
ImlibUpdate * __imlib_draw_line(ImlibImage *im, int x1, int y1, int x2, int y2, DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op, char make_updates);
|
||||
void __imlib_draw_box(ImlibImage *im, int x, int y, int w, int h, DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op);
|
||||
void __imlib_draw_filled_box(ImlibImage *im, int x, int y, int w, int h, DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op);
|
||||
void __imlib_draw_filled_box(ImlibImage *im, int x, int y, int w, int h, DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op);
|
||||
void __imlib_copy_image_data(ImlibImage *im, int x, int y, int w, int h, int nx, int ny);
|
||||
void __imlib_copy_alpha_data(ImlibImage *src, ImlibImage *dst, int x, int y, int w, int h, int nx, int ny);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue