summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2004-11-01 09:34:29 +0000
committerCarsten Haitzler <raster@rasterman.com>2004-11-01 09:34:29 +0000
commit31660022d05efa77cd606e4ebf8d2e43bc492027 (patch)
tree21b0a6ff5f28ad5f27a8c3e7af206b779910075f /test
parent4c824dfe923d00b9900a00f5098366d749e9deb8 (diff)
downloadimlib2-31660022d05efa77cd606e4ebf8d2e43bc492027.tar.gz
remooov!
SVN revision: 12112
Diffstat (limited to 'test')
-rw-r--r--test/.cvsignore27
-rw-r--r--test/Makefile.am61
-rw-r--r--test/bmtest.c127
-rw-r--r--test/color_spaces.c142
-rw-r--r--test/imlib2_test.c273
-rw-r--r--test/main.c1377
-rw-r--r--test/polytest.c126
-rw-r--r--test/test_images/.cvsignore1
-rw-r--r--test/test_images/audio.pngbin4263 -> 0 bytes
-rw-r--r--test/test_images/bg.pngbin132721 -> 0 bytes
-rw-r--r--test/test_images/bulb.pngbin3504 -> 0 bytes
-rw-r--r--test/test_images/cal.pngbin2755 -> 0 bytes
-rw-r--r--test/test_images/calc.pngbin3949 -> 0 bytes
-rw-r--r--test/test_images/folder.pngbin2873 -> 0 bytes
-rw-r--r--test/test_images/globe.pngbin3388 -> 0 bytes
-rw-r--r--test/test_images/imlib2.pngbin53192 -> 0 bytes
-rw-r--r--test/test_images/lock.pngbin2770 -> 0 bytes
-rw-r--r--test/test_images/mail.pngbin3222 -> 0 bytes
-rw-r--r--test/test_images/menu.pngbin3240 -> 0 bytes
-rw-r--r--test/test_images/mush.pngbin3244 -> 0 bytes
-rw-r--r--test/test_images/paper.pngbin3410 -> 0 bytes
-rw-r--r--test/test_images/sh1.pngbin768 -> 0 bytes
-rw-r--r--test/test_images/sh2.pngbin280 -> 0 bytes
-rw-r--r--test/test_images/sh3.pngbin360 -> 0 bytes
-rw-r--r--test/test_images/stop.pngbin2684 -> 0 bytes
-rw-r--r--test/test_images/tnt.pngbin3010 -> 0 bytes
-rw-r--r--test/ttfonts/cinema.ttfbin11584 -> 0 bytes
-rw-r--r--test/ttfonts/grunge.ttfbin53189 -> 0 bytes
-rw-r--r--test/ttfonts/morpheus.ttfbin68023 -> 0 bytes
-rw-r--r--test/ttfonts/notepad.ttfbin31293 -> 0 bytes
30 files changed, 0 insertions, 2134 deletions
diff --git a/test/.cvsignore b/test/.cvsignore
deleted file mode 100644
index ce9b038..0000000
--- a/test/.cvsignore
+++ /dev/null
@@ -1,27 +0,0 @@
-config.guess
-config.h.in
-config.sub
-ltconfig
-ltmain.sh
-aclocal.m4
-stamp-h.in
-Makefile.in
-configure
-config.log
-config.h
-config.cache
-libtool
-config.status
-stamp-h
-Makefile
-.deps
-.libs
-*.lo
-*.la
-imlib2
-loaderpath.h
-.icons
-bumpmaptest
-imlib2_test
-polytest
-core
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index fb12766..0000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-AUTOMAKE_OPTIONS = 1.4 foreign
-
-# A list of all the files in the current directory which can be regenerated
-MAINTAINERCLEANFILES = Makefile.in
-
-LDFLAGS = -L/usr/X11R6/lib
-INCLUDES = -I. -I$(top_srcdir) -I$(top_srcdir)/src \
- -I$(top_srcdir)/loaders -I$(top_srcdir)/libltdl \
- -I/usr/X11R6/include $(X_CFLAGS) \
- -I$(prefix)/include -I$(includedir)
-
-if HAVE_X
-
-bin_PROGRAMS = imlib2 bumpmaptest imlib2_test polytest color_spaces
-imlib2_SOURCES = main.c
-imlib2_LDADD = $(top_builddir)/src/libImlib2.la
-
-bumpmaptest_SOURCES = bmtest.c
-bumpmaptest_LDADD = $(top_builddir)/src/libImlib2.la
-
-imlib2_test_SOURCES = imlib2_test.c
-imlib2_test_LDADD = $(top_builddir)/src/libImlib2.la
-
-polytest_SOURCES = polytest.c
-polytest_LDADD = $(top_builddir)/src/libImlib2.la
-
-color_spaces_SOURCES = color_spaces.c
-color_spaces_LDADD = $(top_builddir)/src/libImlib2.la
-
-endif
-
-EXTRA_DIST = \
-test_images/audio.png \
-test_images/bg.png \
-test_images/bulb.png \
-test_images/cal.png \
-test_images/calc.png \
-test_images/folder.png \
-test_images/globe.png \
-test_images/imlib2.png \
-test_images/lock.png \
-test_images/mail.png \
-test_images/menu.png \
-test_images/mush.png \
-test_images/paper.png \
-test_images/sh1.png \
-test_images/sh2.png \
-test_images/sh3.png \
-test_images/stop.png \
-test_images/tnt.png \
-ttfonts/cinema.ttf \
-ttfonts/grunge.ttf \
-ttfonts/morpheus.ttf \
-ttfonts/notepad.ttf \
-bmtest.c \
-color_spaces.c \
-imlib2_test.c \
-main.c \
-polytest.c
diff --git a/test/bmtest.c b/test/bmtest.c
deleted file mode 100644
index 5a48138..0000000
--- a/test/bmtest.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-#include <X11/Xatom.h>
-#include <X11/Xos.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-
-/*
-#include <sys/time.h>
-#include "common.h"
-#include "image.h"
-#include "rend.h"
-#include "rgba.h"
-#include "ximage.h"
-#include "color.h"
- */
-#include "Imlib2.h"
-
-Display *disp;
-Window win;
-Visual *vis;
-Colormap cm;
-int depth;
-
-int
-main(int argc, char **argv)
-{
- int i, j, w, h, x, y;
- Imlib_Image im = NULL, im_bg = NULL;
- XEvent ev;
-
- /**
- * Initialization according to options
- */
- printf("Initialising\n");
-
- /**
- * First tests to determine which rendering task to perform
- */
- disp = XOpenDisplay(NULL);
- vis = DefaultVisual(disp, DefaultScreen(disp));
- depth = DefaultDepth(disp, DefaultScreen(disp));
- cm = DefaultColormap(disp, DefaultScreen(disp));
- win =
- XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 100, 100, 0, 0,
- 0);
- XSelectInput(disp, win,
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
- PointerMotionMask | ExposureMask);
- XMapWindow(disp, win);
-
- /**
- * Start rendering
- */
- printf("Rendering\n");
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- imlib_context_set_dither(1);
- imlib_context_set_blend(0);
- imlib_context_set_color_modifier(NULL);
-
- im_bg = imlib_load_image("test_images/imlib2.png");
- im = imlib_load_image("test_images/imlib2.png");
-
- imlib_context_set_image(im_bg);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- printf("Resizing Window to %d by %d\n", w, h);
- XResizeWindow(disp, win, w, h);
- XSync(disp, False);
- x = -9999;
- y = -9999;
- while (1)
- {
- Imlib_Image *temp, *temp2;
-
- do
- {
- XNextEvent(disp, &ev);
- switch (ev.type)
- {
- case Expose:
- break;
- case ButtonRelease:
- exit(0);
- break;
- case MotionNotify:
- x = ev.xmotion.x;
- y = ev.xmotion.y;
- default:
- break;
-
- }
- }
- while (XPending(disp));
-
- imlib_context_set_blend(0);
- imlib_context_set_image(im_bg);
- temp = imlib_clone_image();
- imlib_context_set_image(temp);
-
- /* imlib_blend_image_onto_image(im_bg, 0,
- * 0, 0, w, h,
- * 0, 0, w, h);
- * first = 0; */
-
- imlib_apply_filter
- ("bump_map_point(x=[],y=[],map=test_images/imlib2.png);", &x, &y);
-
- temp2 = im_bg;
- im_bg = temp;
- imlib_context_set_image(im_bg);
- imlib_render_image_on_drawable(0, 0);
- im_bg = temp2;
- imlib_context_set_image(temp);
- imlib_free_image();
- }
-
- return 0;
-}
diff --git a/test/color_spaces.c b/test/color_spaces.c
deleted file mode 100644
index c5cc593..0000000
--- a/test/color_spaces.c
+++ /dev/null
@@ -1,142 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-#include <X11/Xatom.h>
-#include <X11/Xos.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-
-#include "Imlib2.h"
-
-Display *disp;
-Window win;
-Visual *vis;
-Colormap cm;
-int depth;
-
-int
-main(int argc, char **argv)
-{
- int w, h, tw, th;
- Imlib_Image im_bg = NULL;
- XEvent ev;
- KeySym keysym;
- static char kbuf[20];
- Imlib_Font font;
- Imlib_Color_Range range;
-
- /**
- * First tests to determine which rendering task to perform
- */
- disp = XOpenDisplay(NULL);
- vis = DefaultVisual(disp, DefaultScreen(disp));
- depth = DefaultDepth(disp, DefaultScreen(disp));
- cm = DefaultColormap(disp, DefaultScreen(disp));
- win =
- XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 100, 100, 0, 0,
- 0);
- XSelectInput(disp, win,
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
- PointerMotionMask | ExposureMask | KeyPressMask);
- XMapWindow(disp, win);
-
- /**
- * Start rendering
- */
- imlib_set_font_cache_size(512 * 1024);
- imlib_add_path_to_font_path("./ttfonts");
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- imlib_context_set_blend(0);
- imlib_context_set_color_modifier(NULL);
- imlib_context_set_blend(0);
-
- im_bg = imlib_create_image(600, 400);
- imlib_context_set_image(im_bg);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- imlib_context_set_color(128, 128, 255, 255);
- imlib_image_fill_rectangle(0, 0, w, h);
- XResizeWindow(disp, win, w, h);
- XSync(disp, False);
-
- while (1)
- {
- do
- {
- XNextEvent(disp, &ev);
- switch (ev.type)
- {
- case ButtonRelease:
- exit(0);
- break;
- case KeyPress:
- XLookupString(&ev.xkey, (char *)kbuf, sizeof(kbuf), &keysym,
- NULL);
- switch (*kbuf)
- {
- case 'q':
- exit(0);
- default:
- break;
- }
- break;
- default:
- break;
-
- }
- }
- while (XPending(disp));
-
- imlib_context_set_image(im_bg);
- imlib_context_set_color(128, 128, 255, 255);
- imlib_image_fill_rectangle(0, 0, w, h);
- imlib_context_set_color(0, 0, 0, 255);
- imlib_image_draw_rectangle(20, 20, 560, 140);
- imlib_image_draw_rectangle(20, 220, 560, 140);
- font = imlib_load_font("notepad/15");
- if (font)
- {
- char text[4096];
-
- imlib_context_set_font(font);
- imlib_context_set_color(0, 0, 0, 255);
- sprintf(text, "RGBA range, 2 points, from red to magenta");
- imlib_get_text_size(text, &tw, &th);
- imlib_text_draw(300 - tw / 2, 180 - th / 2, text);
- sprintf(text, "HSVA range, 2 points, from red to magenta");
- imlib_get_text_size(text, &tw, &th);
- imlib_text_draw(300 - tw / 2, 380 - th / 2, text);
- imlib_free_font();
- }
-
- /* Draw rectangle w/ RGBA gradient */
- range = imlib_create_color_range();
- imlib_context_set_color_range(range);
- imlib_context_set_color(255, 0, 0, 255);
- imlib_add_color_to_color_range(0);
- imlib_context_set_color(255, 0, 255, 255);
- imlib_add_color_to_color_range(20);
- imlib_image_fill_color_range_rectangle(21, 21, 558, 138, -90.0);
- imlib_free_color_range();
-
- /* Draw rectangle w/ HSVA gradient */
- range = imlib_create_color_range();
- imlib_context_set_color_range(range);
- imlib_context_set_color_hsva(0, 1, 1, 255);
- imlib_add_color_to_color_range(0);
- imlib_context_set_color_hsva(300, 1, 1, 255);
- imlib_add_color_to_color_range(20);
- imlib_image_fill_hsva_color_range_rectangle(21, 221, 558, 138, -90.0);
- imlib_free_color_range();
-
- imlib_render_image_on_drawable(0, 0);
- }
- return 0;
-}
diff --git a/test/imlib2_test.c b/test/imlib2_test.c
deleted file mode 100644
index 68d01aa..0000000
--- a/test/imlib2_test.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* include X11 stuff */
-#include <X11/Xlib.h>
-/* include Imlib2 stuff */
-#include <Imlib2.h>
-/* sprintf include */
-#include <stdio.h>
-
-/* some globals for our window & X display */
-Display *disp;
-Window win;
-Visual *vis;
-Colormap cm;
-int depth;
-
-/* the program... */
-int
-main(int argc, char **argv)
-{
- /* events we get from X */
- XEvent ev;
-
- /* areas to update */
- Imlib_Updates updates, current_update;
-
- /* our virtual framebuffer image we draw into */
- Imlib_Image buffer;
-
- /* a font */
- Imlib_Font font;
-
- /* our color range */
- Imlib_Color_Range range;
-
- /* our mouse x, y coordinates */
- int mouse_x = 0, mouse_y = 0;
-
- /* connect to X */
- disp = XOpenDisplay(NULL);
- /* get default visual , colormap etc. you could ask imlib2 for what it */
- /* thinks is the best, but this example is intended to be simple */
- vis = DefaultVisual(disp, DefaultScreen(disp));
- depth = DefaultDepth(disp, DefaultScreen(disp));
- cm = DefaultColormap(disp, DefaultScreen(disp));
- /* create a window 640x480 */
- win = XCreateSimpleWindow(disp, DefaultRootWindow(disp),
- 0, 0, 640, 480, 0, 0, 0);
- /* tell X what events we are interested in */
- XSelectInput(disp, win, ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | ExposureMask);
- /* show the window */
- XMapWindow(disp, win);
- /* set our cache to 2 Mb so it doesnt have to go hit the disk as long as */
- /* the images we use use less than 2Mb of RAM (that is uncompressed) */
- imlib_set_cache_size(2048 * 1024);
- /* set the font cache to 512Kb - again to avoid re-loading */
- imlib_set_font_cache_size(512 * 1024);
- /* add the ./ttfonts dir to our font path - you'll want a notepad.ttf */
- /* in that dir for the text to display */
- imlib_add_path_to_font_path("./ttfonts");
- /* set the maximum number of colors to allocate for 8bpp and less to 128 */
- imlib_set_color_usage(128);
- /* dither for depths < 24bpp */
- imlib_context_set_dither(1);
- /* set the display , visual, colormap and drawable we are using */
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- /* infinite event loop */
- for (;;)
- {
- /* image variable */
- Imlib_Image image;
-
- /* width and height values */
- int w, h, text_w, text_h;
-
- /* init our updates to empty */
- updates = imlib_updates_init();
- /* while there are events form X - handle them */
- do
- {
- XNextEvent(disp, &ev);
- switch (ev.type)
- {
- case Expose:
- /* window rectangle was exposed - add it to the list of */
- /* rectangles we need to re-render */
- updates = imlib_update_append_rect(updates,
- ev.xexpose.x,
- ev.xexpose.y,
- ev.xexpose.width,
- ev.xexpose.height);
- break;
- case ButtonPress:
- /* if we click anywhere in the window, exit */
- exit(0);
- break;
- case MotionNotify:
- /* if the mouse moves - note it */
- /* add a rectangle update for the new mouse position */
- image = imlib_load_image("./test_images/mush.png");
- imlib_context_set_image(image);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- imlib_context_set_image(image);
- imlib_free_image();
- /* the old position - so we wipe over where it used to be */
- updates = imlib_update_append_rect(updates,
- mouse_x - (w / 2),
- mouse_y - (h / 2), w, h);
- font = imlib_load_font("notepad/30");
- if (font)
- {
- char text[4096];
-
- imlib_context_set_font(font);
- sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
- imlib_get_text_size(text, &text_w, &text_h);
- imlib_free_font();
- updates = imlib_update_append_rect(updates,
- 320 - (text_w / 2),
- 240 - (text_h / 2),
- text_w, text_h);
- }
-
- mouse_x = ev.xmotion.x;
- mouse_y = ev.xmotion.y;
- /* the new one */
- updates = imlib_update_append_rect(updates,
- mouse_x - (w / 2),
- mouse_y - (h / 2), w, h);
- font = imlib_load_font("notepad/30");
- if (font)
- {
- char text[4096];
-
- imlib_context_set_font(font);
- sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
- imlib_get_text_size(text, &text_w, &text_h);
- imlib_free_font();
- updates = imlib_update_append_rect(updates,
- 320 - (text_w / 2),
- 240 - (text_h / 2),
- text_w, text_h);
- }
- default:
- /* any other events - do nothing */
- break;
- }
- }
- while (XPending(disp));
-
- /* no more events for now ? ok - idle time so lets draw stuff */
-
- /* take all the little rectangles to redraw and merge them into */
- /* something sane for rendering */
- updates = imlib_updates_merge_for_rendering(updates, 640, 480);
- for (current_update = updates;
- current_update;
- current_update = imlib_updates_get_next(current_update))
- {
- int up_x, up_y, up_w, up_h;
-
- /* find out where the first update is */
- imlib_updates_get_coordinates(current_update,
- &up_x, &up_y, &up_w, &up_h);
-
- /* create our buffer image for renderign this update */
- buffer = imlib_create_image(up_w, up_h);
-
- /* we can blend stuff now */
- imlib_context_set_blend(1);
-
- /* fill the window background */
- /* load the background image - you'll need to have some images */
- /* in ./test_images lying around for this to actually work */
- image = imlib_load_image("./test_images/bg.png");
- /* we're working with this image now */
- imlib_context_set_image(image);
- /* get its size */
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- /* now we want to work with the buffer */
- imlib_context_set_image(buffer);
- /* if the iimage loaded */
- if (image)
- {
- /* blend image onto the buffer and scale it to 640x480 */
- imlib_blend_image_onto_image(image, 0,
- 0, 0, w, h,
- -up_x, -up_y, 640, 480);
- /* working with the loaded image */
- imlib_context_set_image(image);
- /* free it */
- imlib_free_image();
- }
-
- /* draw an icon centered around the mouse position */
- image = imlib_load_image("./test_images/mush.png");
- imlib_context_set_image(image);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- imlib_context_set_image(buffer);
- if (image)
- {
- imlib_blend_image_onto_image(image, 0,
- 0, 0, w, h,
- mouse_x - (w / 2) - up_x,
- mouse_y - (h / 2) - up_y, w, h);
- imlib_context_set_image(image);
- imlib_free_image();
- }
-
- /* draw a gradient on top of things at the top left of the window */
- /* create a range */
- range = imlib_create_color_range();
- imlib_context_set_color_range(range);
- /* add white opaque as the first color */
- imlib_context_set_color(255, 255, 255, 255);
- imlib_add_color_to_color_range(0);
- /* add an orange color, semi-transparent 10 units from the first */
- imlib_context_set_color(255, 200, 10, 100);
- imlib_add_color_to_color_range(10);
- /* add black, fully transparent at the end 20 units away */
- imlib_context_set_color(0, 0, 0, 0);
- imlib_add_color_to_color_range(20);
- /* draw the range */
- imlib_context_set_image(buffer);
- imlib_image_fill_color_range_rectangle(-up_x, -up_y, 128, 128,
- -45.0);
- /* free it */
- imlib_free_color_range();
-
- /* draw text - centered with the current mouse x, y */
- font = imlib_load_font("notepad/30");
- if (font)
- {
- char text[4096];
-
- /* set the current font */
- imlib_context_set_font(font);
- /* set the image */
- imlib_context_set_image(buffer);
- /* set the color (black) */
- imlib_context_set_color(0, 0, 0, 255);
- /* print text to display in the buffer */
- sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
- /* query the size it will be */
- imlib_get_text_size(text, &text_w, &text_h);
- /* draw it */
- imlib_text_draw(320 - (text_w / 2) - up_x,
- 240 - (text_h / 2) - up_y, text);
- /* free the font */
- imlib_free_font();
- }
-
- /* dont blend the image onto the drawable - slower */
- imlib_context_set_blend(0);
- /* set the buffer image as our current image */
- imlib_context_set_image(buffer);
- /* render the image at 0, 0 */
- imlib_render_image_on_drawable(up_x, up_y);
- /* don't need that temproary buffer image anymore */
- imlib_free_image();
- }
- /* if we had updates - free them */
- if (updates)
- imlib_updates_free(updates);
- /* loop again waiting for events */
- }
- return 0;
-}
diff --git a/test/main.c b/test/main.c
deleted file mode 100644
index 1f5a0e3..0000000
--- a/test/main.c
+++ /dev/null
@@ -1,1377 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-#include <X11/Xatom.h>
-#include <X11/Xos.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-#include <locale.h>
-
-/*
-#include <sys/time.h>
-#include "common.h"
-#include "image.h"
-#include "rend.h"
-#include "rgba.h"
-#include "ximage.h"
-#include "color.h"
- */
-#include "Imlib2.h"
-
-Display *disp;
-Window win;
-Visual *vis;
-Colormap cm;
-int depth;
-
-void progress(Imlib_Image * im, char percent, int update_x,
- int update_y, int update_w, int update_h);
-
-void
-progress(Imlib_Image * im, char percent,
- int update_x, int update_y, int update_w, int update_h)
-{
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- imlib_context_set_dither(0);
- imlib_context_set_blend(0);
- imlib_context_set_color_modifier(NULL);
- imlib_context_set_operation(IMLIB_OP_COPY);
- imlib_context_set_image(im);
- imlib_render_image_part_on_drawable_at_size(update_x, update_y,
- update_w, update_h,
- update_x, update_y,
- update_w, update_h);
-}
-
-int
-main(int argc, char **argv)
-{
- int i, j;
- Imlib_Image *im = NULL;
- int sec1, usec1, sec2, usec2;
- int pixels = 0;
- struct timeval timev;
- double sec;
- char *file = NULL;
- char *fon = NULL, *str = NULL;
-
- int root = 0;
- int scale = 0;
- int w = 20;
- int h = 20;
- int aa = 0;
- int dith = 0;
- int loop = 0;
- int blend = 1;
- int interactive = 1;
- int blendtest = 0;
- int filter = 0;
- int pol = 0;
- int rotate = 0;
- int rottest = 0;
- int scaleup = 0;
- int scaleboth = 0;
- int origone = 0;
- int bump_map_to_point = 0;
- Imlib_Color_Modifier colormod = 0;
- ImlibPolygon poly, poly2, poly3;
- int textdir = IMLIB_TEXT_TO_RIGHT;
- int xfdtest = 0;
- int xfdcachetest = 0;
- char *xfdfname = NULL;
- int xfdloop = 1;
-
- /* now we'll set the locale */
- setlocale(LC_ALL, "");
- if (!XSupportsLocale())
- setlocale(LC_ALL, "C");
- XSetLocaleModifiers("");
- setlocale(LC_ALL, NULL);
-
- /**
- * Parse all the command line arguments
- */
- if ((argc > 1) && (!strcmp(argv[1], "-help")))
- {
- printf("Imlib2 program test. (Imlib v2.0.0.4)\n");
- printf("usage: imlib2 [options] [file]\n");
- printf("options are:\n");
- printf("-help\t\tDisplays this help.\n");
- printf("-root\t\tDraw in the root window.\n");
- printf("-smooth\t\tWhen scaling images scale with anti-aliasing.\n");
- printf("-up\t\tWhen doing scal test scale up, not down.\n");
- printf("-both\t\tScale horizontally AND vertically in scale test.\n");
- printf
- ("-orig\t\tKeep original width and height in each pass of scale test.\n");
- printf("-blend\t\tBlending test.\n");
- printf("-dither\t\tTurn dithering on for depths < 24bpp\n");
- printf("-colormod <r> <g> <b> <a>\t\tSet up color mod tables\n");
- printf("-scale\t\tScale test.\n");
- printf("-noloop\t\tDont loop - timing test.\n");
- printf
- ("-rotate\t\tAlso rotate background image with mouse in interative test.\n");
- printf("-size <w> <h>\t\tScale from w x h down in scaling test.\n"); // require parameters w / h
- printf("-maxcolors <n>\t\tLimit color allocation count to n colors.\n"); // require parameter nb colors
- printf
- ("-text\t\tDisplays the text following this option. Need a loaded font.\n");
- printf
- ("-font\t\tLoads a font. The parameter must follow the police_name/size format. Example: loading the grunge font at size 18 is : grunge/18.\n\t\tThe XFD font also can be specified. Ex. 'notepad/32,-*--24-*'.\n");
- printf("-poly\t\tPerforms a poly test\n");
- printf("The following options requires a file to work properly.\n");
- printf("-textdir\t\tText Direction. 0: L to R, 1: R to L\n");
- printf(" 2: U to D, 3: D to U, 4: angle\n");
- printf("-xfdtest\t\tXFD Font queue test.\n");
- printf
- ("-xfdcachetest <f> [<l>]\t\tXFD tFont cache test.\n\t\tThe file f is drawn l times\n");
- printf("-blast\t\tDisplays the file.\n");
- printf("-loop\t\tScales down the image.\n");
- printf("-blendtest\tPerforms a blending test on the file.\n");
- printf("-rotatetest\tPerforms a rotate test on the file.\n");
- printf
- ("-filter\t\tPerforms filtering. Possible filters are,\n\t\t\t1:Blur filter, 2:Sharpen filter, 3:Color blur filter, \n\t\t\t4:Emboss filter, 5:Grayscale filter, 6:Saturation filter,\n\t\t\t7:Edge detection filter.\n");
- printf("-bmp2pt\t\tPerformas Bump Mapping to a point\n");
- return 0;
- }
-
- for (i = 1; i < argc; i++)
- {
- if (!strcmp(argv[i], "-root"))
- root = 1;
- else if (!strcmp(argv[i], "-smooth"))
- aa = 1;
- else if (!strcmp(argv[i], "-blast"))
- interactive = 0;
- else if (!strcmp(argv[i], "-loop"))
- {
- interactive = 0;
- loop = 1;
- }
- else if (!strcmp(argv[i], "-up"))
- scaleup = 1;
- else if (!strcmp(argv[i], "-both"))
- scaleboth = 1;
- else if (!strcmp(argv[i], "-bmp2pt"))
- bump_map_to_point = 1;
- else if (!strcmp(argv[i], "-orig"))
- origone = 1;
- else if (!strcmp(argv[i], "-blend"))
- blend = 1;
- else if (!strcmp(argv[i], "-poly"))
- pol = 1;
- else if (!strcmp(argv[i], "-blendtest"))
- {
- blendtest = 1;
- interactive = 0;
- }
- else if (!strcmp(argv[i], "-colormod"))
- {
- DATA8 rt[256], gt[256], bt[256], at[256];
- double rm, gm, bm, am;
- int j;
-
- /*\ Setup color mod tables \ */
- if (!colormod)
- colormod = imlib_create_color_modifier();
- imlib_context_set_color_modifier(colormod);
- rm = strtod(argv[++i], 0);
- gm = strtod(argv[++i], 0);
- bm = strtod(argv[++i], 0);
- am = strtod(argv[++i], 0);
- imlib_get_color_modifier_tables(rt, gt, bt, at);
- for (j = 0x100; --j >= 0;)
- {
- rt[j] = ((double)rt[j]) * rm;
- gt[j] = ((double)gt[j]) * gm;
- bt[j] = ((double)bt[j]) * bm;
- at[j] = ((double)at[j]) * am;
- }
- imlib_set_color_modifier_tables(rt, gt, bt, at);
- }
- else if (!strcmp(argv[i], "-dither"))
- dith = 1;
- else if (!strcmp(argv[i], "-scale"))
- scale = 1;
- else if (!strcmp(argv[i], "-noloop"))
- loop = 0;
- else if (!strcmp(argv[i], "-size"))
- {
- i++;
- w = atoi(argv[i++]);
- h = atoi(argv[i]);
- }
- else if (!strcmp(argv[i], "-maxcolors"))
- {
- i++;
- imlib_set_color_usage(atoi(argv[i]));
- }
- else if (!strcmp(argv[i], "-font"))
- {
- i++;
- fon = argv[i];
- }
- else if (!strcmp(argv[i], "-text"))
- {
- i++;
- str = argv[i];
- }
- else if (!strcmp(argv[i], "-xfdtest"))
- xfdtest = 1;
- else if (!strcmp(argv[i], "-xfdcachetest"))
- {
- xfdcachetest = 1;
- i++;
- xfdfname = argv[i];
- i++;
- if (i < argc)
- xfdloop = atoi(argv[i]);
- }
- else if (!strcmp(argv[i], "-textdir"))
- {
- i++;
- textdir = atoi(argv[i]);
- }
- else if (!strcmp(argv[i], "-rotate"))
- rotate = 1;
- else if (!strcmp(argv[i], "-filter"))
- {
- filter = atoi(argv[++i]);
- interactive = 0;
- }
- else if (!strcmp(argv[i], "-rotatetest"))
- {
- rottest = 1;
- interactive = 0;
- }
- else
- file = argv[i];
- }
-
- /**
- * Initialization according to options
- */
- printf("init\n");
-
- /**
- * First tests to determine which rendering task to perform
- */
- if (!blendtest)
- {
- disp = XOpenDisplay(NULL);
- vis = DefaultVisual(disp, DefaultScreen(disp));
- depth = DefaultDepth(disp, DefaultScreen(disp));
- cm = DefaultColormap(disp, DefaultScreen(disp));
- /* nasty - using imlib internal function.. but it makes benchmarks fair */
- if (!interactive)
- __imlib_SetMaxXImageCount(disp, 3);
- if (root)
- win = DefaultRootWindow(disp);
- else
- {
- win =
- XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 10,
- 10, 0, 0, 0);
- XSelectInput(disp, win,
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask
- | PointerMotionMask | ExposureMask);
- }
- }
-
- if (!interactive)
- {
- printf("load %s\n", file);
- im = imlib_load_image_immediately(file);
- if (!im)
- {
- printf("load failed\n");
- exit(0);
- }
- imlib_context_set_image(im);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- printf("image %i x %i\n", w, h);
- }
-
- if (!blendtest)
- {
- if (!root)
- {
- if (scaleup)
- XResizeWindow(disp, win, w * 4, h * 4);
- else if (scaleboth)
- XResizeWindow(disp, win, w * 2, h * 2);
- else
- XResizeWindow(disp, win, w, h);
- XMapWindow(disp, win);
- }
- if (scale)
- {
- Window d;
- int dd;
-
- XGetGeometry(disp, win, &d, &dd, &dd, &dd, &dd, &dd, &dd);
- }
- XSync(disp, False);
- }
-
- /**
- * Start rendering
- */
- printf("rend\n");
-
- if (!blendtest)
- {
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- }
- imlib_context_set_anti_alias(aa);
- imlib_context_set_dither(dith);
- imlib_context_set_blend(blend);
- imlib_context_set_color_modifier(NULL);
- imlib_context_set_operation(IMLIB_OP_COPY);
- imlib_context_set_image(im);
-
- gettimeofday(&timev, NULL);
- sec1 = (int)timev.tv_sec; /* and stores it so we can time outselves */
- usec1 = (int)timev.tv_usec; /* we will use this to vary speed of rot */
-
- poly = imlib_polygon_new();
- imlib_polygon_add_point(poly, 400, 50);
- imlib_polygon_add_point(poly, 450, 100);
- imlib_polygon_add_point(poly, 350, 100);
-
- poly2 = imlib_polygon_new();
- imlib_polygon_add_point(poly2, 400, 150);
- imlib_polygon_add_point(poly2, 450, 200);
- imlib_polygon_add_point(poly2, 350, 200);
-
- poly3 = imlib_polygon_new();
- imlib_polygon_add_point(poly3, 400, 250);
- imlib_polygon_add_point(poly3, 450, 300);
- imlib_polygon_add_point(poly3, 350, 300);
-
-#define A90 (3.141592654 / 2)
- if (pol)
- {
- Imlib_Image im_bg, im;
- int w, h;
- int i;
- double a, points[8][2];
-
- if (file)
- im_bg = imlib_load_image(file);
- else
- im_bg = imlib_load_image("test_images/bg.png");
- imlib_context_set_image(im_bg);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- XResizeWindow(disp, win, w, h);
- XSync(disp, False);
- im = imlib_create_image(w, h);
- srand(time(NULL));
- for (i = 0; i < 8; i++)
- {
- points[i][0] = (rand() % w) - (w / 2);
- points[i][1] = (rand() % h) - (h / 2);
- }
- a = 0.0;
- for (;;)
- {
- imlib_context_set_image(im);
- imlib_blend_image_onto_image(im_bg, 0, 0, 0, w, h, 0, 0, w, h);
-
- poly = imlib_polygon_new();
- for (i = 0; i < 8; i++)
- {
- double xx, yy;
-
- xx = (w / 2) +
- (cos(a) * points[i][0]) + (cos(a + A90) * points[i][1]);
- yy = (h / 2) +
- (sin(a) * points[i][0]) + (sin(a + A90) * points[i][1]);
- imlib_polygon_add_point(poly, xx, yy);
- }
- printf("draw angle %3.3f\n", a);
- imlib_context_set_color(255, 255, 255, 100);
- imlib_image_fill_polygon(poly);
- imlib_context_set_color(0, 0, 0, 20);
- imlib_image_draw_polygon(poly, 1);
- imlib_polygon_free(poly);
-
- imlib_render_image_on_drawable(0, 0);
- a += 0.05;
- }
- }
-
- if (loop)
- {
- printf("loop\n");
-
- // first test
- if (scaleup)
- {
- printf("scale up\n");
- for (i = 0; i < w * 3; i += 8)
- {
- if (!blendtest)
- {
- Imlib_Image im_tmp;
-
- im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
- w + i,
- (((w +
- i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_render_image_on_drawable(0, 0);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- else
- {
- Imlib_Image im_tmp;
-
- im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
- w + i,
- (((w +
- i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- pixels += (w + i) * (((w + i) * h) / w);
- }
- }
-
- // else if // second
- else if (scaleboth)
- {
- if (origone)
- {
- for (i = 0; i < w * 2; i += 4)
- {
- if (!blendtest)
- {
- Imlib_Image im_tmp;
-
- im_tmp =
- imlib_create_cropped_scaled_image(0, 0, w, h, w,
- (((i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_render_image_on_drawable(0, 0);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- else
- {
- Imlib_Image im_tmp;
-
- im_tmp =
- imlib_create_cropped_scaled_image(0, 0, w, h, w,
- (((i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- XSync(disp, False);
- pixels += (2 * w - i) * (((i) * h) / w);
- }
- for (i = 0; i < w * 2; i += 4)
- {
- if (!blendtest)
- imlib_render_image_on_drawable_at_size(0, 0,
- 2 * w - i, h);
- else
- {
- Imlib_Image im_tmp;
-
- im_tmp =
- imlib_create_cropped_scaled_image(0, 0, w, h,
- 2 * w - i, h);
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- pixels += (2 * w - i) * h;
- }
- }
- else
- {
- for (i = 0; i < w * 2; i += 4)
- {
- if (!blendtest)
- imlib_render_image_on_drawable_at_size(0, 0,
- 2 * w - i,
- (((i) * h) /
- w));
- else
- {
- Imlib_Image im_tmp;
-
- im_tmp =
- imlib_create_cropped_scaled_image(0, 0, w, h,
- 2 * w - i,
- (((i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- pixels += w * (((i) * h) / w);
- }
- }
- }
- else
- {
- printf("scale down 0 -> %i incriment by 1\n", w);
- for (i = 0; i < w; i++)
- {
- if (!blendtest)
- imlib_render_image_on_drawable_at_size(0, 0,
- w - i,
- (((w -
- i) * h) / w));
- else
- {
- Imlib_Image im_tmp;
-
- im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
- w - i,
- (((w -
- i) * h) /
- w));
- if (im_tmp)
- {
- imlib_context_set_image(im_tmp);
- imlib_free_image();
- }
- imlib_context_set_image(im);
- }
- pixels += (w + i) * (((w + i) * h) / w);
- }
- }
- }
-
- // last test
- /* else if (scaleboth)
- * {
- * for (i = 0; i < w * 2; i+= 1)
- * {
- * if (!blendtest)
- * imlib_render_image_on_drawable_at_size(0, 0,
- * 2 * w - i, (((i) * h) / w));
- * else
- * {
- * Imlib_Image im_tmp;
- * im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
- * 2 * w - i, (((i) * h) / w));
- * if (im_tmp)
- * {
- * imlib_context_set_image(im_tmp);
- * imlib_free_image();
- * }
- * imlib_context_set_image(im);
- * }
- * pixels += (2 * w - i) * (((i) * h) / w);
- * }
- * }
- * } */// end if loop
- else if (blendtest)
- {
- Imlib_Image im2;
-
- im2 = imlib_create_image(w, h);
- imlib_context_set_image(im2);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- imlib_context_set_image(im2);
- imlib_context_set_color_modifier(colormod);
- for (i = 0; i < 256; i++)
- {
- imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
- pixels += (w * h);
- }
- }
- else if (rottest)
- {
- int w, h;
- double i;
-
- imlib_context_set_image(im);
- imlib_render_image_on_drawable(0, 0);
-
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- printf("rotating inside %dx%d frame\n", w, h);
-
- imlib_context_set_blend(1);
- imlib_context_set_image(imlib_create_image(w, h));
- for (i = 0; i < 1; i += 0.01)
- {
- imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
- imlib_context_set_color_modifier(colormod);
- imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
- 0, h * i,
- w * (1 - i), -(h * i));
- imlib_context_set_color_modifier(NULL);
- imlib_render_image_on_drawable(0, 0);
- pixels += w * h;
- }
- for (i = 0; i < 1; i += 0.01)
- {
- imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
- imlib_context_set_color_modifier(colormod);
- imlib_context_set_operation(IMLIB_OP_ADD);
- imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
- w * i, h,
- -(w * i), h * (i - 1));
- imlib_context_set_operation(IMLIB_OP_COPY);
- imlib_context_set_color_modifier(NULL);
- imlib_render_image_on_drawable(0, 0);
- pixels += w * h;
- }
- for (i = 0; i < 1; i += 0.01)
- {
- imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
- imlib_context_set_color_modifier(colormod);
- imlib_context_set_operation(IMLIB_OP_SUBTRACT);
- imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
- w, h * (1 - i),
- w * (i - 1), h * i);
- imlib_context_set_operation(IMLIB_OP_COPY);
- imlib_context_set_color_modifier(NULL);
- imlib_render_image_on_drawable(0, 0);
- pixels += w * h;
- }
- for (i = 0; i < 1; i += 0.01)
- {
- imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
- imlib_context_set_color_modifier(colormod);
- imlib_context_set_operation(IMLIB_OP_RESHADE);
- imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
- w * (1 - i), 0,
- w * i, h * (1 - i));
- imlib_context_set_operation(IMLIB_OP_COPY);
- imlib_context_set_color_modifier(NULL);
- imlib_render_image_on_drawable(0, 0);
- pixels += w * h;
- }
- imlib_free_image();
- }
- else if (filter)
- {
- imlib_context_set_filter(imlib_create_filter(0));
- switch (filter)
- {
- default:
- case 1:
- /*\ Blur filter \ */
- imlib_filter_set(0, 0, 0, 8, 8, 8);
- imlib_filter_set(-1, 0, 0, 4, 4, 4);
- imlib_filter_set(0, -1, 0, 4, 4, 4);
- imlib_filter_set(1, 0, 0, 4, 4, 4);
- imlib_filter_set(0, 1, 0, 4, 4, 4);
- imlib_filter_set(-2, 0, 0, 1, 1, 1);
- imlib_filter_set(0, -2, 0, 1, 1, 1);
- imlib_filter_set(2, 0, 0, 1, 1, 1);
- imlib_filter_set(0, 2, 0, 1, 1, 1);
- imlib_filter_set(-1, -1, 0, 1, 1, 1);
- imlib_filter_set(-1, 1, 0, 1, 1, 1);
- imlib_filter_set(1, -1, 0, 1, 1, 1);
- imlib_filter_set(1, 1, 0, 1, 1, 1);
- break;
- case 2:
- /*\ Sharpen filter \ */
- imlib_filter_set(0, 0, 0, 5, 5, 5);
- imlib_filter_set(-1, 0, 0, -1, -1, -1);
- imlib_filter_set(0, -1, 0, -1, -1, -1);
- imlib_filter_set(1, 0, 0, -1, -1, -1);
- imlib_filter_set(0, 1, 0, -1, -1, -1);
- break;
- case 3:
- /*\ Color blur filter \ */
- imlib_filter_set(0, 0, 0, 3, 3, 3);
- imlib_filter_set(-1, -1, 0, 1, 0, 0);
- imlib_filter_set(1, -1, 0, 0, 1, 0);
- imlib_filter_set(0, 1, 0, 0, 0, 1);
- break;
- case 4:
- /*\ Emboss filter \ */
- imlib_filter_set_red(-1, -1, 0, -1, -1, -1);
- imlib_filter_set_red(0, 0, 0, 1, 1, 1);
- imlib_filter_set_green(-1, -1, 0, -1, -1, -1);
- imlib_filter_set_green(0, 0, 0, 1, 1, 1);
- imlib_filter_set_blue(-1, -1, 0, -1, -1, -1);
- imlib_filter_set_blue(0, 0, 0, 1, 1, 1);
-
- imlib_filter_constants(0, 768, 768, 768);
- imlib_filter_divisors(0, 6, 6, 6);
- break;
- case 5:
- /*\ Grayscale filter \ */
- imlib_filter_set_red(0, 0, 0, 80, 1, 1);
- imlib_filter_set_green(0, 0, 0, 1, 80, 1);
- imlib_filter_set_blue(0, 0, 0, 1, 1, 80);
- break;
- case 6:
- /*\ Saturation filter \ */
- imlib_filter_set_red(0, 0, 0, 80, -1, -1);
- imlib_filter_set_green(0, 0, 0, -1, 80, -1);
- imlib_filter_set_blue(0, 0, 0, -1, -1, 80);
- break;
- case 7:
- /*\ Edge detection filter \ */
- imlib_filter_set(-1, -1, 0, -1, -1, -1);
- imlib_filter_set(-1, 0, 0, -3, -3, -3);
- imlib_filter_set(-1, 1, 0, -1, -1, -1);
- imlib_filter_set(0, -1, 0, -3, -3, -3);
- imlib_filter_set(0, 0, 0, 16, 16, 16);
- imlib_filter_set(0, 1, 0, -3, -3, -3);
- imlib_filter_set(1, -1, 0, -1, -1, -1);
- imlib_filter_set(1, 0, 0, -3, -3, -3);
- imlib_filter_set(1, 1, 0, -1, -1, -1);
- imlib_filter_divisors(0, 3, 3, 3);
- }
- pixels = 0;
- imlib_render_image_on_drawable_at_size(0, 0, w, h);
- for (i = 0; i < w; i++)
- {
- imlib_image_filter();
- imlib_render_image_on_drawable_at_size(0, 0, w, h);
- pixels += w * h;
- }
- imlib_free_filter();
- }
- else if (interactive)
- {
- int wo, ho, px, py, first = 1;
- Imlib_Image im_bg, im_sh1, im_sh2, im_sh3, im_ic[13], im_tmp;
-
- /* Imlib_Border border; */
- Imlib_Updates up = NULL;
- int x, y, i, j;
- XEvent ev;
- Imlib_Font fn = NULL;
- struct font_hdr {
- int type;
- struct font_hdr *next;
- char *name;
- int ref;
- XFontSet xfontset;
- int font_count;
- XFontStruct **font_struct;
- char **font_name;
- int ascent;
- int descent;
- int max_ascent;
- int max_descent;
- int max_width;
- struct font_hdr *ttf;
- } *f, *f1, *f2, *f3, *f4;
-
- /* "ARIAL/30" "COMIC/30" "IMPACT/30" "Prole/30" "Proteron/30" */
- /* "TIMES/30" "badacid/30" "bajoran/30" "bigfish/30" */
- imlib_add_path_to_font_path("./ttfonts");
-
- if (xfdtest)
- {
- printf("Font Cache test start\n");
-
- f = imlib_load_font("notepad/10");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- imlib_context_set_font((Imlib_Font) f);
- printf
- ("\t\t ascent=%d, descent=%d, max_ascent=%d, max_descent=%d\n",
- imlib_get_font_ascent(), imlib_get_font_descent(),
- imlib_get_maximum_font_ascent(),
- imlib_get_maximum_font_descent());
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- printf("\n");
-
- f = imlib_load_font("-*-fixed-*--14-*");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- imlib_context_set_font((Imlib_Font) f);
- printf
- ("\t\t ascent=%d, descent=%d, max_ascent=%d, max_descent=%d\n",
- imlib_get_font_ascent(), imlib_get_font_descent(),
- imlib_get_maximum_font_ascent(),
- imlib_get_maximum_font_descent());
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- printf("\n");
-
- f1 = imlib_load_font("notepad/10");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f1, f1->next, f1->type, f1->ref, f1->name);
- f2 = imlib_load_font("-*-fixed-*--14-*");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f2, f2->next, f2->type, f2->ref, f2->name);
- f3 = imlib_load_font("notepad/10,-*-fixed-*--14-*");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f3, f3->next, f3->type, f3->ref, f3->name);
- f = f3->ttf;
- printf(" f->ttf: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- f4 = imlib_load_font("notepad/10,-*-fixed-*--14-*");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f4, f4->next, f4->type, f4->ref, f4->name);
- f = f4->ttf;
- printf(" f->ttf: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- printf("\n");
-
- imlib_context_set_font((Imlib_Font) f4);
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f4, f4->next, f4->type, f4->ref, f4->name);
- f = f4->ttf;
- printf(" f->ttf: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- imlib_context_set_font((Imlib_Font) f1);
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f1, f1->next, f1->type, f1->ref, f1->name);
- imlib_context_set_font((Imlib_Font) f2);
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f2, f2->next, f2->type, f2->ref, f2->name);
- imlib_context_set_font((Imlib_Font) f3);
- imlib_free_font();
- printf("imlib_free_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f3, f3->next, f3->type, f3->ref, f3->name);
- f = f3->ttf;
- printf(" f->ttf: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- printf("\n");
- imlib_flush_font_cache();
- printf("imlib_flush_font_cache: \n");
- printf("\n");
- f1 = imlib_load_font("notepad/10,-*-fixed-*--14-*");
- printf("imlib_load_font: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f1, f1->next, f1->type, f1->ref, f1->name);
- f = f1->ttf;
- printf(" f->ttf: f=%x, next=%8x, type=%d, ref=%d, '%s'\n",
- f, f->next, f->type, f->ref, f->name);
- imlib_context_set_font((Imlib_Font) f1);
- printf
- ("\t\t ascent=%d, descent=%d, max_ascent=%d, max_descent=%d\n",
- imlib_get_font_ascent(), imlib_get_font_descent(),
- imlib_get_maximum_font_ascent(),
- imlib_get_maximum_font_descent());
-
- printf("Font Cache test end\n");
- }
-
- if (fon)
- {
- fn = imlib_load_font(fon);
-
- if (xfdtest)
- {
- int i;
-
- f = fn;
- if (fn != NULL && f->type & 2)
- for (i = 0; i < f->font_count; i++)
- printf("xfont%d: %s\n", i, f->font_name[i]);
- }
-
- imlib_context_set_font(fn);
- if (!fn)
- fon = NULL;
- }
-
- imlib_context_set_progress_function(NULL);
- imlib_context_set_progress_granularity(0);
- if (file)
- im_bg = imlib_load_image(file);
- else
- im_bg = imlib_load_image("test_images/bg.png");
- imlib_context_set_image(im_bg);
- im_tmp = imlib_clone_image();
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- wo = w;
- ho = h;
- w *= 1;
- h *= 1;
- XResizeWindow(disp, win, w, h);
- XSync(disp, False);
- im = imlib_create_image(w, h);
- imlib_set_cache_size(4 * 1024 * 1024);
- i = 0;
- up = imlib_update_append_rect(up, 0, 0, w, h);
- x = -9999;
- y = -9999;
- while (1)
- {
- px = x;
- py = y;
- do
- {
- XNextEvent(disp, &ev);
- switch (ev.type)
- {
- case Expose:
- up = imlib_update_append_rect(up,
- ev.xexpose.x,
- ev.xexpose.y,
- ev.xexpose.width,
- ev.xexpose.height);
- break;
- case ButtonRelease:
- if (fon)
- {
- imlib_context_set_font(fn);
- imlib_free_font();
- }
- exit(0);
- break;
- case MotionNotify:
- x = ev.xmotion.x;
- y = ev.xmotion.y;
- default:
- break;
-
- }
- }
- while (XPending(disp));
-
- im_sh1 = imlib_load_image("test_images/sh1.png");
- im_sh2 = imlib_load_image("test_images/sh2.png");
- im_sh3 = imlib_load_image("test_images/sh3.png");
- im_ic[0] = imlib_load_image("test_images/audio.png");
- im_ic[1] = imlib_load_image("test_images/folder.png");
- im_ic[2] = imlib_load_image("test_images/mush.png");
- im_ic[3] = imlib_load_image("test_images/paper.png");
- im_ic[4] = imlib_load_image("test_images/mail.png");
- im_ic[5] = imlib_load_image("test_images/calc.png");
- im_ic[6] = imlib_load_image("test_images/cal.png");
- im_ic[7] = imlib_load_image("test_images/stop.png");
- im_ic[8] = imlib_load_image("test_images/globe.png");
- im_ic[9] = imlib_load_image("test_images/menu.png");
- im_ic[10] = imlib_load_image("test_images/tnt.png");
- im_ic[11] = imlib_load_image("test_images/bulb.png");
- im_ic[12] = imlib_load_image("test_images/lock.png");
-
- imlib_context_set_image(im);
- if (first)
- {
- imlib_blend_image_onto_image(im_bg, 0,
- 0, 0, w, h, 0, 0, w, h);
- first = 0;
- }
- else if (rotate)
- {
- Imlib_Image rotim;
- double s, c;
- int x1, y1, x2, y2, w, h;
-
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- s = sin(6.2831853 * (double)y / (double)h);
- c = cos(6.2831853 * (double)y / (double)h);
-
- x1 = (w - w * c + h * s) / 2;
- y1 = (h - h * c - w * s) / 2;
- x2 = (w + w * c - h * s) / 2;
- y2 = (h + h * c + w * s) / 2;
-
- imlib_context_set_blend(1);
- imlib_blend_image_onto_image_at_angle(im_bg, 0,
- 0, 0,
- imlib_image_get_width(),
- imlib_image_get_height
- (), x1, y1, x2, y2);
- up = imlib_update_append_rect(up, 0, 0,
- imlib_image_get_width(),
- imlib_image_get_height());
-
- }
-/*
- if( bump_map_to_point )
- imlib_apply_filter("bump_map_point(x=[],y=[],map=test_images/bulb.png);", &x, &y );
- else
- imlib_apply_filter("bump_map(x=[],y=[],map=test_images/bulb.png);", &x, &y );
-*/
- up = imlib_update_append_rect(up, 0, 0,
- imlib_image_get_width(),
- imlib_image_get_height());
- {
- Imlib_Updates uu;
-
- imlib_context_set_cliprect(0, 0, 0, 0);
- imlib_context_set_color(255, 255, 255, 255);
- uu = imlib_image_draw_line(200, 200, x, y, 1);
- up = imlib_updates_append_updates(up, uu);
-
- /* test ellipses */
- imlib_context_set_color(255, 255, 255, 255);
- imlib_image_draw_ellipse(50, 250, 30, 40);
- imlib_image_fill_ellipse(50, 300, 30, 40);
-
- imlib_image_draw_rectangle(120, 245, 70, 70);
- up = imlib_update_append_rect(up, 120, 245, 70, 70);
- imlib_image_draw_ellipse(160, 280, 50, 20);
-
- imlib_context_set_cliprect(120, 245, 70, 70);
- imlib_context_set_color(255, 55, 55, 255);
- imlib_image_draw_ellipse(160, 280, 50, 20);
-
- /* test line clipping */
- imlib_context_set_cliprect(0, 0, 0, 0);
- imlib_image_draw_rectangle(50, 50, 100, 100);
- up = imlib_update_append_rect(up, 50, 50, 100, 100);
-
- imlib_context_set_color(255, 255, 255, 255);
-
- uu = imlib_image_draw_line(0, 0, 200, 200, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(305, 25, 20, 200, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(100, 5, 100, 205, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(275, 5, 20, 100, 1);
- up = imlib_updates_append_updates(up, uu);
-
- imlib_context_set_color(255, 55, 55, 255);
- imlib_context_set_cliprect(50, 50, 100, 100);
-
- uu = imlib_image_draw_line(0, 0, 200, 200, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(305, 25, 20, 200, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(100, 5, 100, 205, 1);
- up = imlib_updates_append_updates(up, uu);
-
- uu = imlib_image_draw_line(275, 5, 20, 100, 1);
- up = imlib_updates_append_updates(up, uu);
-
- /* test rectangle clipping */
- imlib_context_set_color(255, 255, 255, 255);
- imlib_context_set_cliprect(0, 0, 0, 0);
-
- imlib_image_draw_rectangle(70, 90, 20, 20);
- imlib_image_draw_rectangle(115, 70, 60, 30);
- imlib_image_draw_rectangle(30, 120, 50, 50);
-
- imlib_context_set_color(255, 55, 55, 255);
- imlib_context_set_cliprect(50, 50, 100, 100);
-
- imlib_image_draw_rectangle(70, 90, 20, 20);
- up = imlib_update_append_rect(up, 70, 90, 20, 20);
- imlib_image_draw_rectangle(115, 70, 60, 30);
- up = imlib_update_append_rect(up, 115, 70, 60, 30);
- imlib_image_draw_rectangle(30, 120, 50, 50);
- up = imlib_update_append_rect(up, 30, 120, 50, 50);
-
- imlib_context_set_cliprect(0, 0, 0, 0);
-
- /* test polygons */
- imlib_context_set_color(255, 0, 0, 128);
- imlib_image_fill_polygon(poly);
- imlib_context_set_color(255, 255, 255, 255);
- imlib_image_draw_polygon(poly2, 0);
- imlib_image_draw_polygon(poly3, 1);
- imlib_image_draw_rectangle(380, 260, 50, 50);
-
- imlib_context_set_color(255, 55, 55, 255);
- imlib_context_set_cliprect(380, 260, 50, 50);
- imlib_image_fill_polygon(poly3);
- imlib_context_set_cliprect(0, 0, 0, 0);
-
- }
- {
- static Imlib_Color_Range rg = NULL;
-
- if (!rg)
- {
- rg = imlib_create_color_range();
- imlib_context_set_color_range(rg);
- imlib_context_set_color(255, 255, 255, 255);
- imlib_add_color_to_color_range(0);
- imlib_context_set_color(255, 255, 160, 255);
- imlib_add_color_to_color_range(1);
- imlib_context_set_color(255, 160, 120, 255);
- imlib_add_color_to_color_range(1);
- imlib_context_set_color(255, 80, 100, 128);
- imlib_add_color_to_color_range(1);
- imlib_context_set_color(32, 48, 80, 0);
- imlib_add_color_to_color_range(1);
- }
- imlib_context_set_operation(IMLIB_OP_RESHADE);
- imlib_image_fill_color_range_rectangle(60, 60, 256, 256,
- (double)x);
- up = imlib_update_append_rect(up, 60, 60, 256, 256);
- imlib_context_set_operation(IMLIB_OP_COPY);
- }
-
- if (xfdcachetest)
- {
- int l;
- int retw, reth, tx, ty, nx, ny;
- int secs, usecs, sece, usece;
- FILE *f;
- char buf[129];
-
- f = fopen(xfdfname, "r");
- if (!f)
- {
- printf("file %s can not be opened!\n", file);
- exit(-1);
- }
-
- tx = ty = 0;
- imlib_context_set_color(255, 255, 255, 255);
-
- gettimeofday(&timev, NULL);
- secs = (int)timev.tv_sec;
- usecs = (int)timev.tv_usec;
-
- l = xfdloop;
- while (l)
- {
- fseek(f, 0, SEEK_SET);
- while (fgets(buf, 128, f))
- {
- if (buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
- imlib_text_draw_with_return_metrics(tx, ty, buf,
- &retw, &reth,
- &nx, &ny);
- up = imlib_update_append_rect(up, tx, ty, retw,
- reth);
- ty += ny;
- if (ty > h)
- ty = 0;
- }
- l--;
- }
-
- gettimeofday(&timev, NULL);
- sece = (int)timev.tv_sec;
- usece = (int)timev.tv_usec;
- {
- double t1, t2;
-
- t1 = (double)secs + ((double)usecs / 1000000);
- t2 = (double)sece + ((double)usece / 1000000);
- sec = t2 - t1;
- }
- printf("%3.3f sec\n", sec);
-
- }
- else if (fon)
- {
- int retw, reth, tx, ty, nx, ny, cx, cy, cw,
- ch, cp;
- int cx2, cy2, cw2, ch2;
-
- if (!str)
- str = "This is a test string";
- tx = ty = 50;
- for (i = 0; i < 16; i++)
- {
- int al;
-
- imlib_context_set_direction(textdir);
- if (textdir == IMLIB_TEXT_TO_ANGLE)
- {
- double an = (double)i / 10.0;
-
- imlib_context_set_angle(an);
- }
-
- al = (15 - i) * 16;
- if (al > 255)
- al = 255;
- imlib_context_set_color(255, 255, 255, al);
- imlib_text_draw_with_return_metrics(tx, ty, str,
- &retw, &reth,
- &nx, &ny);
- up = imlib_update_append_rect(up, tx, ty, retw, reth);
- switch (textdir)
- {
- case IMLIB_TEXT_TO_RIGHT:
- case IMLIB_TEXT_TO_LEFT:
- case IMLIB_TEXT_TO_ANGLE:
- ty += ny;
- break;
- case IMLIB_TEXT_TO_DOWN:
- case IMLIB_TEXT_TO_UP:
- tx += nx;
- break;
- }
- }
- cp = imlib_text_get_index_and_location(str, x - 50, y - 50,
- &cx, &cy, &cw, &ch);
- if (cp >= 0)
- {
- char tmp[16];
- int len;
-
- len = mblen(str + cp, MB_CUR_MAX);
- if (len < 0)
- len = 1;
- strncpy(tmp, str + cp, len);
- tmp[len] = '\0';
- printf("over char %s : cp=%d cx=%d cy=%d cw=%d ch=%d : ",
- tmp, cp, cx, cy, cw, ch);
- imlib_text_get_location_at_index(str, cp, &cx2, &cy2,
- &cw2, &ch2);
- printf("cx2=%d cy2=%d cw2=%d ch2=%d \n",
- cx2, cy2, cw2, ch2);
- }
- }
- imlib_context_set_blend(1);
- if ((px != x) || (py != y))
- {
- for (j = 0; j < 32; j++)
- {
- for (i = 0; i < 32; i++)
- {
- int ic, iw, ih, ww, hh;
-
- ic = ((j * 32) + i) % 13;
- imlib_context_set_image(im_ic[ic]);
- iw = imlib_image_get_width();
- ih = imlib_image_get_height();
- ww = iw;
- hh = ih;
- up = imlib_update_append_rect(up, x + (i * iw * 2),
- y + (j * ih * 2), ww,
- hh);
- up = imlib_update_append_rect(up, px + (i * iw * 2),
- py + (j * ih * 2), ww,
- hh);
- imlib_context_set_image(im);
- imlib_blend_image_onto_image(im_ic[ic], 0,
- 0, 0, iw, ih,
- x + (i * iw * 2),
- y + (j * ih * 2),
- ww, hh);
- }
- }
- }
-/*
- imlib_apply_filter( "tint(x=200,y=200,w=300,h=100,alpha=100,red=155,green=25,blue=25);"\
- "tint(green=20,red=20,blue=20,alpha=200,x=30,y=30);" \
- "tint(green=40,red=40,blue=240,alpha=60,x=50,y=150,h=200);" );
-*/
- imlib_blend_image_onto_image(im_sh1, 0, 0, 0, 50, 50, 0, 0, 50,
- 50);
- up = imlib_update_append_rect(up, 0, 0, 50, 50);
- imlib_blend_image_onto_image(im_sh2, 0, 0, 0, 50, 50, 50, 0,
- w - 50, 50);
- up = imlib_update_append_rect(up, 50, 0, w - 50, 50);
- imlib_blend_image_onto_image(im_sh3, 0, 0, 0, 50, 50, 0, 50, 50,
- h - 50);
- up = imlib_update_append_rect(up, 0, 50, 50, h - 50);
- up = imlib_updates_merge_for_rendering(up, w, h);
- imlib_context_set_blend(0);
- imlib_render_image_updates_on_drawable(up, 0, 0);
- if ((px != x) || (py != y))
- {
- Imlib_Updates u;
-
- u = up;
- while (u)
- {
- int ux, uy, uw, uh;
-
- imlib_updates_get_coordinates(u, &ux, &uy, &uw, &uh);
- imlib_blend_image_onto_image(im_bg, 0,
- ux, uy, uw, uh,
- ux, uy, uw, uh);
- u = imlib_updates_get_next(u);
- }
- }
- imlib_updates_free(up);
- up = NULL;
- imlib_context_set_image(im_sh1);
- imlib_free_image();
- imlib_context_set_image(im_sh1);
- imlib_free_image();
- imlib_context_set_image(im_sh1);
- imlib_free_image();
- imlib_context_set_image(im_ic[0]);
- imlib_free_image();
- imlib_context_set_image(im_ic[1]);
- imlib_free_image();
- imlib_context_set_image(im_ic[2]);
- imlib_free_image();
- imlib_context_set_image(im_ic[3]);
- imlib_free_image();
-
- }
- }
- else
- {
- printf("blast test\n");
- pixels = 0;
- imlib_context_set_color_modifier(colormod);
- for (i = 0; i < w; i++)
- {
- imlib_render_image_on_drawable_at_size(0, 0, w, h);
- pixels += w * h;
- }
- }
-
- /**
- * Determine horse power of your video card driver
- */
- gettimeofday(&timev, NULL);
- sec2 = (int)timev.tv_sec; /* and stores it so we can time outselves */
- usec2 = (int)timev.tv_usec; /* we will use this to vary speed of rot */
- printf("done\n");
- {
- double t1, t2;
-
- t1 = (double)sec1 + ((double)usec1 / 1000000);
- t2 = (double)sec2 + ((double)usec2 / 1000000);
- sec = t2 - t1;
- }
- printf("%3.3f sec, %3.3f M pixels (%i)\n", sec, (double)pixels / 1000000,
- pixels);
- printf("%3.3f Mpixels / sec\n", (double)(pixels) / (sec * 1000000));
- return 0;
-}
diff --git a/test/polytest.c b/test/polytest.c
deleted file mode 100644
index c7d5d72..0000000
--- a/test/polytest.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-#include <X11/Xatom.h>
-#include <X11/Xos.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-
-#include "Imlib2.h"
-
-Display *disp;
-Window win;
-Visual *vis;
-Colormap cm;
-int depth;
-
-int
-main(int argc, char **argv)
-{
- int w, h;
- Imlib_Image im_bg = NULL;
- XEvent ev;
- KeySym keysym;
- static char kbuf[20];
- ImlibPolygon poly, poly1, poly2;
-
- /**
- * First tests to determine which rendering task to perform
- */
- disp = XOpenDisplay(NULL);
- vis = DefaultVisual(disp, DefaultScreen(disp));
- depth = DefaultDepth(disp, DefaultScreen(disp));
- cm = DefaultColormap(disp, DefaultScreen(disp));
- win =
- XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 100, 100, 0, 0,
- 0);
- XSelectInput(disp, win,
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
- PointerMotionMask | ExposureMask | KeyPressMask);
- XMapWindow(disp, win);
-
- /**
- * Start rendering
- */
- imlib_context_set_display(disp);
- imlib_context_set_visual(vis);
- imlib_context_set_colormap(cm);
- imlib_context_set_drawable(win);
- imlib_context_set_blend(0);
- imlib_context_set_color_modifier(NULL);
- imlib_context_set_blend(0);
-
- im_bg = imlib_create_image(400, 400);
- imlib_context_set_image(im_bg);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- imlib_context_set_color(0, 0, 0, 255);
- imlib_image_fill_rectangle(0, 0, w, h);
- XResizeWindow(disp, win, w, h);
- XSync(disp, False);
-
- poly = imlib_polygon_new();
- imlib_polygon_add_point(poly, 20, 20);
- imlib_polygon_add_point(poly, 70, 20);
- imlib_polygon_add_point(poly, 70, 70);
- imlib_polygon_add_point(poly, 20, 70);
-
- poly1 = imlib_polygon_new();
- imlib_polygon_add_point(poly1, 100, 20);
- imlib_polygon_add_point(poly1, 190, 100);
- imlib_polygon_add_point(poly1, 120, 70);
-
- poly2 = imlib_polygon_new();
- imlib_polygon_add_point(poly2, 290, 20);
- imlib_polygon_add_point(poly2, 200, 100);
- imlib_polygon_add_point(poly2, 270, 70);
-
- while (1)
- {
- do
- {
- XNextEvent(disp, &ev);
- switch (ev.type)
- {
- case ButtonRelease:
- exit(0);
- break;
- case KeyPress:
- XLookupString(&ev.xkey, (char *)kbuf, sizeof(kbuf), &keysym,
- NULL);
- switch (*kbuf)
- {
- case ' ':
- imlib_context_set_anti_alias
- (!imlib_context_get_anti_alias());
- printf("AA is %s\n",
- imlib_context_get_anti_alias()? "on" : "off");
- break;
- case 'q':
- exit(0);
- default:
- break;
- }
- break;
- default:
- break;
-
- }
- }
- while (XPending(disp));
-
- imlib_context_set_image(im_bg);
- imlib_context_set_color(0, 0, 0, 255);
- imlib_image_fill_rectangle(0, 0, w, h);
- imlib_context_set_color(255, 255, 255, 255);
- imlib_image_fill_polygon(poly);
- imlib_image_fill_polygon(poly1);
- imlib_image_fill_polygon(poly2);
- imlib_render_image_on_drawable(0, 0);
- }
- return 0;
-}
diff --git a/test/test_images/.cvsignore b/test/test_images/.cvsignore
deleted file mode 100644
index e895077..0000000
--- a/test/test_images/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.icons
diff --git a/test/test_images/audio.png b/test/test_images/audio.png
deleted file mode 100644
index 01c0611..0000000
--- a/test/test_images/audio.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/bg.png b/test/test_images/bg.png
deleted file mode 100644
index 3ca990a..0000000
--- a/test/test_images/bg.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/bulb.png b/test/test_images/bulb.png
deleted file mode 100644
index 757e599..0000000
--- a/test/test_images/bulb.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/cal.png b/test/test_images/cal.png
deleted file mode 100644
index 889f329..0000000
--- a/test/test_images/cal.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/calc.png b/test/test_images/calc.png
deleted file mode 100644
index 812237b..0000000
--- a/test/test_images/calc.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/folder.png b/test/test_images/folder.png
deleted file mode 100644
index 9a32d03..0000000
--- a/test/test_images/folder.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/globe.png b/test/test_images/globe.png
deleted file mode 100644
index b52af4b..0000000
--- a/test/test_images/globe.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/imlib2.png b/test/test_images/imlib2.png
deleted file mode 100644
index 63fea4f..0000000
--- a/test/test_images/imlib2.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/lock.png b/test/test_images/lock.png
deleted file mode 100644
index 548b4e9..0000000
--- a/test/test_images/lock.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/mail.png b/test/test_images/mail.png
deleted file mode 100644
index 5247b3f..0000000
--- a/test/test_images/mail.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/menu.png b/test/test_images/menu.png
deleted file mode 100644
index ab5d833..0000000
--- a/test/test_images/menu.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/mush.png b/test/test_images/mush.png
deleted file mode 100644
index 0a4b0d0..0000000
--- a/test/test_images/mush.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/paper.png b/test/test_images/paper.png
deleted file mode 100644
index f6bbc6d..0000000
--- a/test/test_images/paper.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/sh1.png b/test/test_images/sh1.png
deleted file mode 100644
index c7dcb66..0000000
--- a/test/test_images/sh1.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/sh2.png b/test/test_images/sh2.png
deleted file mode 100644
index e4dee7a..0000000
--- a/test/test_images/sh2.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/sh3.png b/test/test_images/sh3.png
deleted file mode 100644
index f15b892..0000000
--- a/test/test_images/sh3.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/stop.png b/test/test_images/stop.png
deleted file mode 100644
index cc7830e..0000000
--- a/test/test_images/stop.png
+++ /dev/null
Binary files differ
diff --git a/test/test_images/tnt.png b/test/test_images/tnt.png
deleted file mode 100644
index 14e2266..0000000
--- a/test/test_images/tnt.png
+++ /dev/null
Binary files differ
diff --git a/test/ttfonts/cinema.ttf b/test/ttfonts/cinema.ttf
deleted file mode 100644
index 326a820..0000000
--- a/test/ttfonts/cinema.ttf
+++ /dev/null
Binary files differ
diff --git a/test/ttfonts/grunge.ttf b/test/ttfonts/grunge.ttf
deleted file mode 100644
index deba7da..0000000
--- a/test/ttfonts/grunge.ttf
+++ /dev/null
Binary files differ
diff --git a/test/ttfonts/morpheus.ttf b/test/ttfonts/morpheus.ttf
deleted file mode 100644
index 46e19a2..0000000
--- a/test/ttfonts/morpheus.ttf
+++ /dev/null
Binary files differ
diff --git a/test/ttfonts/notepad.ttf b/test/ttfonts/notepad.ttf
deleted file mode 100644
index 4e165ce..0000000
--- a/test/ttfonts/notepad.ttf
+++ /dev/null
Binary files differ