lots of new image manipulation functions and minor fix in loader module code.
SVN revision: 318
This commit is contained in:
parent
4e84cb2b4f
commit
00f60aa331
10
Makefile
10
Makefile
|
@ -100,7 +100,8 @@ jpeg_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||||
jpeg_la_LIBADD = -ljpeg
|
jpeg_la_LIBADD = -ljpeg
|
||||||
|
|
||||||
bin_PROGRAMS = imlib2
|
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
|
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 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
|
||||||
|
|
||||||
|
|
||||||
imlib2_LDADD = -export-dynamic $(top_builddir)/libltdl/libltdlc.la -lX11 -lXext
|
imlib2_LDADD = -export-dynamic $(top_builddir)/libltdl/libltdlc.la -lX11 -lXext
|
||||||
|
|
||||||
|
@ -122,7 +123,8 @@ jpeg_la_OBJECTS = loader_jpeg.lo
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
imlib2_OBJECTS = rend.o ximage.o scale.o main.o rgba.o image.o color.o \
|
imlib2_OBJECTS = rend.o ximage.o scale.o main.o rgba.o image.o color.o \
|
||||||
grab.o blend.o file.o rgbadraw.o api.o draw.o context.o updates.o
|
grab.o blend.o file.o rgbadraw.o api.o draw.o context.o updates.o \
|
||||||
|
colormod.o
|
||||||
imlib2_DEPENDENCIES = $(top_builddir)/libltdl/libltdlc.la
|
imlib2_DEPENDENCIES = $(top_builddir)/libltdl/libltdlc.la
|
||||||
imlib2_LDFLAGS =
|
imlib2_LDFLAGS =
|
||||||
CFLAGS = -O6 -mpentiumpro -mcpu=pentiumpro -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 -g -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
|
CFLAGS = -O6 -mpentiumpro -mcpu=pentiumpro -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 -g -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
|
||||||
|
@ -139,8 +141,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
TAR = gtar
|
TAR = gtar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
DEP_FILES = .deps/api.P .deps/blend.P .deps/color.P .deps/context.P \
|
DEP_FILES = .deps/api.P .deps/blend.P .deps/color.P .deps/colormod.P \
|
||||||
.deps/draw.P .deps/file.P .deps/grab.P .deps/image.P \
|
.deps/context.P .deps/draw.P .deps/file.P .deps/grab.P .deps/image.P \
|
||||||
.deps/loader_jpeg.P .deps/loader_png.P .deps/main.P .deps/rend.P \
|
.deps/loader_jpeg.P .deps/loader_png.P .deps/main.P .deps/rend.P \
|
||||||
.deps/rgba.P .deps/rgbadraw.P .deps/scale.P .deps/updates.P \
|
.deps/rgba.P .deps/rgbadraw.P .deps/scale.P .deps/updates.P \
|
||||||
.deps/ximage.P
|
.deps/ximage.P
|
||||||
|
|
|
@ -27,7 +27,11 @@ jpeg_la_LIBADD = -ljpeg
|
||||||
bin_PROGRAMS = imlib2
|
bin_PROGRAMS = imlib2
|
||||||
imlib2_SOURCES = rend.c ximage.c scale.c main.c rgba.c image.c \
|
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 \
|
color.c grab.c blend.c file.c rgbadraw.c api.c draw.c \
|
||||||
context.c updates.c
|
context.c updates.c colormod.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
|
||||||
|
|
||||||
imlib2_LDADD = @DLLDFLAGS@ $(top_builddir)/libltdl/libltdlc.la -lX11 -lXext
|
imlib2_LDADD = @DLLDFLAGS@ $(top_builddir)/libltdl/libltdlc.la -lX11 -lXext
|
||||||
|
|
||||||
SYS_LOADERS_PATH = @pkglibdir@
|
SYS_LOADERS_PATH = @pkglibdir@
|
||||||
|
|
193
api.c
193
api.c
|
@ -12,6 +12,9 @@
|
||||||
#include "blend.h"
|
#include "blend.h"
|
||||||
#include "rend.h"
|
#include "rend.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
#include "updates.h"
|
||||||
|
#include "ximage.h"
|
||||||
|
#include "rgbadraw.h"
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
#define CAST_IMAGE(im, image) (im) = (ImlibImage *)(image)
|
#define CAST_IMAGE(im, image) (im) = (ImlibImage *)(image)
|
||||||
|
@ -662,3 +665,193 @@ imlib_create_cropped_scaled_image(Imlib_Image image, char antialias,
|
||||||
return (Imlib_Image)im;
|
return (Imlib_Image)im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Imlib_Updates
|
||||||
|
imlib_update_append_rect(Imlib_Updates updates, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
return (Imlib_Updates)__imlib_AddUpdate(u, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
Imlib_Updates
|
||||||
|
imlib_updates_merge(Imlib_Updates updates, int w, int h)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
return (Imlib_Updates)__imlib_MergeUpdate(u, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_updates_free(Imlib_Updates updates)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
__imlib_FreeUpdates(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
Imlib_Updates imlib_updates_get_next(Imlib_Updates updates)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
return (Imlib_Updates)(u->next);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_updates_get_coordinates(Imlib_Updates updates,
|
||||||
|
int *x_return, int *y_return,
|
||||||
|
int *width_return, int *height_return)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
if (x_return)
|
||||||
|
*x_return = u->x;
|
||||||
|
if (y_return)
|
||||||
|
*y_return = u->y;
|
||||||
|
if (width_return)
|
||||||
|
*width_return = u->w;
|
||||||
|
if (height_return)
|
||||||
|
*height_return = u->h;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_render_image_updates_on_drawable(Imlib_Image image,
|
||||||
|
Imlib_Updates updates,
|
||||||
|
Display *display,
|
||||||
|
Drawable drawable, Visual *visual,
|
||||||
|
Colormap colormap, int depth,
|
||||||
|
char dithered_rendering,
|
||||||
|
int x, int y,
|
||||||
|
Imlib_Color_Modifier color_modifier)
|
||||||
|
{
|
||||||
|
ImlibUpdate *u;
|
||||||
|
ImlibImage *im;
|
||||||
|
ImlibColorModifier *cm;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
cm = (ImlibColorModifier *)color_modifier;
|
||||||
|
u = (ImlibUpdate *)updates;
|
||||||
|
if ((!(im->data)) && (im->loader))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_SetMaxXImageCount(display, 10);
|
||||||
|
for (; u; u = u->next)
|
||||||
|
{
|
||||||
|
__imlib_RenderImage(display, im, drawable, 0, visual, colormap, depth,
|
||||||
|
u->x, u->y, u->w, u->h, x + u->x, y + u->y,
|
||||||
|
u->w, u->h,
|
||||||
|
0,
|
||||||
|
dithered_rendering,
|
||||||
|
0, 0,
|
||||||
|
cm, OP_COPY);
|
||||||
|
}
|
||||||
|
__imlib_SetMaxXImageCount(display, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_flip_horizontal(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_FlipImageHoriz(im);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_flip_vertical(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_FlipImageVert(im);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_flip_diagonal(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_FlipImageDiagonal(im);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_blur(Imlib_Image image, int radius)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_BlurImage(im, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_sharpen(Imlib_Image image, int radius)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_SharpenImage(im, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_tile_horizontal(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_TileImageHoriz(im);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_tile_vertical(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_TileImageVert(im);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_image_tile(Imlib_Image image)
|
||||||
|
{
|
||||||
|
ImlibImage *im;
|
||||||
|
|
||||||
|
CAST_IMAGE(im, image);
|
||||||
|
if (!(im->data))
|
||||||
|
im->loader->load(im, NULL, 0, 1);
|
||||||
|
__imlib_DirtyImage(im);
|
||||||
|
__imlib_DirtyPixmapsForImage(im);
|
||||||
|
__imlib_TileImageHoriz(im);
|
||||||
|
__imlib_TileImageVert(im);
|
||||||
|
}
|
||||||
|
|
93
api.h
93
api.h
|
@ -11,6 +11,7 @@
|
||||||
/* data types - guess what - no transparent datatypes - all hidden */
|
/* data types - guess what - no transparent datatypes - all hidden */
|
||||||
typedef void * Imlib_Image;
|
typedef void * Imlib_Image;
|
||||||
typedef void * Imlib_Color_Modifier;
|
typedef void * Imlib_Color_Modifier;
|
||||||
|
typedef void * Imlib_Updates;
|
||||||
typedef struct _imlib_border Imlib_Border;
|
typedef struct _imlib_border Imlib_Border;
|
||||||
typedef enum _imlib_operation Imlib_Operation;
|
typedef enum _imlib_operation Imlib_Operation;
|
||||||
|
|
||||||
|
@ -171,33 +172,21 @@ Imlib_Image imlib_create_cropped_scaled_image(Imlib_Image image,
|
||||||
int source_height,
|
int source_height,
|
||||||
int destination_width,
|
int destination_width,
|
||||||
int destination_height);
|
int destination_height);
|
||||||
|
Imlib_Updates imlib_update_append_rect(Imlib_Updates updates,
|
||||||
#if 0
|
int x, int y, int w, int h);
|
||||||
/* I'm not even sure i want to deal with xpm's as inlined data at all */
|
Imlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h);
|
||||||
/* i much prefer theidea of GIMP's "save as C source" saver - i get 24bit */
|
void imlib_updates_free(Imlib_Updates updates);
|
||||||
/* plus alpha channel saving and its trivial to use - except they stor it in */
|
Imlib_Updates imlib_updates_get_next(Imlib_Updates updates);
|
||||||
/* RGBA rather than ARGB - hmm - migh have to hack the sevr in GIMP to do */
|
void imlib_updates_get_coordinates(Imlib_Updates updates,
|
||||||
/* this right */
|
int *x_return, int *y_return,
|
||||||
/* Imlib_image imlib_create_image_from_xpm_data(unsigned char *data);*/
|
int *width_return, int *height_return);
|
||||||
|
void imlib_render_image_updates_on_drawable(Imlib_Image image,
|
||||||
/* color stuff */
|
Imlib_Updates updates,
|
||||||
int imlib_match_color(Display *displpay, Visual *visual, Colormap colormap,
|
Display *display,
|
||||||
int red, int green, int blue);
|
Drawable drawable, Visual *visual,
|
||||||
|
Colormap colormap, int depth,
|
||||||
/* image modification - color */
|
char dithered_rendering,
|
||||||
Imlib_Color_Modifier imlib_create_color_modifier(void);
|
int x, int y,
|
||||||
void imlib_free_color_modifier(Imlib_Color_Modifier color_modifier);
|
|
||||||
void imlib_set_color_modifier_gamma(Imlib_Color_Modifier color_modifier,
|
|
||||||
double gamma_value);
|
|
||||||
void imlib_set_color_modifier_brightness(Imlib_Color_Modifier color_modifier,
|
|
||||||
double brightness_value);
|
|
||||||
void imlib_set_color_modifier_contrast(Imlib_Color_Modifier color_modifier,
|
|
||||||
double contrast_value);
|
|
||||||
void imlib_set_color_modifier_tables(Imlib_Color_Modifier color_modifier,
|
|
||||||
DATA8 *red_table,
|
|
||||||
DATA8 *green_table,
|
|
||||||
DATA8 *blue_table);
|
|
||||||
void imlib_apply_color_modifier(Imlib_Image image,
|
|
||||||
Imlib_Color_Modifier color_modifier);
|
Imlib_Color_Modifier color_modifier);
|
||||||
|
|
||||||
/* image modification - rotation / flipping */
|
/* image modification - rotation / flipping */
|
||||||
|
@ -214,13 +203,59 @@ void imlib_image_tile_horizontal(Imlib_Image image);
|
||||||
void imlib_image_tile_vertical(Imlib_Image image);
|
void imlib_image_tile_vertical(Imlib_Image image);
|
||||||
void imlib_image_tile(Imlib_Image image);
|
void imlib_image_tile(Imlib_Image image);
|
||||||
|
|
||||||
/* image saving functions */
|
#if 0
|
||||||
void imlib_save_image(Imlib_Image image, char *filename);
|
|
||||||
|
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);
|
||||||
|
void imlib_image_draw_line(Imlib_Image image, int x1, int y1, int x1, int y2,
|
||||||
|
int red, int green, int blue, int alpha);
|
||||||
|
void imlib_image_draw_rectangle(Imlib_Image image, int x, int y, int width,
|
||||||
|
int height, int red, int green, int blue,
|
||||||
|
int alpha);
|
||||||
|
void imlib_image_fill_rectangle(Imlib_Image image, int x, int y, int width,
|
||||||
|
int height, int red, int green, int blue,
|
||||||
|
int alpha);
|
||||||
|
void imlib_image_fill_rectangle_gradient(Imlib_Image image,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
int red_top_left, int green_top_left,
|
||||||
|
int blue_top_left, int alpha_top_left,
|
||||||
|
int red_top_right, int green_top_right,
|
||||||
|
int blue_top_right, int alpha_top_right,
|
||||||
|
int red_bottom_left, int green_bottom_left,
|
||||||
|
int blue_bottom_left, int alpha_bottom_left,
|
||||||
|
int red_bottom_right, int green_bottom_right,
|
||||||
|
int blue_bottom_right, int alpha_bottom_right,);
|
||||||
|
/* text functions needed */
|
||||||
|
|
||||||
/* FIXME: have to figure out generic saving mechanism that lets savers have */
|
/* FIXME: have to figure out generic saving mechanism that lets savers have */
|
||||||
/* options like quality, color , compression etc. */
|
/* options like quality, color , compression etc. */
|
||||||
|
|
||||||
|
/* image saving functions */
|
||||||
|
void imlib_save_image(Imlib_Image image, char *filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* do this later as none of the color lookup code is in the rendering */
|
||||||
|
/* backend yet */
|
||||||
|
/* image modification - color */
|
||||||
|
Imlib_Color_Modifier imlib_create_color_modifier(void);
|
||||||
|
void imlib_free_color_modifier(Imlib_Color_Modifier color_modifier);
|
||||||
|
void imlib_set_color_modifier_gamma(Imlib_Color_Modifier color_modifier,
|
||||||
|
double gamma_value);
|
||||||
|
void imlib_set_color_modifier_brightness(Imlib_Color_Modifier color_modifier,
|
||||||
|
double brightness_value);
|
||||||
|
void imlib_set_color_modifier_contrast(Imlib_Color_Modifier color_modifier,
|
||||||
|
double contrast_value);
|
||||||
|
void imlib_set_color_modifier_tables(Imlib_Color_Modifier color_modifier,
|
||||||
|
DATA8 *red_table,
|
||||||
|
DATA8 *green_table,
|
||||||
|
DATA8 *blue_table);
|
||||||
|
void imlib_apply_color_modifier(Imlib_Image image,
|
||||||
|
Imlib_Color_Modifier color_modifier);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
6
image.c
6
image.c
|
@ -475,9 +475,9 @@ __imlib_RescanLoaders(void)
|
||||||
return;
|
return;
|
||||||
/* ok - was the system loaders dir contents modified ? */
|
/* ok - was the system loaders dir contents modified ? */
|
||||||
last_scan_time = current_time;
|
last_scan_time = current_time;
|
||||||
if (__imlib_FileIsDir("/usr/lib/loaders/image/"))
|
if (__imlib_FileIsDir(SYS_LOADERS_PATH "/image/"))
|
||||||
{
|
{
|
||||||
current_time = __imlib_FileModDate("/usr/lib/loaders/image/");
|
current_time = __imlib_FileModDate(SYS_LOADERS_PATH "/image/");
|
||||||
if (current_time > last_modified_system_time)
|
if (current_time > last_modified_system_time)
|
||||||
{
|
{
|
||||||
/* yup - set the "do_reload" flag */
|
/* yup - set the "do_reload" flag */
|
||||||
|
@ -487,7 +487,7 @@ __imlib_RescanLoaders(void)
|
||||||
}
|
}
|
||||||
/* ok - was the users own loaders dir contents modified ? */
|
/* ok - was the users own loaders dir contents modified ? */
|
||||||
home = __imlib_FileHomeDir(getuid());
|
home = __imlib_FileHomeDir(getuid());
|
||||||
sprintf(s, "%s/.loaders/image/", home);
|
sprintf(s, "%s/" USER_LOADERS_PATH "/image/", home);
|
||||||
free(home);
|
free(home);
|
||||||
if (__imlib_FileIsDir(s))
|
if (__imlib_FileIsDir(s))
|
||||||
{
|
{
|
||||||
|
|
17
main.c
17
main.c
|
@ -169,14 +169,25 @@ int main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (interactive)
|
else if (interactive)
|
||||||
{
|
{
|
||||||
|
int wo, ho;
|
||||||
Imlib_Image im_bg, im_sh1, im_sh2, im_sh3, im_ic[13];
|
Imlib_Image im_bg, im_sh1, im_sh2, im_sh3, im_ic[13];
|
||||||
|
Imlib_Border border;
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
im_bg = imlib_load_image(file);
|
im_bg = imlib_load_image(file);
|
||||||
else
|
else
|
||||||
im_bg = imlib_load_image("test_images/bg.png");
|
im_bg = imlib_load_image("test_images/bg.png");
|
||||||
|
border.left = 8;
|
||||||
|
border.right = 8;
|
||||||
|
border.top = 8;
|
||||||
|
border.bottom = 8;
|
||||||
|
imlib_image_set_border(im_bg, &border);
|
||||||
w = imlib_image_get_width(im_bg);
|
w = imlib_image_get_width(im_bg);
|
||||||
h = imlib_image_get_height(im_bg);
|
h = imlib_image_get_height(im_bg);
|
||||||
|
wo = w;
|
||||||
|
ho = h;
|
||||||
|
w *= 10;
|
||||||
|
h *= 10;
|
||||||
XResizeWindow(disp, win, w, h);
|
XResizeWindow(disp, win, w, h);
|
||||||
im = imlib_create_image(w, h);
|
im = imlib_create_image(w, h);
|
||||||
imlib_set_cache_size(4 * 1024 * 1024);
|
imlib_set_cache_size(4 * 1024 * 1024);
|
||||||
|
@ -208,7 +219,7 @@ int main (int argc, char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
imlib_blend_image_onto_image(im_bg, im,
|
imlib_blend_image_onto_image(im_bg, im,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, w, h,
|
0, 0, wo, ho,
|
||||||
0, 0, w, h,
|
0, 0, w, h,
|
||||||
NULL, IMLIB_OP_COPY);
|
NULL, IMLIB_OP_COPY);
|
||||||
for (j = 0; j < 32; j++)
|
for (j = 0; j < 32; j++)
|
||||||
|
@ -230,7 +241,7 @@ int main (int argc, char **argv)
|
||||||
NULL, IMLIB_OP_COPY);
|
NULL, IMLIB_OP_COPY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imlib_blend_image_onto_image(im_sh1, im,
|
/* imlib_blend_image_onto_image(im_sh1, im,
|
||||||
aa, blend, 0,
|
aa, blend, 0,
|
||||||
0, 0, 50, 50,
|
0, 0, 50, 50,
|
||||||
0, 0, 50, 50, NULL, IMLIB_OP_COPY);
|
0, 0, 50, 50, NULL, IMLIB_OP_COPY);
|
||||||
|
@ -242,7 +253,7 @@ int main (int argc, char **argv)
|
||||||
aa, blend, 0,
|
aa, blend, 0,
|
||||||
0, 0, 50, 50,
|
0, 0, 50, 50,
|
||||||
0, 50, 50, h - 50, NULL, IMLIB_OP_COPY);
|
0, 50, 50, h - 50, NULL, IMLIB_OP_COPY);
|
||||||
imlib_render_image_on_drawable(im, disp, win, vis,
|
*/ imlib_render_image_on_drawable(im, disp, win, vis,
|
||||||
cm, depth, dith, 1, 0, 0, NULL,
|
cm, depth, dith, 1, 0, 0, NULL,
|
||||||
IMLIB_OP_COPY);
|
IMLIB_OP_COPY);
|
||||||
imlib_free_image(im_sh1);
|
imlib_free_image(im_sh1);
|
||||||
|
|
287
rgbadraw.c
287
rgbadraw.c
|
@ -5,4 +5,291 @@
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "rgba.h"
|
#include "rgba.h"
|
||||||
#include "blend.h"
|
#include "blend.h"
|
||||||
|
#include "rgbadraw.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_FlipImageHoriz(ImlibImage *im)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, tmp;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
for (y = 0; y < im->h; y++)
|
||||||
|
{
|
||||||
|
p1 = im->data + (y * im->w);
|
||||||
|
p2 = im->data + ((y + 1) * im->w) - 1;
|
||||||
|
for (x = 0; x < (im->w >> 1); x++)
|
||||||
|
{
|
||||||
|
tmp = *p1;
|
||||||
|
*p1 = *p2;
|
||||||
|
*p2 = tmp;
|
||||||
|
p1++;
|
||||||
|
p2--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_FlipImageVert(ImlibImage *im)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, tmp;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
for (y = 0; y < (im->h >> 1); y++)
|
||||||
|
{
|
||||||
|
p1 = im->data + (y * im->w);
|
||||||
|
p2 = im->data + ((im->h - 1 - y) * im->w);
|
||||||
|
for (x = 0; x < im->w; x++)
|
||||||
|
{
|
||||||
|
tmp = *p1;
|
||||||
|
*p1 = *p2;
|
||||||
|
*p2 = tmp;
|
||||||
|
p1++;
|
||||||
|
p2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_FlipImageDiagonal(ImlibImage *im)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, *data;
|
||||||
|
int x, y, tmp;
|
||||||
|
|
||||||
|
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||||
|
p1 = im->data;
|
||||||
|
for (y = im->h - 1; y >= 0; y--)
|
||||||
|
{
|
||||||
|
p2 = data + y;
|
||||||
|
for (x = 0; x < im->w; x++)
|
||||||
|
{
|
||||||
|
*p2 = *p1;
|
||||||
|
p2 += im->h;
|
||||||
|
p1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(im->data);
|
||||||
|
im->data = data;
|
||||||
|
tmp = im->w;
|
||||||
|
im->w = im->h;
|
||||||
|
im->h = tmp;
|
||||||
|
tmp = im->border.top;
|
||||||
|
im->border.top = im->border.left;
|
||||||
|
im->border.left = tmp;
|
||||||
|
tmp = im->border.bottom;
|
||||||
|
im->border.bottom = im->border.right;
|
||||||
|
im->border.right = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_BlurImage(ImlibImage *im, int rad)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, *data;
|
||||||
|
int x, y, mx, my, mw, mh, mt, xx, yy;
|
||||||
|
int a, r, g, b;
|
||||||
|
int *as, *rs, *gs, *bs;
|
||||||
|
|
||||||
|
if (rad < 1)
|
||||||
|
return;
|
||||||
|
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||||
|
as = malloc(sizeof(int) * im->w);
|
||||||
|
rs = malloc(sizeof(int) * im->w);
|
||||||
|
gs = malloc(sizeof(int) * im->w);
|
||||||
|
bs = malloc(sizeof(int) * im->w);
|
||||||
|
for (y = 0; y < im->h; y++)
|
||||||
|
{
|
||||||
|
my = y - rad;
|
||||||
|
mh = (rad << 1) + 1;
|
||||||
|
if (my < 0)
|
||||||
|
{
|
||||||
|
mh += my;
|
||||||
|
my = 0;
|
||||||
|
}
|
||||||
|
if ((my + mh) > im->h)
|
||||||
|
mh = im->h - my;
|
||||||
|
|
||||||
|
p1 = data + (y * im->w);
|
||||||
|
memset(as, 0, im->w * sizeof(int));
|
||||||
|
memset(rs, 0, im->w * sizeof(int));
|
||||||
|
memset(gs, 0, im->w * sizeof(int));
|
||||||
|
memset(bs, 0, im->w * sizeof(int));
|
||||||
|
for (yy = 0; yy < mh; yy++)
|
||||||
|
{
|
||||||
|
p2 = im->data + ((yy + my) * im->w);
|
||||||
|
for (x = 0; x < im->w; x++)
|
||||||
|
{
|
||||||
|
as[x] += (*p2 >> 24) & 0xff;
|
||||||
|
rs[x] += (*p2 >> 16) & 0xff;
|
||||||
|
gs[x] += (*p2 >> 8) & 0xff;
|
||||||
|
bs[x] += *p2 & 0xff;
|
||||||
|
p2 ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (im->w > ((rad << 1) + 1))
|
||||||
|
{
|
||||||
|
for (x = 0; x < im->w; x++)
|
||||||
|
{
|
||||||
|
a = 0; r = 0; g = 0; b = 0;
|
||||||
|
mx = x - rad;
|
||||||
|
mw = (rad << 1) + 1;
|
||||||
|
if (mx < 0)
|
||||||
|
{
|
||||||
|
mw += mx;
|
||||||
|
mx = 0;
|
||||||
|
}
|
||||||
|
if ((mx + mw) > im->w)
|
||||||
|
mw = im->w - mx;
|
||||||
|
mt = mw * mh;
|
||||||
|
for (xx = mx; xx < (mw + mx); xx++)
|
||||||
|
{
|
||||||
|
a += as[xx];
|
||||||
|
r += rs[xx];
|
||||||
|
g += gs[xx];
|
||||||
|
b += bs[xx];
|
||||||
|
}
|
||||||
|
a = a / mt; r = r / mt; g = g / mt; b = b / mt;
|
||||||
|
*p1 = (a << 24) | (r << 16) | (g << 8) | b;
|
||||||
|
p1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(as);
|
||||||
|
free(rs);
|
||||||
|
free(gs);
|
||||||
|
free(bs);
|
||||||
|
free(im->data);
|
||||||
|
im->data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_SharpenImage(ImlibImage *im, int rad)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_TileImageHoriz(ImlibImage *im)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, *p3, *p, *data;
|
||||||
|
int x, y, per, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr, gg, bb;
|
||||||
|
|
||||||
|
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||||
|
p1 = im->data;
|
||||||
|
p = data;
|
||||||
|
for (y = 0; y < im->h; y++)
|
||||||
|
{
|
||||||
|
p2 = p1 + (im->w >> 1);
|
||||||
|
p3 = p1;
|
||||||
|
per = (im->w >> 1);
|
||||||
|
for (x = 0; x < (im->w >> 1); x++)
|
||||||
|
{
|
||||||
|
mix = (x * 255) / per;
|
||||||
|
b = (*p1 ) & 0xff;
|
||||||
|
g = (*p1 >> 8 ) & 0xff;
|
||||||
|
r = (*p1 >> 16) & 0xff;
|
||||||
|
a = (*p1 >> 24) & 0xff;
|
||||||
|
|
||||||
|
bb = (*p2 ) & 0xff;
|
||||||
|
gg = (*p2 >> 8 ) & 0xff;
|
||||||
|
rr = (*p2 >> 16) & 0xff;
|
||||||
|
aa = (*p2 >> 24) & 0xff;
|
||||||
|
|
||||||
|
tmp = (r - rr) * mix;
|
||||||
|
nr = rr + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (g - gg) * mix;
|
||||||
|
ng = gg + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (b - bb) * mix;
|
||||||
|
nb = bb + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (a - aa) * mix;
|
||||||
|
na = aa + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
*p = (na << 24) | (nr << 16) | (ng << 8) | nb;
|
||||||
|
p++;
|
||||||
|
p1++;
|
||||||
|
p2++;
|
||||||
|
}
|
||||||
|
p2 = p3;
|
||||||
|
per = (im->w - (im->w >> 1));
|
||||||
|
for (; x < im->w; x++)
|
||||||
|
{
|
||||||
|
mix = ((im->w - 1 - x) * 255) / per;
|
||||||
|
b = (*p1 ) & 0xff;
|
||||||
|
g = (*p1 >> 8 ) & 0xff;
|
||||||
|
r = (*p1 >> 16) & 0xff;
|
||||||
|
a = (*p1 >> 24) & 0xff;
|
||||||
|
|
||||||
|
bb = (*p2 ) & 0xff;
|
||||||
|
gg = (*p2 >> 8 ) & 0xff;
|
||||||
|
rr = (*p2 >> 16) & 0xff;
|
||||||
|
aa = (*p2 >> 24) & 0xff;
|
||||||
|
|
||||||
|
tmp = (r - rr) * mix;
|
||||||
|
nr = rr + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (g - gg) * mix;
|
||||||
|
ng = gg + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (b - bb) * mix;
|
||||||
|
nb = bb + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (a - aa) * mix;
|
||||||
|
na = aa + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
*p = (na << 24) | (nr << 16) | (ng << 8) | nb;
|
||||||
|
p++;
|
||||||
|
p1++;
|
||||||
|
p2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(im->data);
|
||||||
|
im->data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__imlib_TileImageVert(ImlibImage *im)
|
||||||
|
{
|
||||||
|
DATA32 *p1, *p2, *p, *data;
|
||||||
|
int x, y, per, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr, gg, bb;
|
||||||
|
|
||||||
|
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||||
|
p = data;
|
||||||
|
for (y = 0; y < im->h; y++)
|
||||||
|
{
|
||||||
|
p1 = im->data + (y * im->w);
|
||||||
|
if (y < (im->h >> 1))
|
||||||
|
{
|
||||||
|
p2 = im->data + ((y + (im->h >> 1)) * im->w);
|
||||||
|
mix = (y * 255) / (im->h >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p2 = im->data + ((y - (im->h - (im->h >> 1))) * im->w);
|
||||||
|
mix = ((im->h - y) * 255) / (im->h - (im->h >> 1));
|
||||||
|
}
|
||||||
|
for (x = 0; x < im->w; x++)
|
||||||
|
{
|
||||||
|
b = (*p1 ) & 0xff;
|
||||||
|
g = (*p1 >> 8 ) & 0xff;
|
||||||
|
r = (*p1 >> 16) & 0xff;
|
||||||
|
a = (*p1 >> 24) & 0xff;
|
||||||
|
|
||||||
|
bb = (*p2 ) & 0xff;
|
||||||
|
gg = (*p2 >> 8 ) & 0xff;
|
||||||
|
rr = (*p2 >> 16) & 0xff;
|
||||||
|
aa = (*p2 >> 24) & 0xff;
|
||||||
|
|
||||||
|
tmp = (r - rr) * mix;
|
||||||
|
nr = rr + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (g - gg) * mix;
|
||||||
|
ng = gg + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (b - bb) * mix;
|
||||||
|
nb = bb + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
tmp = (a - aa) * mix;
|
||||||
|
na = aa + ((tmp + (tmp >> 8) + 0x80) >> 8);
|
||||||
|
*p = (na << 24) | (nr << 16) | (ng << 8) | nb;
|
||||||
|
p++;
|
||||||
|
p1++;
|
||||||
|
p2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(im->data);
|
||||||
|
im->data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
#ifndef __RGBADRAW
|
#ifndef __RGBADRAW
|
||||||
#define __RGBADRAW 1
|
#define __RGBADRAW 1
|
||||||
|
void __imlib_FlipImageHoriz(ImlibImage *im);
|
||||||
|
void __imlib_FlipImageVert(ImlibImage *im);
|
||||||
|
void __imlib_FlipImageDiagonal(ImlibImage *im);
|
||||||
|
void __imlib_BlurImage(ImlibImage *im, int rad);
|
||||||
|
void __imlib_SharpenImage(ImlibImage *im, int rad);
|
||||||
|
void __imlib_TileImageHoriz(ImlibImage *im);
|
||||||
|
void __imlib_TileImageVert(ImlibImage *im);
|
||||||
#endif
|
#endif
|
||||||
|
|
88
updates.c
88
updates.c
|
@ -4,16 +4,12 @@
|
||||||
enum _t_used
|
enum _t_used
|
||||||
{
|
{
|
||||||
T_UNUSED = 0,
|
T_UNUSED = 0,
|
||||||
T_USED = 1,
|
T_USED = 1
|
||||||
T_SPAN_H = 2,
|
|
||||||
T_SPAN_V = 4,
|
|
||||||
T_DONE = 8
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _tile
|
struct _tile
|
||||||
{
|
{
|
||||||
enum _t_used used;
|
enum _t_used used;
|
||||||
int min_x, min_y, max_x, max_y;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TB 5
|
#define TB 5
|
||||||
|
@ -33,7 +29,7 @@ __imlib_MergeUpdate(ImlibUpdate *u, int w, int h)
|
||||||
{
|
{
|
||||||
ImlibUpdate *nu = NULL, *uu;
|
ImlibUpdate *nu = NULL, *uu;
|
||||||
struct _tile *t;
|
struct _tile *t;
|
||||||
int tw, th, x, y, i, r1, r2;
|
int tw, th, x, y, i;
|
||||||
|
|
||||||
/* if theres no rects to process.. return NULL */
|
/* if theres no rects to process.. return NULL */
|
||||||
if (!u)
|
if (!u)
|
||||||
|
@ -48,9 +44,8 @@ __imlib_MergeUpdate(ImlibUpdate *u, int w, int h)
|
||||||
if (h & TM)
|
if (h & TM)
|
||||||
th++;
|
th++;
|
||||||
t = malloc(tw * th * sizeof(struct _tile));
|
t = malloc(tw * th * sizeof(struct _tile));
|
||||||
i = 0;
|
|
||||||
/* fill in tiles to be all not used */
|
/* fill in tiles to be all not used */
|
||||||
for (y = 0; y < th; y++)
|
for (i = 0, y = 0; y < th; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < tw; x++)
|
for (x = 0; x < tw; x++)
|
||||||
t[i++].used = T_UNUSED;
|
t[i++].used = T_UNUSED;
|
||||||
|
@ -62,78 +57,41 @@ __imlib_MergeUpdate(ImlibUpdate *u, int w, int h)
|
||||||
for (y = uu->y >> TB; y < ((uu->y + uu->h - 1) >> TB) + 1; y++)
|
for (y = uu->y >> TB; y < ((uu->y + uu->h - 1) >> TB) + 1; y++)
|
||||||
{
|
{
|
||||||
for (x = uu->x >> TB; x < ((uu->x + uu->w - 1) >> TB) + 1; x++)
|
for (x = uu->x >> TB; x < ((uu->x + uu->w - 1) >> TB) + 1; x++)
|
||||||
{
|
|
||||||
if (T(x, y).used == T_USED)
|
|
||||||
{
|
|
||||||
int xx, yy;
|
|
||||||
|
|
||||||
xx = MAX(uu->x, x << TB);
|
|
||||||
yy = MAX(uu->y, y << TB);
|
|
||||||
T(x, y).min_x = (MIN(xx, T(x, y).min_x)) - (x << TB);
|
|
||||||
T(x, y).min_y = (MIN(yy, T(x, y).min_y)) - (y << TB);
|
|
||||||
xx = MIN(uu->x + uu->w - 1, ((x + 1) << TB) - 1);
|
|
||||||
yy = MIN(uu->y + uu->h - 1, ((y + 1) << TB) - 1);
|
|
||||||
T(x, y).max_x = (MAX(xx, T(x, y).max_x)) - (x << TB);
|
|
||||||
T(x, y).max_y = (MAX(yy, T(x, y).max_y)) - (y << TB);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
T(x, y).used = T_USED;
|
T(x, y).used = T_USED;
|
||||||
T(x, y).min_x = (MAX(x << TB, uu->x)) - (x << TB);
|
|
||||||
T(x, y).min_y = (MAX(y << TB, uu->y)) - (y << TB);
|
|
||||||
T(x, y).max_x = (MIN(((x + 1) << TB) - 1, uu->x + uu->w - 1)) - (x << TB);
|
|
||||||
T(x, y).max_y = (MIN(((y + 1) << TB) - 1, uu->y + uu->h - 1)) - (y << TB);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
/* concatinate tiles horizontally */
|
|
||||||
for (y = 0; y < th; y++)
|
for (y = 0; y < th; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < tw - 1; x++)
|
for (x = 0; x < tw - 1; x++)
|
||||||
{
|
{
|
||||||
if ((T(x, y).max_x == TM) && (T(x + 1, y).min_x == 0) &&
|
if (T(x + 1, y).used & T_USED)
|
||||||
(T(x, y).min_y == T(x + 1, y).min_y) &&
|
{
|
||||||
(T(x, y).max_y == T(x + 1, y).max_y))
|
int xx, yy, ww, hh, ok;
|
||||||
T(x, y).used |= T_SPAN_H;
|
|
||||||
|
for (xx = x, ww = 0; (T(xx, y).used & T_USED) && (xx < tw);
|
||||||
|
xx++, ww++);
|
||||||
|
for (yy = y, hh = 1, ok = 1; (yy < th) && (ok); yy++, hh++)
|
||||||
|
{
|
||||||
|
for (xx = x; xx < ww; xx++)
|
||||||
|
{
|
||||||
|
if (!(T(xx, yy).used & T_USED))
|
||||||
|
{
|
||||||
|
ok = 0;
|
||||||
|
xx = ww;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* concatinate tiles vertically */
|
if (ok)
|
||||||
for (y = 0; y < th - 1; y++)
|
|
||||||
{
|
{
|
||||||
for (x = 0; x < tw; x++)
|
for (xx = x; xx < ww; xx++)
|
||||||
{
|
T(xx, yy).used = T_UNUSED;
|
||||||
if ((T(x, y).max_y == TM) && (T(x, y + 1).min_y == 0) &&
|
|
||||||
(T(x, y).min_x == T(x, y + 1).min_x) &&
|
|
||||||
(T(x, y).max_x == T(x, y + 1).max_x))
|
|
||||||
T(x, y).used |= T_SPAN_V;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* generate new rect list from tiles */
|
nu = __imlib_AddUpdate(nu, (x << TB), (y << TB),
|
||||||
for (y = 0; y < th; y++)
|
(ww << TB), (hh << TB));
|
||||||
{
|
}
|
||||||
for (x = 0; x < tw; x++)
|
|
||||||
{
|
|
||||||
if (!(T(x, y).used & (T_SPAN_H | T_SPAN_V)))
|
|
||||||
nu = __imlib_AddUpdate(nu,
|
|
||||||
(x << TB) + T(x, y).min_x,
|
|
||||||
(y << TB) + T(x, y).min_y,
|
|
||||||
(T(x, y).max_x - T(x, y).min_x) + 1,
|
|
||||||
(T(x, y).max_y - T(x, y).min_y) + 1);
|
|
||||||
/* keep going here */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(t);
|
free(t);
|
||||||
/* count up our "update rects" */
|
|
||||||
for (r1 = 0, uu = u; uu; uu = uu->next, r1++);
|
|
||||||
for (r2 = 0, uu = nu; uu; uu = uu->next, r2++);
|
|
||||||
/* if our original rect list is smaller r the same size as the new rect */
|
|
||||||
/* list then just use the original rect list */
|
|
||||||
if (r1 <= r2)
|
|
||||||
{
|
|
||||||
__imlib_FreeUpdates(nu);
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
__imlib_FreeUpdates(u);
|
__imlib_FreeUpdates(u);
|
||||||
return nu;
|
return nu;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue