forked from enlightenment/efl
we have a new rendering target for evas - an imlib image buffer.
it will render to a virtual image buffer just like it would to a window. the logic works the exact same way as a window - it wil lonly render the rects that changed. if a rect chnaged it expects that rect to have been cleared and will blend the canvas ontop of the image - so you can use it to augment the current image contents (though they will be permenantly modified). This is specifically designed for doing things like rendering a canvas to be saved to an image file. WHEEEEEEEE :) SVN revision: 3460
This commit is contained in:
parent
3a1fb0355c
commit
a751ec1b21
|
@ -28,7 +28,8 @@ typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box;
|
|||
#define RENDER_METHOD_BASIC_HARDWARE 1
|
||||
#define RENDER_METHOD_3D_HARDWARE 2
|
||||
#define RENDER_METHOD_ALPHA_HARDWARE 3
|
||||
#define RENDER_METHOD_COUNT 4
|
||||
#define RENDER_METHOD_IMAGE 4
|
||||
#define RENDER_METHOD_COUNT 5
|
||||
|
||||
#define CALLBACK_MOUSE_IN 0
|
||||
#define CALLBACK_MOUSE_OUT 1
|
||||
|
@ -61,6 +62,7 @@ struct _Evas
|
|||
Visual *visual;
|
||||
Colormap colormap;
|
||||
int screen;
|
||||
Imlib_Image image;
|
||||
|
||||
int drawable_width, drawable_height;
|
||||
|
||||
|
@ -246,6 +248,7 @@ void evas_get_viewport(Evas e, double *x, double *y, double *w, double *h);
|
|||
|
||||
/* the output settings */
|
||||
void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c);
|
||||
void evas_set_output_image(Evas e, Imlib_Image image);
|
||||
void evas_set_output_size(Evas e, int w, int h);
|
||||
void evas_set_output_viewport(Evas e, double x, double y, double w, double h);
|
||||
void evas_set_output_method(Evas e, Evas_Render_Method method);
|
||||
|
@ -308,6 +311,12 @@ void evas_move(Evas e, Evas_Object o, double x, double y);
|
|||
void evas_resize(Evas e, Evas_Object o, double w, double h);
|
||||
void evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h);
|
||||
|
||||
/* object query */
|
||||
Evas_List evas_objects_in_rect(Evas e, double x, double y, double w, double h);
|
||||
Evas_List evas_objects_at_position(Evas e, double x, double y);
|
||||
Evas_Object evas_object_in_rect(Evas e, double x, double y, double w, double h);
|
||||
Evas_Object evas_object_at_position(Evas e, double x, double y);
|
||||
|
||||
/* object visibility */
|
||||
void evas_show(Evas e, Evas_Object o);
|
||||
void evas_hide(Evas e, Evas_Object o);
|
||||
|
|
|
@ -35,6 +35,7 @@ evas_events.c \
|
|||
evas_gl_routines.c \
|
||||
evas_gradient.c \
|
||||
evas_image.c \
|
||||
evas_image_routines.c \
|
||||
evas_imlib_routines.c \
|
||||
evas_line.c \
|
||||
evas_list.c \
|
||||
|
@ -44,6 +45,7 @@ evas_rectangle.c \
|
|||
evas_render.c \
|
||||
evas_text.c \
|
||||
evas_gl_routines.h \
|
||||
evas_image_routines.h \
|
||||
evas_imlib_routines.h \
|
||||
Evas.h
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ __evas_gl_image_cache_flush(Display *disp)
|
|||
|
||||
void
|
||||
__evas_gl_image_draw(Evas_GL_Image *im,
|
||||
Display *disp, Window w, int win_w, int win_h,
|
||||
Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
|
@ -561,33 +561,33 @@ __evas_gl_image_draw(Evas_GL_Image *im,
|
|||
bt = (int)dh / 2;
|
||||
bb = (int)dh - bt;
|
||||
}
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
0, 0, bl, bt,
|
||||
dx, dy, bl, bt);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
bl, 0, im->w - bl - br, bt,
|
||||
dx + bl, dy, dw - bl - br, bt);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
im->w - br, 0, br, bt,
|
||||
dx + dw - br, dy, br, bt);
|
||||
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
0, bt, bl, im->h - bt - bb,
|
||||
dx, dy + bt, bl, dh - bt - bb);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
bl, bt, im->w - bl - br, im->h - bt - bb,
|
||||
dx + bl, dy + bt, dw - bl - br, dh - bt - bb);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
im->w - br, bt, br, im->h - bt - bb,
|
||||
dx + dw - br, dy + bt, br, dh - bt - bb);
|
||||
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
0, im->h - bb, bl, bb,
|
||||
dx, dy + dh - bb, bl, bb);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
bl, im->h - bb, im->w - bl - br, bb,
|
||||
dx + bl, dy + dh - bb, dw - bl - br, bb);
|
||||
__evas_gl_image_draw(im, disp, w, win_w, win_h,
|
||||
__evas_gl_image_draw(im, disp, dstim, w, win_w, win_h,
|
||||
im->w - br, im->h - bb, br, bb,
|
||||
dx + dw - br, dy + dh - bb, br, bb);
|
||||
im->direct = 0;
|
||||
|
@ -1554,7 +1554,7 @@ __evas_gl_text_cache_get_size(Display *disp)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Window win,
|
||||
__evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h, int x, int y, char *text,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
|
@ -1687,7 +1687,7 @@ __evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *
|
|||
/* rectangle externals *******************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_gl_rectangle_draw(Display *disp, Window win,
|
||||
void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x, int y, int w, int h,
|
||||
int r, int g, int b, int a)
|
||||
|
@ -1763,7 +1763,7 @@ void __evas_gl_rectangle_draw(Display *disp, Window win,
|
|||
/* line externals ************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_gl_line_draw(Display *disp, Window win,
|
||||
void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int r, int g, int b, int a)
|
||||
|
@ -2047,7 +2047,7 @@ __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b,
|
|||
|
||||
void
|
||||
__evas_gl_gradient_draw(Evas_GL_Graident *gr,
|
||||
Display *disp, Window win, int win_w, int win_h,
|
||||
Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h,
|
||||
int x, int y, int w, int h, double angle)
|
||||
{
|
||||
int i;
|
||||
|
@ -2152,7 +2152,7 @@ __evas_gl_sync(Display *disp)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_gl_flush_draw(Display *disp, Window win)
|
||||
__evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win)
|
||||
{
|
||||
if ((__evas_current_win != win) || (__evas_current_disp != disp))
|
||||
{
|
||||
|
@ -2226,7 +2226,7 @@ __evas_gl_init(Display *disp, int screen)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_gl_draw_add_rect(Display *disp, Window win,
|
||||
__evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
return;
|
||||
|
@ -2246,7 +2246,7 @@ int __evas_gl_image_get_width(Evas_GL_Image *im){return 0;}
|
|||
int __evas_gl_image_get_height(Evas_GL_Image *im){return 0;}
|
||||
void __evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right, int top, int bottom){}
|
||||
void __evas_gl_image_set_smooth_scaling(int on){}
|
||||
void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h){}
|
||||
void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h){}
|
||||
|
||||
/********/
|
||||
/* text */
|
||||
|
@ -2262,17 +2262,17 @@ int __evas_gl_text_cache_get_size(Display *disp){return 0;}
|
|||
void __evas_gl_text_get_size(Evas_GL_Font *fn, char *text, int *w, int *h){}
|
||||
int __evas_gl_text_get_character_at_pos(Evas_GL_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch){return 0;}
|
||||
void __evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch){}
|
||||
void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a){}
|
||||
void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a){}
|
||||
|
||||
/**************/
|
||||
/* rectangles */
|
||||
/**************/
|
||||
void __evas_gl_rectangle_draw(Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a){}
|
||||
void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a){}
|
||||
|
||||
/*********/
|
||||
/* lines */
|
||||
/*********/
|
||||
void __evas_gl_line_draw(Display *disp, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a){}
|
||||
void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a){}
|
||||
|
||||
/*************/
|
||||
/* gradients */
|
||||
|
@ -2280,18 +2280,18 @@ void __evas_gl_line_draw(Display *disp, Window win, int win_w, int win
|
|||
Evas_GL_Graident *__evas_gl_gradient_new(Display *disp){return NULL;}
|
||||
void __evas_gl_gradient_free(Evas_GL_Graident *gr){}
|
||||
void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist){}
|
||||
void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){}
|
||||
void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){}
|
||||
|
||||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_gl_init(Display *disp, int screen){}
|
||||
int __evas_gl_capable(Display *disp){return 0;}
|
||||
void __evas_gl_flush_draw(Display *disp, Window win){}
|
||||
void __evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win){}
|
||||
void __evas_gl_sync(Display *disp){}
|
||||
Visual *__evas_gl_get_visual(Display *disp, int screen){return NULL;}
|
||||
XVisualInfo *__evas_gl_get_visual_info(Display *disp, int screen){return NULL;}
|
||||
Colormap __evas_gl_get_colormap(Display *disp, int screen){return 0;}
|
||||
void __evas_gl_draw_add_rect(Display *disp, Window win, int x, int y, int w, int h){}
|
||||
void __evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h){}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,7 +151,7 @@ int __evas_gl_image_get_width(Evas_GL_Image *im);
|
|||
int __evas_gl_image_get_height(Evas_GL_Image *im);
|
||||
void __evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right, int top, int bottom);
|
||||
void __evas_gl_image_set_smooth_scaling(int on);
|
||||
void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
|
||||
/********/
|
||||
/* text */
|
||||
|
@ -173,17 +173,17 @@ int __evas_gl_text_cache_get_size(Display *disp);
|
|||
void __evas_gl_text_get_size(Evas_GL_Font *fn, char *text, int *w, int *h);
|
||||
int __evas_gl_text_get_character_at_pos(Evas_GL_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
|
||||
/**************/
|
||||
/* rectangles */
|
||||
/**************/
|
||||
void __evas_gl_rectangle_draw(Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
|
||||
/*********/
|
||||
/* lines */
|
||||
/*********/
|
||||
void __evas_gl_line_draw(Display *disp, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
|
||||
/*************/
|
||||
/* gradients */
|
||||
|
@ -191,16 +191,16 @@ void __evas_gl_line_draw(Display *disp, Window win, int win_w, int win
|
|||
Evas_GL_Graident *__evas_gl_gradient_new(Display *disp);
|
||||
void __evas_gl_gradient_free(Evas_GL_Graident *gr);
|
||||
void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist);
|
||||
void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
|
||||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_gl_init(Display *disp, int screen);
|
||||
int __evas_gl_capable(Display *disp);
|
||||
void __evas_gl_flush_draw(Display *disp, Window win);
|
||||
void __evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
void __evas_gl_sync(Display *disp);
|
||||
Visual *__evas_gl_get_visual(Display *disp, int screen);
|
||||
XVisualInfo *__evas_gl_get_visual_info(Display *disp, int screen);
|
||||
Colormap __evas_gl_get_colormap(Display *disp, int screen);
|
||||
void __evas_gl_draw_add_rect(Display *disp, Window win, int x, int y, int w, int h);
|
||||
void __evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <string.h>
|
||||
#include "evas_gl_routines.h"
|
||||
#include "evas_imlib_routines.h"
|
||||
#include "evas_image_routines.h"
|
||||
|
||||
static void
|
||||
_evas_free_gradient_box(Evas_Object o)
|
||||
|
@ -36,6 +37,10 @@ _evas_free_gradient_box_renderer_data(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
if (o->renderer_data.method[e->current.render_method])
|
||||
__evas_image_gradient_free(o->renderer_data.method[e->current.render_method]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -133,6 +138,25 @@ evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
if (o->renderer_data.method[e->current.render_method])
|
||||
__evas_image_gradient_free(o->renderer_data.method[e->current.render_method]);
|
||||
{
|
||||
Evas_Image_Graident *g;
|
||||
Evas_List l;
|
||||
|
||||
g = __evas_image_gradient_new(e->current.display);
|
||||
o->renderer_data.method[e->current.render_method] = g;
|
||||
for (l = grad->color_points; l; l = l->next)
|
||||
{
|
||||
Evas_Color_Point col;
|
||||
|
||||
col= l->data;
|
||||
__evas_image_gradient_color_add(g, col->r, col->g, col->b,
|
||||
col->a, col->distance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ _evas_free_image_renderer_data(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,825 @@
|
|||
#include "evas_image_routines.h"
|
||||
|
||||
static void __evas_image_image_cache_flush(Display *disp);
|
||||
static int __evas_anti_alias = 1;
|
||||
static Evas_List drawable_list = NULL;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* image internals ***********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
__evas_image_image_cache_flush(Display *disp)
|
||||
{
|
||||
int size;
|
||||
|
||||
size = imlib_get_cache_size();
|
||||
imlib_set_cache_size(0);
|
||||
imlib_set_cache_size(size);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* image externals ***********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
Evas_Image_Image *
|
||||
__evas_image_image_new_from_file(Display *disp, char *file)
|
||||
{
|
||||
return (Evas_Image_Image *)imlib_load_image(file);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_free(Evas_Image_Image *im)
|
||||
{
|
||||
imlib_context_set_image((Imlib_Image)im);
|
||||
imlib_free_image();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_cache_empty(Display *disp)
|
||||
{
|
||||
int size;
|
||||
|
||||
size = imlib_get_cache_size();
|
||||
imlib_set_cache_size(0);
|
||||
imlib_set_cache_size(size);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_cache_set_size(Display *disp, int size)
|
||||
{
|
||||
imlib_set_cache_size(size);
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_image_cache_get_size(Display *disp)
|
||||
{
|
||||
return imlib_get_cache_size();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_draw(Evas_Image_Image *im,
|
||||
Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
/* if image intersects image update - render */
|
||||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
dst_x, dst_y, dst_w, dst_h))
|
||||
{
|
||||
if (!up->image)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, up->w * up->h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
}
|
||||
}
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_blend_image_onto_image(im, 1,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x - up->x, dst_y - up->y, dst_w, dst_h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_image_get_width(Evas_Image_Image *im)
|
||||
{
|
||||
imlib_context_set_image((Imlib_Image)im);
|
||||
return imlib_image_get_width();
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_image_get_height(Evas_Image_Image *im)
|
||||
{
|
||||
imlib_context_set_image((Imlib_Image)im);
|
||||
return imlib_image_get_height();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_set_borders(Evas_Image_Image *im, int left, int right,
|
||||
int top, int bottom)
|
||||
{
|
||||
Imlib_Border bd;
|
||||
|
||||
imlib_context_set_image((Imlib_Image)im);
|
||||
bd.left = left;
|
||||
bd.right = right;
|
||||
bd.top = top;
|
||||
bd.bottom = bottom;
|
||||
imlib_image_set_border(&bd);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_image_set_smooth_scaling(int on)
|
||||
{
|
||||
__evas_anti_alias = on;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* font internals ************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* font externals ************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
Evas_Image_Font *
|
||||
__evas_image_text_font_new(Display *disp, char *font, int size)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
sprintf(buf, "%s/%i", font, size);
|
||||
return (Evas_Image_Font *)imlib_load_font(buf);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_font_free(Evas_Image_Font *fn)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_free_font();
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_font_get_ascent(Evas_Image_Font *fn)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_get_font_ascent();
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_font_get_descent(Evas_Image_Font *fn)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_get_font_descent();
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_font_get_max_ascent(Evas_Image_Font *fn)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_get_maximum_font_ascent();
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_font_get_max_descent(Evas_Image_Font *fn)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_get_maximum_font_descent();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_font_get_advances(Evas_Image_Font *fn, char *text,
|
||||
int *advance_horiz,
|
||||
int *advance_vert)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_get_text_advance(text, advance_horiz, advance_vert);
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_font_get_first_inset(Evas_Image_Font *fn, char *text)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_get_text_inset(text);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_font_add_path(char *path)
|
||||
{
|
||||
imlib_add_path_to_font_path(path);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_font_del_path(char *path)
|
||||
{
|
||||
imlib_remove_path_from_font_path(path);
|
||||
}
|
||||
|
||||
char **
|
||||
__evas_image_text_font_list_paths(int *count)
|
||||
{
|
||||
return imlib_list_font_path(count);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_cache_empty(Display *disp)
|
||||
{
|
||||
int size;
|
||||
|
||||
size = imlib_get_font_cache_size();
|
||||
imlib_set_font_cache_size(0);
|
||||
imlib_set_font_cache_size(size);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_cache_set_size(Display *disp, int size)
|
||||
{
|
||||
imlib_set_font_cache_size(size);
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_cache_get_size(Display *disp)
|
||||
{
|
||||
return imlib_get_font_cache_size();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_draw(Evas_Image_Font *fn, Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h, int x, int y, char *text,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
Evas_List l;
|
||||
int w, h;
|
||||
|
||||
if ((!fn) || (!text)) return;
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_get_text_size(text, &w, &h);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
/* if image intersects image update - render */
|
||||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (!up->image)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, up->w * up->h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
}
|
||||
}
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_text_draw(x - up->x, y - up->y, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_get_size(Evas_Image_Font *fn, char *text, int *w, int *h)
|
||||
{
|
||||
if ((!fn) || (!text))
|
||||
{
|
||||
*w = 0; *h = 0;
|
||||
return;
|
||||
}
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_get_text_size(text, w, h);
|
||||
}
|
||||
|
||||
int
|
||||
__evas_image_text_get_character_at_pos(Evas_Image_Font *fn, char *text,
|
||||
int x, int y,
|
||||
int *cx, int *cy, int *cw, int *ch)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
return imlib_text_get_index_and_location(text, x, y, cx, cy, cw, ch);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_text_get_character_number(Evas_Image_Font *fn, char *text,
|
||||
int num,
|
||||
int *cx, int *cy, int *cw, int *ch)
|
||||
{
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_text_get_location_at_index(text, num, cx, cy, cw, ch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* rectangle externals *******************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_image_rectangle_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x, int y, int w, int h,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||
imlib_context_set_blend(1);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
/* if image intersects image update - render */
|
||||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (!up->image)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, up->w * up->h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
}
|
||||
}
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_image_fill_rectangle(x - up->x, y - up->y, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* rectangle externals *******************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_image_line_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
Evas_List l;
|
||||
int x, y, w, h;
|
||||
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
w = x2 - x1;
|
||||
if (w < 0) w = -w;
|
||||
h = y2 - y1;
|
||||
if (h < 0) h = -h;
|
||||
if (x1 < x2) x = x1;
|
||||
else x = x2;
|
||||
if (y1 < y2) y = y1;
|
||||
else y = y2;
|
||||
w++; h++;
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
/* if image intersects image update - render */
|
||||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (!up->image)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, up->w * up->h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
}
|
||||
}
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_image_draw_line(x1 - up->x, y1 - up->y, x2 - up->x, y2 - up->y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* gradient externals ********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
Evas_Image_Graident *
|
||||
__evas_image_gradient_new(Display *disp)
|
||||
{
|
||||
return (Evas_Image_Graident *)imlib_create_color_range();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_gradient_free(Evas_Image_Graident *gr)
|
||||
{
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_free_color_range();
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_gradient_color_add(Evas_Image_Graident *gr, int r, int g, int b, int a, int dist)
|
||||
{
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
imlib_add_color_to_color_range(dist);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
imlib_context_set_angle(angle);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
/* if image intersects image update - render */
|
||||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (!up->image)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, up->w * up->h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
}
|
||||
}
|
||||
if (up->image)
|
||||
{
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_image_fill_color_range_rectangle(x - up->x, y - up->y, w, h, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* general externals *********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static Visual *__evas_visual;
|
||||
static Colormap __evas_cmap;
|
||||
|
||||
void
|
||||
__evas_image_sync(Display *disp)
|
||||
{
|
||||
XSync(disp, False);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
imlib_context_set_display(disp);
|
||||
imlib_context_set_visual(__evas_visual);
|
||||
imlib_context_set_colormap(__evas_cmap);
|
||||
imlib_context_set_drawable(win);
|
||||
imlib_context_set_dither(1);
|
||||
imlib_context_set_blend(1);
|
||||
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_List ll;
|
||||
|
||||
for (ll = dr->tmp_images; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = ll->data;
|
||||
|
||||
if (up->image)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
imlib_context_set_image(dr->im);
|
||||
imlib_blend_image_onto_image(up->image, 1,
|
||||
0, 0, w, h,
|
||||
up->x, up->y, w, h);
|
||||
imlib_context_set_image(up->image);
|
||||
imlib_free_image();
|
||||
}
|
||||
free(up);
|
||||
}
|
||||
if (dr->tmp_images)
|
||||
dr->tmp_images = evas_list_free(dr->tmp_images);
|
||||
}
|
||||
free(dr);
|
||||
}
|
||||
if (drawable_list)
|
||||
drawable_list = evas_list_free(drawable_list);
|
||||
drawable_list = NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__evas_image_capable(Display *disp)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Visual *
|
||||
__evas_image_get_visual(Display *disp, int screen)
|
||||
{
|
||||
int depth;
|
||||
|
||||
__evas_visual = imlib_get_best_visual(disp, screen, &depth);
|
||||
return __evas_visual;
|
||||
}
|
||||
|
||||
XVisualInfo *
|
||||
__evas_image_get_visual_info(Display *disp, int screen)
|
||||
{
|
||||
static XVisualInfo *vi = NULL;
|
||||
XVisualInfo vi_template;
|
||||
int n;
|
||||
|
||||
if (vi) return vi;
|
||||
vi_template.visualid = (__evas_image_get_visual(disp, screen))->visualid;
|
||||
vi_template.screen = screen;
|
||||
vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n);
|
||||
return vi;
|
||||
}
|
||||
|
||||
Colormap
|
||||
__evas_image_get_colormap(Display *disp, int screen)
|
||||
{
|
||||
__evas_cmap = DefaultColormap(disp, screen);
|
||||
return __evas_cmap;
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_init(Display *disp, int screen)
|
||||
{
|
||||
imlib_set_font_cache_size(1024 * 1024);
|
||||
imlib_set_cache_size(8 * 1024 * 1024);
|
||||
imlib_set_color_usage(128);
|
||||
__evas_image_get_visual(disp, screen);
|
||||
__evas_image_get_visual(disp, screen);
|
||||
__evas_image_get_colormap(disp, screen);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_draw_add_rect(Display *disp, Imlib_Image dstim, Window win,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
|
||||
dr = l->data;
|
||||
|
||||
if ((dr->im == dstim) && (dr->disp == disp))
|
||||
{
|
||||
Evas_Image_Update *up;
|
||||
|
||||
up = malloc(sizeof(Evas_Image_Update));
|
||||
up->x = x;
|
||||
up->y = y;
|
||||
up->w = w;
|
||||
up->h = h;
|
||||
up->image = NULL;
|
||||
dr->tmp_images = evas_list_append(dr->tmp_images, up);
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
Evas_Image_Drawable *dr;
|
||||
Evas_Image_Update *up;
|
||||
|
||||
dr = malloc(sizeof(Evas_Image_Drawable));
|
||||
dr->im = dstim;
|
||||
dr->disp = disp;
|
||||
dr->tmp_images = NULL;
|
||||
up = malloc(sizeof(Evas_Image_Update));
|
||||
up->x = x;
|
||||
up->y = y;
|
||||
up->w = w;
|
||||
up->h = h;
|
||||
up->image = NULL;
|
||||
drawable_list = evas_list_append(drawable_list, dr);
|
||||
dr->tmp_images = evas_list_append(dr->tmp_images, up);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include "Evas.h"
|
||||
|
||||
#include <Imlib2.h>
|
||||
|
||||
#define SPANS_COMMON(x1, w1, x2, w2) \
|
||||
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
|
||||
#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
|
||||
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
||||
|
||||
typedef void Evas_Image_Image;
|
||||
typedef void Evas_Image_Font;
|
||||
typedef void Evas_Image_Graident;
|
||||
|
||||
typedef struct _evas_image_drawable Evas_Image_Drawable;
|
||||
typedef struct _evas_image_update Evas_Image_Update;
|
||||
|
||||
struct _evas_image_drawable
|
||||
{
|
||||
Display *disp;
|
||||
Imlib_Image im;
|
||||
Evas_List tmp_images;
|
||||
};
|
||||
|
||||
struct _evas_image_update
|
||||
{
|
||||
Imlib_Image image;
|
||||
int x, y, w, h;
|
||||
};
|
||||
|
||||
/***************/
|
||||
/* image stuff */
|
||||
/***************/
|
||||
Evas_Image_Image *__evas_image_image_new_from_file(Display *disp, char *file);
|
||||
void __evas_image_image_free(Evas_Image_Image *im);
|
||||
void __evas_image_image_cache_empty(Display *disp);
|
||||
void __evas_image_image_cache_set_size(Display *disp, int size);
|
||||
int __evas_image_image_cache_get_size(Display *disp);
|
||||
int __evas_image_image_get_width(Evas_Image_Image *im);
|
||||
int __evas_image_image_get_height(Evas_Image_Image *im);
|
||||
void __evas_image_image_set_borders(Evas_Image_Image *im, int left, int right, int top, int bottom);
|
||||
void __evas_image_image_set_smooth_scaling(int on);
|
||||
void __evas_image_image_draw(Evas_Image_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
|
||||
/********/
|
||||
/* text */
|
||||
/********/
|
||||
Evas_Image_Font *__evas_image_text_font_new(Display *disp, char *font, int size);
|
||||
void __evas_image_text_font_free(Evas_Image_Font *fn);
|
||||
int __evas_image_text_font_get_ascent(Evas_Image_Font *fn);
|
||||
int __evas_image_text_font_get_descent(Evas_Image_Font *fn);
|
||||
int __evas_image_text_font_get_max_ascent(Evas_Image_Font *fn);
|
||||
int __evas_image_text_font_get_max_descent(Evas_Image_Font *fn);
|
||||
void __evas_image_text_font_get_advances(Evas_Image_Font *fn, char *text, int *advance_horiz, int *advance_vert);
|
||||
int __evas_image_text_font_get_first_inset(Evas_Image_Font *fn, char *text);
|
||||
void __evas_image_text_font_add_path(char *path);
|
||||
void __evas_image_text_font_del_path(char *path);
|
||||
char **__evas_image_text_font_list_paths(int *count);
|
||||
void __evas_image_text_cache_empty(Display *disp);
|
||||
void __evas_image_text_cache_set_size(Display *disp, int size);
|
||||
int __evas_image_text_cache_get_size(Display *disp);
|
||||
void __evas_image_text_get_size(Evas_Image_Font *fn, char *text, int *w, int *h);
|
||||
int __evas_image_text_get_character_at_pos(Evas_Image_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_image_text_get_character_number(Evas_Image_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_image_text_draw(Evas_Image_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
|
||||
/**************/
|
||||
/* rectangles */
|
||||
/**************/
|
||||
|
||||
void __evas_image_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
|
||||
/*********/
|
||||
/* lines */
|
||||
/*********/
|
||||
|
||||
void __evas_image_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
|
||||
/*************/
|
||||
/* gradients */
|
||||
/*************/
|
||||
Evas_Image_Graident *__evas_image_gradient_new(Display *disp);
|
||||
void __evas_image_gradient_free(Evas_Image_Graident *gr);
|
||||
void __evas_image_gradient_color_add(Evas_Image_Graident *gr, int r, int g, int b, int a, int dist);
|
||||
void __evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
|
||||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_image_init(Display *disp, int screen);
|
||||
int __evas_image_capable(Display *disp);
|
||||
void __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
void __evas_image_sync(Display *disp);
|
||||
Visual *__evas_image_get_visual(Display *disp, int screen);
|
||||
XVisualInfo *__evas_image_get_visual_info(Display *disp, int screen);
|
||||
Colormap __evas_image_get_colormap(Display *disp, int screen);
|
||||
void __evas_image_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h);
|
||||
|
|
@ -59,7 +59,7 @@ __evas_imlib_image_cache_get_size(Display *disp)
|
|||
|
||||
void
|
||||
__evas_imlib_image_draw(Evas_Imlib_Image *im,
|
||||
Display *disp, Window w, int win_w, int win_h,
|
||||
Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ __evas_imlib_image_draw(Evas_Imlib_Image *im,
|
|||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||
imlib_context_set_blend(1);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Imlib_Drawable *dr;
|
||||
|
@ -271,7 +272,7 @@ __evas_imlib_text_cache_get_size(Display *disp)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Window win,
|
||||
__evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h, int x, int y, char *text,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
|
@ -286,6 +287,7 @@ __evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Window win,
|
|||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_get_text_size(text, &w, &h);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
|
@ -375,7 +377,7 @@ __evas_imlib_text_get_character_number(Evas_Imlib_Font *fn, char *text,
|
|||
/* rectangle externals *******************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_imlib_rectangle_draw(Display *disp, Window win,
|
||||
void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x, int y, int w, int h,
|
||||
int r, int g, int b, int a)
|
||||
|
@ -388,6 +390,7 @@ void __evas_imlib_rectangle_draw(Display *disp, Window win,
|
|||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||
imlib_context_set_blend(1);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Imlib_Drawable *dr;
|
||||
|
@ -438,7 +441,7 @@ void __evas_imlib_rectangle_draw(Display *disp, Window win,
|
|||
/* rectangle externals *******************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void __evas_imlib_line_draw(Display *disp, Window win,
|
||||
void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Window win,
|
||||
int win_w, int win_h,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int r, int g, int b, int a)
|
||||
|
@ -452,7 +455,8 @@ void __evas_imlib_line_draw(Display *disp, Window win,
|
|||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_anti_alias(1);
|
||||
w = x2 - x1;
|
||||
imlib_context_set_blend(1);
|
||||
w = x2 - x1;
|
||||
if (w < 0) w = -w;
|
||||
h = y2 - y1;
|
||||
if (h < 0) h = -h;
|
||||
|
@ -534,7 +538,7 @@ __evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, in
|
|||
}
|
||||
|
||||
void
|
||||
__evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle)
|
||||
__evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
|
@ -544,6 +548,7 @@ __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Window win, i
|
|||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Imlib_Drawable *dr;
|
||||
|
@ -604,7 +609,7 @@ __evas_imlib_sync(Display *disp)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_imlib_flush_draw(Display *disp, Window win)
|
||||
__evas_imlib_flush_draw(Display *disp, Imlib_Image dstim, Window win)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
|
@ -613,6 +618,7 @@ __evas_imlib_flush_draw(Display *disp, Window win)
|
|||
imlib_context_set_colormap(__evas_cmap);
|
||||
imlib_context_set_drawable(win);
|
||||
imlib_context_set_dither(1);
|
||||
imlib_context_set_blend(0);
|
||||
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
|
@ -697,7 +703,7 @@ __evas_imlib_init(Display *disp, int screen)
|
|||
}
|
||||
|
||||
void
|
||||
__evas_imlib_draw_add_rect(Display *disp, Window win,
|
||||
__evas_imlib_draw_add_rect(Display *disp, Imlib_Image dstim, Window win,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
Evas_List l;
|
||||
|
|
|
@ -53,7 +53,7 @@ int __evas_imlib_image_get_width(Evas_Imlib_Image *im);
|
|||
int __evas_imlib_image_get_height(Evas_Imlib_Image *im);
|
||||
void __evas_imlib_image_set_borders(Evas_Imlib_Image *im, int left, int right, int top, int bottom);
|
||||
void __evas_imlib_image_set_smooth_scaling(int on);
|
||||
void __evas_imlib_image_draw(Evas_Imlib_Image *im, Display *disp, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
void __evas_imlib_image_draw(Evas_Imlib_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
|
||||
/********/
|
||||
/* text */
|
||||
|
@ -75,19 +75,19 @@ int __evas_imlib_text_cache_get_size(Display *disp);
|
|||
void __evas_imlib_text_get_size(Evas_Imlib_Font *fn, char *text, int *w, int *h);
|
||||
int __evas_imlib_text_get_character_at_pos(Evas_Imlib_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_imlib_text_get_character_number(Evas_Imlib_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch);
|
||||
void __evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
void __evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
|
||||
/**************/
|
||||
/* rectangles */
|
||||
/**************/
|
||||
|
||||
void __evas_imlib_rectangle_draw(Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
|
||||
/*********/
|
||||
/* lines */
|
||||
/*********/
|
||||
|
||||
void __evas_imlib_line_draw(Display *disp, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
|
||||
/*************/
|
||||
/* gradients */
|
||||
|
@ -95,17 +95,17 @@ void __evas_imlib_line_draw(Display *disp, Window win, int win_w, i
|
|||
Evas_Imlib_Graident *__evas_imlib_gradient_new(Display *disp);
|
||||
void __evas_imlib_gradient_free(Evas_Imlib_Graident *gr);
|
||||
void __evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, int a, int dist);
|
||||
void __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
void __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
|
||||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_imlib_init(Display *disp, int screen);
|
||||
int __evas_imlib_capable(Display *disp);
|
||||
void __evas_imlib_flush_draw(Display *disp, Window win);
|
||||
void __evas_imlib_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
void __evas_imlib_sync(Display *disp);
|
||||
Visual *__evas_imlib_get_visual(Display *disp, int screen);
|
||||
XVisualInfo *__evas_imlib_get_visual_info(Display *disp, int screen);
|
||||
Colormap __evas_imlib_get_colormap(Display *disp, int screen);
|
||||
void __evas_imlib_draw_add_rect(Display *disp, Window win, int x, int y, int w, int h);
|
||||
void __evas_imlib_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ _evas_free_line_renderer_data(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <string.h>
|
||||
#include "evas_gl_routines.h"
|
||||
#include "evas_imlib_routines.h"
|
||||
#include "evas_image_routines.h"
|
||||
|
||||
Evas
|
||||
evas_new(void)
|
||||
|
@ -159,6 +160,9 @@ evas_set_font_cache(Evas e, int size)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_text_cache_set_size(e->current.display, size);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -180,6 +184,9 @@ evas_get_font_cache(Evas e)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
return __evas_image_text_cache_get_size(e->current.display);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -202,6 +209,9 @@ evas_flush_font_cache(Evas e)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_text_cache_empty(e->current.display);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -223,6 +233,9 @@ evas_set_image_cache(Evas e, int size)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_image_cache_set_size(e->current.display, size);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -244,6 +257,9 @@ evas_get_image_cache(Evas e)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
return __evas_image_image_cache_get_size(e->current.display);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -266,6 +282,9 @@ evas_flush_image_cache(Evas e)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_image_cache_empty(e->current.display);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -287,6 +306,9 @@ evas_font_add_path(Evas e, char *path)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_text_font_add_path(path);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
@ -308,6 +330,9 @@ evas_font_del_path(Evas e, char *path)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_text_font_del_path(path);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SPANS_COMMON(x1, w1, x2, w2) \
|
||||
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
|
||||
#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
|
||||
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
||||
|
||||
Evas_Layer
|
||||
_evas_get_object_layer(Evas e, Evas_Object o)
|
||||
{
|
||||
|
@ -177,6 +182,120 @@ evas_set_layer_store(Evas e, int l, int store)
|
|||
/* e->changed = 1; */
|
||||
}
|
||||
|
||||
Evas_List
|
||||
evas_objects_in_rect(Evas e, double x, double y, double w, double h)
|
||||
{
|
||||
Evas_List l, ll, objs;
|
||||
Evas_Layer layer;
|
||||
|
||||
objs = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, w, h,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
Evas_List
|
||||
evas_objects_at_position(Evas e, double x, double y)
|
||||
{
|
||||
Evas_List l, ll, objs;
|
||||
Evas_Layer layer;
|
||||
|
||||
objs = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, 1, 1,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
evas_object_in_rect(Evas e, double x, double y, double w, double h)
|
||||
{
|
||||
Evas_List l, ll;
|
||||
Evas_Layer layer;
|
||||
Evas_Object o;
|
||||
|
||||
o = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, w, h,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
o = ob;
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
evas_object_at_position(Evas e, double x, double y)
|
||||
{
|
||||
Evas_List l, ll;
|
||||
Evas_Layer layer;
|
||||
Evas_Object o;
|
||||
|
||||
o = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, 1, 1,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
o = ob;
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
/* stacking within a layer */
|
||||
void
|
||||
evas_raise(Evas e, Evas_Object o)
|
||||
|
|
|
@ -26,6 +26,8 @@ _evas_free_rectangle_renderer_data(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Evas.h"
|
||||
#include "evas_gl_routines.h"
|
||||
#include "evas_imlib_routines.h"
|
||||
#include "evas_image_routines.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -65,6 +66,8 @@ case RENDER_METHOD_3D_HARDWARE:
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -77,21 +80,21 @@ evas_render(Evas e)
|
|||
Imlib_Updates up;
|
||||
Evas_List delete_objects;
|
||||
Evas_List l, ll;
|
||||
void (*func_draw_add_rect) (Display *disp, Window win, int x, int y, int w, int h);
|
||||
void (*func_draw_add_rect) (Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h);
|
||||
void * (*func_image_new_from_file) (Display *disp, char *file);
|
||||
void (*func_image_set_borders) (void *im, int left, int right, int top, int bottom);
|
||||
void (*func_image_draw) (void *im, Display *disp, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
void (*func_image_draw) (void *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h);
|
||||
void (*func_image_free) (void *im);
|
||||
void (*func_flush_draw) (Display *disp, Window w);
|
||||
void (*func_init) (Display *disp, Window w);
|
||||
void (*func_flush_draw) (Display *disp, Imlib_Image dstim, Window w);
|
||||
void (*func_init) (Display *disp, int screen);
|
||||
int (*func_image_get_width) (void *im);
|
||||
int (*func_image_get_height) (void *im);
|
||||
void * (*func_text_font_new) (Display *disp, char *font, int size);
|
||||
void (*func_text_font_free) (void *fn);
|
||||
void (*func_text_draw) (void *fn, Display *disp, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
void (*func_rectangle_draw) (Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void (*func_line_draw) (Display *disp, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
void (*func_gradient_draw) (void *gr, Display *disp, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
void (*func_text_draw) (void *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
|
||||
void (*func_rectangle_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void (*func_line_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
||||
void (*func_gradient_draw) (void *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
|
||||
if ((!e->changed) ||
|
||||
(!e->current.display) ||
|
||||
|
@ -142,6 +145,23 @@ evas_render(Evas e)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
func_draw_add_rect = __evas_image_draw_add_rect;
|
||||
func_image_new_from_file = __evas_image_image_new_from_file;
|
||||
func_image_set_borders = __evas_image_image_set_borders;
|
||||
func_image_draw = __evas_image_image_draw;
|
||||
func_image_free = __evas_image_image_free;
|
||||
func_flush_draw = __evas_image_flush_draw;
|
||||
func_init = __evas_image_init;
|
||||
func_image_get_width = __evas_image_image_get_width;
|
||||
func_image_get_height = __evas_image_image_get_height;
|
||||
func_text_font_new = __evas_image_text_font_new;
|
||||
func_text_font_free = __evas_image_text_font_free;
|
||||
func_text_draw = __evas_image_text_draw;
|
||||
func_rectangle_draw = __evas_image_rectangle_draw;
|
||||
func_line_draw = __evas_image_line_draw;
|
||||
func_gradient_draw = __evas_image_gradient_draw;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -321,6 +341,7 @@ evas_render(Evas e)
|
|||
|
||||
imlib_updates_get_coordinates(u, &x, &y, &w, &h);
|
||||
func_draw_add_rect(e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
x, y, w, h);
|
||||
u = imlib_updates_get_next(u);
|
||||
|
@ -487,6 +508,7 @@ evas_render(Evas e)
|
|||
{
|
||||
func_image_draw(im,
|
||||
e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
|
@ -513,6 +535,7 @@ evas_render(Evas e)
|
|||
{
|
||||
func_text_draw(fn,
|
||||
e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
|
@ -534,6 +557,7 @@ evas_render(Evas e)
|
|||
oo = o;
|
||||
if (oo->current.a != 0)
|
||||
func_rectangle_draw(e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
|
@ -553,6 +577,7 @@ evas_render(Evas e)
|
|||
|
||||
oo = o;
|
||||
func_line_draw(e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
|
@ -574,6 +599,7 @@ evas_render(Evas e)
|
|||
if (o->renderer_data.method[e->current.render_method])
|
||||
func_gradient_draw(o->renderer_data.method[e->current.render_method],
|
||||
e->current.display,
|
||||
e->current.image,
|
||||
e->current.drawable,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
|
@ -591,7 +617,7 @@ evas_render(Evas e)
|
|||
}
|
||||
}
|
||||
}
|
||||
func_flush_draw(e->current.display, e->current.drawable);
|
||||
func_flush_draw(e->current.display, e->current.image, e->current.drawable);
|
||||
}
|
||||
}
|
||||
e->previous = e->current;
|
||||
|
@ -623,6 +649,13 @@ evas_get_optimal_visual(Evas e, Display *disp)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
if (__evas_image_capable(disp))
|
||||
return __evas_image_get_visual(disp, e->current.screen);
|
||||
else
|
||||
{
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
|
@ -655,6 +688,13 @@ evas_get_optimal_colormap(Evas e, Display *disp)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
if (__evas_image_capable(disp))
|
||||
return __evas_image_get_colormap(disp, e->current.screen);
|
||||
else
|
||||
{
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
|
@ -689,6 +729,13 @@ evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c)
|
|||
e->changed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
evas_set_output_image(Evas e, Imlib_Image image)
|
||||
{
|
||||
e->current.image = image;
|
||||
e->changed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
evas_set_output_size(Evas e, int w, int h)
|
||||
{
|
||||
|
@ -732,6 +779,9 @@ evas_set_scale_smoothness(Evas e, int smooth)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
__evas_image_image_set_smooth_scaling(smooth);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <string.h>
|
||||
#include "evas_gl_routines.h"
|
||||
#include "evas_imlib_routines.h"
|
||||
#include "evas_image_routines.h"
|
||||
|
||||
static void
|
||||
_evas_free_text(Evas_Object o)
|
||||
|
@ -29,6 +30,8 @@ _evas_free_text_renderer_data(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -91,6 +94,22 @@ evas_add_text(Evas e, char *font, int size, char *text)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new (e->current.display,
|
||||
oo->current.font,
|
||||
oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
__evas_image_text_get_size(fn, oo->current.text,
|
||||
&oo->current.string.w,
|
||||
&oo->current.string.h);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -195,6 +214,24 @@ evas_text_at_position(Evas e, Evas_Object o, double x, double y,
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
int ret;
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
ret = __evas_image_text_get_character_at_pos(fn, oo->current.text,
|
||||
(int)(x - o->current.x),
|
||||
(int)(y - o->current.y),
|
||||
char_x, char_y,
|
||||
char_w, char_h);
|
||||
__evas_image_text_font_free(fn);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -244,6 +281,21 @@ evas_text_at(Evas e, Evas_Object o, int index,
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
__evas_image_text_get_character_number(fn, oo->current.text,
|
||||
index,
|
||||
char_x, char_y,
|
||||
char_w, char_h);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -290,6 +342,19 @@ evas_text_get_ascent_descent(Evas e, Evas_Object o,
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
a = __evas_image_text_font_get_ascent(fn);
|
||||
d = __evas_image_text_font_get_descent(fn);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -338,6 +403,19 @@ evas_text_get_max_ascent_descent(Evas e, Evas_Object o,
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
a = __evas_image_text_font_get_max_ascent(fn);
|
||||
d = __evas_image_text_font_get_max_descent(fn);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -384,6 +462,18 @@ evas_text_get_advance(Evas e, Evas_Object o,
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
__evas_image_text_font_get_advances(fn, oo->current.text, &a, &d);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -430,6 +520,19 @@ evas_text_get_inset(Evas e, Evas_Object o)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
inset = __evas_image_text_font_get_first_inset(fn, oo->current.text);
|
||||
__evas_image_text_font_free(fn);
|
||||
return (double)inset;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -494,6 +597,25 @@ evas_set_text(Evas e, Evas_Object o, char *text)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new (e->current.display,
|
||||
oo->current.font,
|
||||
oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
__evas_image_text_get_size(fn, oo->current.text,
|
||||
&oo->current.string.w,
|
||||
&oo->current.string.h);
|
||||
evas_resize(e, o,
|
||||
(double)oo->current.string.w,
|
||||
(double)oo->current.string.h);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -568,6 +690,25 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
|
|||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
{
|
||||
Evas_Image_Font *fn;
|
||||
|
||||
fn = __evas_image_text_font_new (e->current.display,
|
||||
oo->current.font,
|
||||
oo->current.size);
|
||||
if (fn)
|
||||
{
|
||||
__evas_image_text_get_size(fn, oo->current.text,
|
||||
&oo->current.string.w,
|
||||
&oo->current.string.h);
|
||||
evas_resize(e, o,
|
||||
(double)oo->current.string.w,
|
||||
(double)oo->current.string.h);
|
||||
__evas_image_text_font_free(fn);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ mouse_out (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Imlib_Image buffer = NULL;
|
||||
Display *d;
|
||||
Visual *vis;
|
||||
Colormap cmap;
|
||||
|
@ -99,8 +100,21 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
e = evas_new();
|
||||
if ((argc == 4) && (!strcmp(argv[3], "software")))
|
||||
if ((argc >= 4) && (!strcmp(argv[3], "software")))
|
||||
evas_set_output_method(e, RENDER_METHOD_ALPHA_SOFTWARE);
|
||||
else if ((argc >= 4) && (!strcmp(argv[3], "image")))
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
buffer = imlib_create_image(win_w, win_h);
|
||||
imlib_context_set_image(buffer);
|
||||
data = imlib_image_get_data();
|
||||
memset(data, 0, win_w * win_h * sizeof(DATA32));
|
||||
imlib_image_put_back_data(data);
|
||||
imlib_image_set_has_alpha(1);
|
||||
evas_set_output_method(e, RENDER_METHOD_IMAGE);
|
||||
evas_set_output_image(e, buffer);
|
||||
}
|
||||
else
|
||||
evas_set_output_method(e, RENDER_METHOD_3D_HARDWARE);
|
||||
|
||||
|
@ -313,6 +327,15 @@ main(int argc, char **argv)
|
|||
}
|
||||
evas_set_angle(e, o_grad, (double)a * 360 / 1000);
|
||||
evas_render(e);
|
||||
if ((argc == 5) && (!strcmp(argv[4], "save")) && (buffer))
|
||||
{
|
||||
imlib_context_set_image(buffer);
|
||||
imlib_image_set_format("png");
|
||||
imlib_save_image("output.png");
|
||||
printf("save done\n");
|
||||
sleep(1);
|
||||
printf("run\n");
|
||||
}
|
||||
a++;
|
||||
m++;
|
||||
if ((a % 25) == 0)
|
||||
|
@ -334,334 +357,3 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
#include "../src/evas_gl_routines.h"
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Display *d;
|
||||
Visual *vis;
|
||||
Colormap cmap;
|
||||
Window win;
|
||||
int win_w, win_h;
|
||||
|
||||
d = XOpenDisplay(NULL);
|
||||
__evas_gl_init(d, DefaultScreen(d));
|
||||
vis = __evas_gl_get_visual(d, DefaultScreen(d));
|
||||
cmap = __evas_gl_get_colormap(d, DefaultScreen(d));
|
||||
|
||||
win_w = 640; win_h = 480;
|
||||
if (argc == 3)
|
||||
{
|
||||
win_w = atoi(argv[1]);
|
||||
win_h = atoi(argv[2]);
|
||||
}
|
||||
{
|
||||
XSetWindowAttributes att;
|
||||
|
||||
att.colormap = cmap;
|
||||
att.border_pixel = 0;
|
||||
att.event_mask = 0;
|
||||
|
||||
win = XCreateWindow(d,
|
||||
RootWindow(d, DefaultScreen(d)),
|
||||
0, 0, win_w, win_h, 0,
|
||||
(__evas_gl_get_visual_info(d, DefaultScreen(d)))->depth,
|
||||
InputOutput,
|
||||
vis,
|
||||
CWColormap | CWBorderPixel | CWEventMask,
|
||||
&att);
|
||||
XMapWindow(d, win);
|
||||
}
|
||||
if (__evas_gl_capable(d))
|
||||
{
|
||||
int a = 0, aa = 0;
|
||||
double t1, t2;
|
||||
Evas_GL_Image *i[4], *bg, *l, *sel, *ic, *tm;
|
||||
Evas_GL_Font *fn[4];
|
||||
Evas_GL_Graident *gr;
|
||||
|
||||
bg = __evas_gl_image_new_from_file(d, "img/sky001.png");
|
||||
i[0] = __evas_gl_image_new_from_file(d, "img/fog1001.png");
|
||||
i[1] = __evas_gl_image_new_from_file(d, "img/fog2001.png");
|
||||
i[2] = __evas_gl_image_new_from_file(d, "img/fog3001.png");
|
||||
i[3] = __evas_gl_image_new_from_file(d, "img/fog4001.png");
|
||||
ic = __evas_gl_image_new_from_file(d, "img/mush.png");
|
||||
tm = __evas_gl_image_new_from_file(d, "img/tm.png");
|
||||
l = __evas_gl_image_new_from_file(d, "img/logo001.png");
|
||||
sel = __evas_gl_image_new_from_file(d, "img/sel.png");
|
||||
__evas_gl_image_set_borders(sel, 3, 3, 3, 3);
|
||||
__evas_gl_text_font_add_path("./fnt");
|
||||
fn[0] = __evas_gl_text_font_new(d, "cinema", 24);
|
||||
fn[1] = __evas_gl_text_font_new(d, "grunge", 16);
|
||||
fn[2] = __evas_gl_text_font_new(d, "morpheus", 24);
|
||||
fn[3] = __evas_gl_text_font_new(d, "notepad", 24);
|
||||
gr = __evas_gl_gradient_new(d);
|
||||
__evas_gl_gradient_color_add(gr, 255, 255, 255, 255, 4);
|
||||
__evas_gl_gradient_color_add(gr, 255, 255, 0, 200, 4);
|
||||
__evas_gl_gradient_color_add(gr, 255, 0, 0, 100, 4);
|
||||
__evas_gl_gradient_color_add(gr, 0, 0, 0, 0, 4);
|
||||
if (!bg)
|
||||
{
|
||||
printf("cannot find images!\n");
|
||||
exit(1);
|
||||
}
|
||||
t1 = 0;
|
||||
for(;;)
|
||||
{
|
||||
int j, k;
|
||||
|
||||
if (a == 0)
|
||||
t1 = get_time();
|
||||
__evas_gl_draw_add_rect(d, win, 0, 0, win_w, win_h);
|
||||
__evas_gl_image_draw(bg, d, win, win_w, win_h,
|
||||
0, 0, __evas_gl_image_get_width(bg), __evas_gl_image_get_height(bg),
|
||||
0, 0, win_w, win_h);
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
int xx, yy;
|
||||
|
||||
j = 3 - (k % 4);
|
||||
xx = (((k + 1) * a) / 2) % win_w;
|
||||
yy = 0;
|
||||
if (k == 2)
|
||||
__evas_gl_image_draw(l, d, win, win_w, win_h,
|
||||
0, 0, __evas_gl_image_get_width(l), __evas_gl_image_get_height(l),
|
||||
(win_w - __evas_gl_image_get_width(l)) / 2, (win_h - __evas_gl_image_get_height(l)) /2, __evas_gl_image_get_width(l), __evas_gl_image_get_height(l));
|
||||
__evas_gl_image_draw(i[j], d, win, win_w, win_h,
|
||||
0, 0, __evas_gl_image_get_width(i[j]), __evas_gl_image_get_height(i[j]),
|
||||
xx, yy, win_w, win_h);
|
||||
__evas_gl_image_draw(i[j], d, win, win_w, win_h,
|
||||
0, 0, __evas_gl_image_get_width(i[j]), __evas_gl_image_get_height(i[j]),
|
||||
xx - win_w, yy, win_w, win_h);
|
||||
}
|
||||
__evas_gl_text_draw(fn[0], d, win, win_w, win_h, 30, 50,
|
||||
"This is a line...",
|
||||
255, 255, 255, 255);
|
||||
__evas_gl_text_draw(fn[1], d, win, win_w, win_h, 30, 100,
|
||||
"Of anti-aliased text drawn nicely...",
|
||||
255, 100, 100, 255);
|
||||
__evas_gl_text_draw(fn[2], d, win, win_w, win_h, 30, 150,
|
||||
"With evas... Oh goodie isn't this fun!",
|
||||
100, 100, 255, 200);
|
||||
__evas_gl_text_draw(fn[3], d, win, win_w, win_h, 30, 200,
|
||||
"With Lots of colors & transparency too!",
|
||||
50, 200, 100, 100);
|
||||
__evas_gl_rectangle_draw(d, win, win_w, win_h,
|
||||
80, 100, 100, 30,
|
||||
200, 40, 100, 100);
|
||||
__evas_gl_rectangle_draw(d, win, win_w, win_h,
|
||||
150, 110, 25, 25,
|
||||
200, 40, 100, 255);
|
||||
__evas_gl_rectangle_draw(d, win, win_w, win_h,
|
||||
170, 160, 200, 180,
|
||||
30, 40, 200, 120);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 100, 160,
|
||||
255, 255, 255, 255);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 100, 40,
|
||||
0, 0, 255, 180);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 100, 20,
|
||||
0, 0, 0, 255);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 100, 5,
|
||||
255, 0, 0, 255);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 12, 2,
|
||||
80, 160, 80, 255);
|
||||
__evas_gl_line_draw(d, win, win_w, win_h,
|
||||
10, 20, 10, 200,
|
||||
255, 255, 0, 100);
|
||||
__evas_gl_image_draw(tm, d, win, win_w, win_h,
|
||||
|
||||
(__evas_gl_image_get_width(tm) / 2) - (((a / 4) + 4) / 2),
|
||||
(__evas_gl_image_get_height(tm) / 2) - (((a / 4) + 4) / 2),
|
||||
(a / 4) + 4, (a / 4) + 4,
|
||||
|
||||
360, 220,
|
||||
200, 250);
|
||||
__evas_gl_image_draw(tm, d, win, win_w, win_h,
|
||||
|
||||
0, 0,
|
||||
(a / 4) + 4, (a / 4) + 4,
|
||||
|
||||
110, 320,
|
||||
100, 100);
|
||||
__evas_gl_image_draw(sel, d, win, win_w, win_h,
|
||||
0, 0, __evas_gl_image_get_width(sel), __evas_gl_image_get_height(sel),
|
||||
10, 50,
|
||||
abs(sin((double)a / win_w) * 300) + 20, abs(cos((double)a / win_w) * 300) + 20);
|
||||
__evas_gl_gradient_draw(gr,
|
||||
d, win, win_w, win_h,
|
||||
300, 100, 200, 200,
|
||||
((double)a * 360) / (double)win_w);
|
||||
__evas_gl_image_draw(ic, d, win, win_w, win_h,
|
||||
|
||||
0, 0,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic),
|
||||
|
||||
a / 4, a / 8,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic));
|
||||
__evas_gl_image_draw(ic, d, win, win_w, win_h,
|
||||
|
||||
0, 0,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic),
|
||||
|
||||
a / 4, a / 4,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic));
|
||||
__evas_gl_image_draw(ic, d, win, win_w, win_h,
|
||||
|
||||
0, 0,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic),
|
||||
|
||||
a / 8, a / 4,
|
||||
__evas_gl_image_get_width(ic),
|
||||
__evas_gl_image_get_height(ic));
|
||||
__evas_gl_flush_draw(d, win);
|
||||
a++;
|
||||
if (a == (win_w * 4))
|
||||
{
|
||||
double pixels;
|
||||
double tim;
|
||||
|
||||
t2 = get_time();
|
||||
tim = t2 - t1;
|
||||
pixels = (((((double)k + 1) * (double)win_w * (double)win_h) + ((double)__evas_gl_image_get_width(l) * (double)__evas_gl_image_get_height(l))) * (double)a);
|
||||
printf("%3.0f pixels in %3.3f seconds\n", pixels, tim);
|
||||
printf("..... %4.1f Mpixels/second\n", pixels / (tim * 1000000));
|
||||
__evas_gl_image_set_smooth_scaling(aa & 0x1);
|
||||
aa++;
|
||||
a = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Your X server is unable to do GLX - no go buddy.\n");
|
||||
}
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue