some basic start on documentation....what's happening to me? all this

documentation? :)


SVN revision: 3554
This commit is contained in:
Carsten Haitzler 2000-09-27 15:14:06 +00:00
parent 45edcbef32
commit c6e5ed3a1d
17 changed files with 469 additions and 83 deletions

View File

@ -9,7 +9,7 @@ MAINTAINERCLEANFILES = INSTALL Makefile.in aclocal.m4 config.guess \
ltconfig ltmain.sh missing mkinstalldirs \
stamp-h.in
SUBDIRS = src test
SUBDIRS = src test doc
bin_SCRIPTS = evas-config

View File

@ -171,7 +171,7 @@ AC_SUBST(ttf_includes)
AC_SUBST(ttf_libs)
AC_OUTPUT([
Makefile src/Makefile test/Makefile evas-config
Makefile src/Makefile test/Makefile evas-config doc/Makefile
], [
chmod +x evas-config
])

View File

@ -0,0 +1,3 @@
EXTRA_DIST = \
index.html \
loogo.gif

189
legacy/evas/doc/index.html Normal file
View File

@ -0,0 +1,189 @@
<html>
<head>
<title>Evas - Documentation</title>
</head>
<body
bgcolor=#ffffff
text=#000000
link=#9933aa
vlink=#aa66bb
alink=#ccaacc>
<center>
<font face=lucida,helvetica,arial size=4>
<img src=logo.gif width=512 height=160 alt=Evas><br>
<b>Documentation for programming using Evas</b><br>
By Carsten Haitzler<br>
Copyright (C) 2000<br>
</center>
</font>
<hr>
<font face=lucida,helvetica,arial size=4>
<p>
<b>Introduction</b>
<p>
<blockquote>
<p>
Evas is a canvas library, designed to work with the X Window System. It is
designed to be able to take advantage of any graphics hardwre or CPU
processing power you may have, or to adjust for the lack of it. It has a
simplistic API to access the features of a canvas to aid in making
development using Evas easy.
<p>
First it is necessary to explain what a canvas is and how in principle it
works. For those used to doing the drawing themselves, it is a new way of
looking at the problem of drawing displays that contain lots of information
an application may have to keep track of. This may be in the form of
primities (lines, circles, rectangles, polygons and text) or may be a
mixture of these and more complex objects such as gradients, images etc. An
application normally needs to hold all this data and when required, redraw
the data do a window or pixmap if the data changes, or the window contents
become damaged and need a redraw to restore them. To do this optimally the
application would also need to figure out what exactly canged, which parts
of the window or pixmap this data mapped to and then order the drawing so
all objects are drawn in the right order, and only the part of the window
that needs redrawing is drawn to to save excess processing. For a large
range of objects and data this become a fairly involved problem all on it's
own. Thus came the evolution of the canvas.
<p>
Some of the better known canvas systems around are the Tk Canvas and the
GNOME canvas. In principle a canvas works on an object level. Like windows
in X11, you create objects, move them, resize them show them, hide them,
change their properties etc. The canvas figures out what objects changed and
how only when it comes to it's draw cycle - not every time you do something.
This means moving, resizing and changing object properties is a very fast
and inexpensive operation since only attribute values change, rather than
any drawing being done, unlike when you move and resize windows in X11 which
happens instantly, not later. This means higher efficiency for the
application's rendering, as long ad evas render calls are only called when
the application has hit an idle state (nothing left in it's queue of things
to do for the moment). This also means object maintinence is now left up to
the canvas - the application only needs to keep a handle to that object
aroun so it can be uniquely identified.
<p>
The best way to use Evas is as follows (simplistic pseudo-code):
<p>
<blockquote><font face=fixed color=#442244><pre>
Initialise program
...
Create canvas
Add objects to canvas (fill in with some content)
...
Infinite loop ...
while input events are pending ...
if event is for evas window then pass onto evas
... (no more input events in queue awaiting processing)
modify, add or delete objects in evas to reflect new state
call evas render function
... continue program infinite loop
</pre></font></blockquote>
<p>
In a naievely written program an event loop may have many re-renderins and
re-drawings going on as things are modified, otherwise the application needs
to retain state like evas does and ten handle draws in idle time too, which
means applications need to do the work Evas does themselves, as well as the
optimizations already in place in Evas.
<p>
The major advantages arise out of the fact that Evas does not only handle
the logic of such object management and rendering for you, and optimize it,
it also provides and abstraction layer that allows evas to render not just
solid objects, but temi-transparent objects and images that can be
alpha-blended, anti-aliased text and much more. It not only does these and
does them fast (using Imlib2 as the core rendering engine to do this), but
is able to instantly take advantage of hardware acceleration (for example
OpenGL) quietly for you to blend and scale images, speeding up rendering
many times over, without you having to know a single line of OpenGL. Evas's
Software rotuines alone are many many many times faster than Mesa's software
OpenGL rendering, as Imlib2's code is purpose written for 2D operations with
Assembly optimizations for the core routines.
<p>
</blockquote>
<p>
<b>API Reference</b>
<p>
<blockquote>
<p>
<b>Basic Types</b>
<p>
Here is a list of the basic types of objects Evas deals with and can
generate. It is small to keep things simple.
<p>
<blockquote><font face=fixed color=#442244><pre>
Evas
Evas_Gradient
Evas_Object
Evas_List
Evas_Callback_Type
Evas_Image_Format
Evas_Render_Method
</pre></font></blockquote>
<p>
<font color=#442244>Evas</font>:
<p>
This is the basic type of an Evas itself. When you create a new evas this
type will be returned (not a pointer to it - the Evas type itself. It is
intended to be completely opaque to the application and may change its nature
over time - it may be a void pointer now and tomorrow a hashe'd ID or
anything else). All functions dealing with Evas's and their contents will
require you use this handle to denote what Evas you are talking about.
<p>
<font color=#442244>Evas_Gradient</font>:
<p>
This is the basic type use to build a gradient object from or modify its
colors. You need to create a new one of these before you can create any
useful gradient object. You add colors to the gradient, each one (after the
first color added) are added a certain ``distance'' from the previous color
which will determine relative distances between colors in the gradient. The
larger the distance number, the more of the total gradient length the
transition between the previous color and the one being added will take.
Once you hve filled the gradient with colors, create a gradient object, or
multiple gradient objects and set the gradient to those gradient objects.
When you are done and don't need that gradient anymore, simply free the
gradient. If you wish to change the colors or distances between them in a
gradient object simply build a new gradient, set it to the object then free
the gradient you created.
<p>
<font color=#442244>Evas_Object</font>:
<p>
This is the fundamental building block that makes the contents of an Evas
have meaning. Without any objects in an Evas it will not draw anything, or
draw usless garbage where no objects exist. Whenever you create an object
you will get this type of handle back. If you wish to modify an object's
geoemtry, show, hide, change its properties or delete it you will need to
use this as the handle to addess it by.
<p>
<font color=#442244>Evas_List</font>:
<p>
This is the only non-opaque data type. It is for conevenience of Evas, and
for the application to use to. This type is a doubly-linked list of data.
You may traverse the list using loops and using the next and prev members of
this structure. Do not modify these though as this could mean memory leaks
and losing parts of the list. If prev is NULL, you are at the start of the
list and if next is NULL you are at the end. The data member poitns to
whatever data was inserted at that place in the list. You may read this and
cast it to whatever makes sense in the situation. If Evas returns an
Evas_List of things the data member will be of the type specified by the
function. You may use Evas_List's yourself for anything you find them useful
for.
<p>
<font color=#442244>Evas_Callback_Type</font>:
<p>
This is an enumerated type to specify what kind of event would trigger a
callback to be called when attaching a callback to an object. Legal values
for this are CALLBACK_MOUSE_IN (when the mouse enters the bounds of this
object), CALLBACK_MOUSE_OUT (when the mouse leaves the bounadry of this
object), CALLBACK_MOUSE_DOWN (when a mouse button is pressed in this object),
CALLBACK_MOUSE_UP (when a mouse button is raised in this object),
CALLBACK_MOUSE_MOVE (when the mouse mpoves around in this object) and
CALLBACK_FREE (when this object is actually freed so the application can
find free and data attached to the object if it needs to).
<p>
<font color=#442244>Evas_Image_Format</font>:
<p>
<p>
<font color=#442244>Evas_Render_Method</font>:
<p>
<p>
</blockquote>
</font>
</body>
</html>

BIN
legacy/evas/doc/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -27,11 +27,11 @@ struct _Evas_List
#define RENDER_METHOD_COUNT 5
enum _Evas_Render_Method
{
RENDER_METHOD_ALPHA_SOFTWARE,
RENDER_METHOD_BASIC_HARDWARE,
RENDER_METHOD_3D_HARDWARE,
RENDER_METHOD_ALPHA_HARDWARE,
RENDER_METHOD_IMAGE
RENDER_METHOD_ALPHA_SOFTWARE, /* imlib2 rendering to any drawable */
RENDER_METHOD_BASIC_HARDWARE, /* X11 pixmap rendering to any drawable */
RENDER_METHOD_3D_HARDWARE, /* oepngl rendering to windows only */
RENDER_METHOD_ALPHA_HARDWARE, /* unimplimented */
RENDER_METHOD_IMAGE /* imlib2 rendering to imlib image target */
};
enum _Evas_Callback_Type
@ -188,7 +188,6 @@ double evas_text_get_inset(Evas e, Evas_Object o);
/* object query ops */
void evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a);
Evas_Object evas_get_object_under_mouse(Evas e);
Evas_Object evas_get_object_at_pos(Evas e, double x, double y);
/* data attachment ops */
void evas_put_data(Evas e, Evas_Object o, char *key, void *data);

View File

@ -83,6 +83,7 @@ struct _Evas_Color_Point
struct _Evas_Gradient
{
Evas_List color_points;
int references;
};
struct _Evas_Rectangle

View File

@ -35,6 +35,8 @@ evas_callback_add(Evas e, Evas_Object o, Evas_Callback_Type callback, void (*fun
{
Evas_Callback cb;
if (!e) return;
if (!o) return;
cb = malloc(sizeof(struct _Evas_Callback));
cb->type = callback;
cb->data = data;
@ -48,6 +50,8 @@ evas_callback_del(Evas e, Evas_Object o, Evas_Callback_Type callback)
Evas_List l;
int have_cb;
if (!e) return;
if (!o) return;
have_cb = 1;
while (have_cb)
{

View File

@ -9,7 +9,8 @@ int
_evas_point_in_object(Evas e, Evas_Object o, int x, int y)
{
int ox, oy, ow, oh;
if (o->delete_me) return 0;
_evas_object_get_current_translated_coords(e, o, &ox, &oy, &ow, &oh);
if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh)))
return 1;
@ -33,7 +34,7 @@ _evas_highest_object_at_point(Evas e, int x, int y)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (_evas_point_in_object(e, ob, x, y))
o = ob;
@ -59,7 +60,7 @@ _evas_objects_at_point(Evas e, int x, int y)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (_evas_point_in_object(e, ll->data, x, y))
objs = evas_list_prepend(objs, ll->data);
@ -75,6 +76,7 @@ evas_event_button_down(Evas e, int x, int y, int b)
{
Evas_Object o;
if (!e) return;
if ((b < 1) || (b > 32)) return;
if (!e->mouse.buttons)
{
@ -94,6 +96,7 @@ evas_event_button_up(Evas e, int x, int y, int b)
{
Evas_Object o;
if (!e) return;
if ((b < 1) || (b > 32)) return;
e->mouse.buttons &= ~(1 << (b - 1));
e->mouse.x = x;
@ -115,6 +118,7 @@ evas_event_move(Evas e, int x, int y)
{
Evas_Object o;
if (!e) return;
o = _evas_highest_object_at_point(e, e->mouse.x, e->mouse.y);
if (o != e->mouse.object)
{
@ -159,23 +163,20 @@ evas_event_move(Evas e, int x, int y)
void
evas_event_enter(Evas e)
{
if (!e) return;
e->mouse.in = 1;
}
void
evas_event_leave(Evas e)
{
if (!e) return;
e->mouse.in = 0;
}
Evas_Object
evas_get_object_under_mouse(Evas e)
{
if (!e) return NULL;
return _evas_highest_object_at_point(e, e->mouse.x, e->mouse.y);
}
Evas_Object
evas_get_object_at_pos(Evas e, double x, double y)
{
return _evas_highest_object_at_point(e, x, y);
}

View File

@ -59,6 +59,7 @@ evas_add_gradient_box(Evas e)
Evas_List l;
Evas_Layer layer;
if (!e) return NULL;
o = oo = malloc(sizeof(struct _Evas_Object_Gradient_Box));
memset(o, 0, sizeof(struct _Evas_Object_Gradient_Box));
o->type = OBJECT_GRADIENT_BOX;
@ -95,10 +96,13 @@ evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad)
{
Evas_Object_Gradient_Box oo;
if (!e) return;
if (!o) return;
if (!grad) return;
IF_OBJ(o, OBJECT_GRADIENT_BOX) return;
oo = o;
if (oo->current.gradient)
evas_gradient_free(oo->current.gradient);
grad->references++;
if (oo->current.gradient) evas_gradient_free(oo->current.gradient);
oo->current.gradient = grad;
switch (e->current.render_method)
{
@ -196,6 +200,7 @@ evas_gradient_new(void)
gr = malloc(sizeof(struct _Evas_Gradient));
gr->color_points = NULL;
gr->references = 1;
return gr;
}
@ -204,6 +209,9 @@ evas_gradient_free(Evas_Gradient grad)
{
Evas_List l;
if (!grad) return;
grad->references--;
if (grad->references > 0) return;
if (grad->color_points)
{
for (l = grad->color_points; l; l = l->next)
@ -218,6 +226,7 @@ evas_gradient_add_color(Evas_Gradient grad, int r, int g, int b, int a, int dist
{
Evas_Color_Point col;
if (!grad) return;
col = malloc(sizeof(struct _Evas_Color_Point));
col->r = r;
col->g = g;
@ -230,6 +239,8 @@ evas_gradient_add_color(Evas_Gradient grad, int r, int g, int b, int a, int dist
void
evas_set_angle(Evas e, Evas_Object o, double angle)
{
if (!e) return;
if (!o) return;
switch (o->type)
{
case OBJECT_GRADIENT_BOX:

View File

@ -44,24 +44,28 @@ evas_add_image_from_file(Evas e, char *file)
Evas_Object_Any o;
Evas_List l;
Evas_Layer layer;
if (!e) return NULL;
o = oo = malloc(sizeof(struct _Evas_Object_Image));
memset(o, 0, sizeof(struct _Evas_Object_Image));
o->type = OBJECT_IMAGE;
o->object_free = _evas_free_image;
o->object_renderer_data_free = _evas_free_image_renderer_data;
oo->current.file = strdup(file);
if (file)
{
Imlib_Image im;
im = imlib_load_image(file);
if (im)
oo->current.file = strdup(file);
{
imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height();
imlib_free_image();
Imlib_Image im;
im = imlib_load_image(file);
if (im)
{
imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height();
imlib_free_image();
}
}
}
oo->current.fill.x = 0;
@ -108,44 +112,66 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return;
oo = o;
if (oo->current.file)
free(oo->current.file);
oo->previous.file = NULL;
oo->current.file = strdup(file);
if ((oo->current.file) && (file) && (strcmp(file, oo->current.file)))
{
Imlib_Image im;
im = imlib_load_image(file);
if (im)
if (oo->current.file)
free(oo->current.file);
oo->previous.file = NULL;
oo->current.file = strdup(file);
{
imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height();
imlib_free_image();
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;
oo->current.fill.h = (double)oo->current.image.h;
Imlib_Image im;
im = imlib_load_image(file);
if (im)
{
imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height();
imlib_free_image();
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;
oo->current.fill.h = (double)oo->current.image.h;
}
else
{
oo->current.image.w = 0;
oo->current.image.h = 0;
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;
oo->current.fill.h = (double)oo->current.image.h;
}
}
o->changed = 1;
e->changed = 1;
}
else
{
if (!file)
{
oo->current.file = NULL;
o->changed = 1;
e->changed = 1;
}
else
{
oo->current.image.w = 0;
oo->current.image.h = 0;
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;
oo->current.fill.h = (double)oo->current.image.h;
}
}
o->changed = 1;
e->changed = 1;
}
void
@ -159,6 +185,8 @@ evas_set_image_fill(Evas e, Evas_Object o, double x, double y, double w, double
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return;
oo = o;
oo->current.fill.x = x;
@ -175,6 +203,8 @@ evas_get_image_size(Evas e, Evas_Object o, int *w, int *h)
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return;
oo = o;
if (w) *w = oo->current.image.w;
@ -186,8 +216,14 @@ evas_set_image_border(Evas e, Evas_Object o, int l, int r, int t, int b)
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return;
oo = o;
if (l < 0) l = 0;
if (r < 0) r = 0;
if (t < 0) t = 0;
if (b < 0) b = 0;
oo->current.border.l = l;
oo->current.border.r = r;
oo->current.border.t = t;
@ -201,6 +237,8 @@ evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b)
{
Evas_Object_Image oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_IMAGE) return;
oo = o;
if (l) *l = oo->current.border.l;

View File

@ -43,6 +43,7 @@ evas_add_line(Evas e)
Evas_List l;
Evas_Layer layer;
if (!e) return NULL;
o = oo = malloc(sizeof(struct _Evas_Object_Line));
memset(o, 0, sizeof(struct _Evas_Object_Line));
o->type = OBJECT_LINE;
@ -83,6 +84,8 @@ evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double
Evas_Object_Line oo;
int event_update = 0;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_LINE) return;
oo = (Evas_Object_Line)o;
if ((o->current.visible) &&

View File

@ -54,42 +54,49 @@ evas_new_all(Display *display, Window parent_window,
Window
evas_get_window(Evas e)
{
if (!e) return 0;
return e->current.drawable;
}
Display *
evas_get_display(Evas e)
{
if (!e) return NULL;
return e->current.display;
}
Visual *
evas_get_visual(Evas e)
{
if (!e) return NULL;
return e->current.visual;
}
Colormap
evas_get_colormap(Evas e)
{
if (!e) return 0;
return e->current.colormap;
}
int
evas_get_colors(Evas e)
{
if (!e) return 0;
return e->current.colors;
}
Imlib_Image
evas_get_image(Evas e)
{
if (!e) return NULL;
return e->current.image;
}
Evas_Render_Method
evas_get_render_method(Evas e)
{
if (!e) return RENDER_METHOD_ALPHA_SOFTWARE;
return e->current.render_method;
}
@ -105,7 +112,7 @@ evas_new(void)
e->current.viewport.w = 0.0;
e->current.viewport.h = 0.0;
e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
e->current.colors = 128;
e->current.colors = 216;
return e;
}
@ -114,6 +121,7 @@ evas_free(Evas e)
{
Evas_List l;
if (!e) return;
if (e->current.created_window)
XDestroyWindow(e->current.display, e->current.drawable);
for (l = e->layers; l; l = l->next)
@ -131,6 +139,16 @@ evas_free(Evas e)
void
evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a)
{
if (!e) return;
if (!o) return;
if (r < 0) r = 0;
else if (r > 255) r = 255;
if (g < 0) g = 0;
else if (g > 255) g = 255;
if (b < 0) b = 0;
else if (b > 255) b = 255;
if (a < 0) a = 0;
else if (a > 255) a = 255;
switch (o->type)
{
case OBJECT_IMAGE:
@ -193,8 +211,21 @@ evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a)
void
evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a)
{
if (!e) return;
if (!o) return;
switch (o->type)
{
case OBJECT_IMAGE:
{
Evas_Object_Image oo;
oo = (Evas_Object_Image)o;
if (r) *r = oo->current.color.r;
if (g) *g = oo->current.color.g;
if (b) *b = oo->current.color.b;
if (a) *a = oo->current.color.a;
}
break;
case OBJECT_TEXT:
{
Evas_Object_Text oo;
@ -236,6 +267,8 @@ evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a)
void
evas_set_zoom_scale(Evas e, Evas_Object o, int scale)
{
if (!e) return;
if (!o) return;
o->current.zoomscale = scale;
o->changed = 1;
e->changed = 1;
@ -244,12 +277,15 @@ evas_set_zoom_scale(Evas e, Evas_Object o, int scale)
void
evas_set_pass_events(Evas e, Evas_Object o, int pass_events)
{
if (!e) return;
if (!o) return;
o->pass_events = 1;
}
void
evas_set_font_cache(Evas e, int size)
{
if (!e) return;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -275,6 +311,7 @@ evas_set_font_cache(Evas e, int size)
int
evas_get_font_cache(Evas e)
{
if (!e) return 0;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -301,6 +338,7 @@ evas_get_font_cache(Evas e)
void
evas_flush_font_cache(Evas e)
{
if (!e) return;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -326,6 +364,7 @@ evas_flush_font_cache(Evas e)
void
evas_set_image_cache(Evas e, int size)
{
if (!e) return;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -351,6 +390,7 @@ evas_set_image_cache(Evas e, int size)
int
evas_get_image_cache(Evas e)
{
if (!e) return 0;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -377,6 +417,7 @@ evas_get_image_cache(Evas e)
void
evas_flush_image_cache(Evas e)
{
if (!e) return;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -402,6 +443,8 @@ evas_flush_image_cache(Evas e)
void
evas_font_add_path(Evas e, char *path)
{
if (!e) return;
if (!path) return;
evas_font_del_path(e, path);
switch (e->current.render_method)
{
@ -428,6 +471,8 @@ evas_font_add_path(Evas e, char *path)
void
evas_font_del_path(Evas e, char *path)
{
if (!e) return;
if (!path) return;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -456,6 +501,8 @@ evas_put_data(Evas e, Evas_Object o, char *key, void *data)
Evas_Data d;
Evas_List l;
if (!e) return;
if (!o) return;
if (!key) return;
for (l = o->data; l; l = l->next)
{
@ -479,6 +526,8 @@ evas_get_data(Evas e, Evas_Object o, char *key)
{
Evas_List l;
if (!e) return NULL;
if (!o) return NULL;
if (!key) return NULL;
for (l = o->data; l; l = l->next)
{
@ -495,6 +544,8 @@ evas_remove_data(Evas e, Evas_Object o, char *key)
{
Evas_List l;
if (!e) return NULL;
if (!o) return NULL;
if (!key) return NULL;
for (l = o->data; l; l = l->next)
{
@ -518,6 +569,7 @@ evas_remove_data(Evas e, Evas_Object o, char *key)
int
evas_world_x_to_screen(Evas e, double x)
{
if (!e) return 0;
return (int)((x - e->current.viewport.x) *
((double)e->current.drawable_width / e->current.viewport.w));
}
@ -525,6 +577,7 @@ evas_world_x_to_screen(Evas e, double x)
int
evas_world_y_to_screen(Evas e, double y)
{
if (!e) return 0;
return (int)((y - e->current.viewport.y) *
((double)e->current.drawable_height / e->current.viewport.h));
}
@ -532,6 +585,7 @@ evas_world_y_to_screen(Evas e, double y)
double
evas_screen_x_to_world(Evas e, int x)
{
if (!e) return 0;
return (double)((double)x * (e->current.viewport.w / (double)e->current.drawable_width));
+ e->current.viewport.x;
}
@ -539,6 +593,7 @@ evas_screen_x_to_world(Evas e, int x)
double
evas_screen_y_to_world(Evas e, int y)
{
if (!e) return 0;
return (double)((double)y * (e->current.viewport.h / (double)e->current.drawable_height));
+ e->current.viewport.y;
}

View File

@ -114,6 +114,8 @@ _evas_layer_free(Evas e, Evas_Layer layer)
void
evas_del_object(Evas e, Evas_Object o)
{
if (!e) return;
if (!o) return;
o->delete_me = 1;
evas_hide(e, o);
}
@ -126,6 +128,8 @@ evas_set_layer(Evas e, Evas_Object o, int layer_num)
Evas_List l;
int removed;
if (!e) return;
if (!o) return;
if (layer_num == o->current.layer) return;
removed = 0;
for (l = e->layers; l; l = l->next)
@ -184,6 +188,7 @@ evas_set_layer(Evas e, Evas_Object o, int layer_num)
void
evas_set_layer_store(Evas e, int l, int store)
{
if (!e) return;
/* FIXME: find layer and set store flag */
/* e->changed = 1; */
}
@ -194,6 +199,9 @@ evas_objects_in_rect(Evas e, double x, double y, double w, double h)
Evas_List l, ll, objs;
Evas_Layer layer;
if (!e) return NULL;
if (w < 0) w = 0;
if (h < 0) h = 0;
objs = NULL;
for (l = e->layers; l ; l = l->next)
{
@ -204,7 +212,7 @@ evas_objects_in_rect(Evas e, double x, double y, double w, double h)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (RECTS_INTERSECT(x, y, w, h,
ob->current.x, ob->current.y,
@ -222,6 +230,7 @@ evas_objects_at_position(Evas e, double x, double y)
Evas_List l, ll, objs;
Evas_Layer layer;
if (!e) return NULL;
objs = NULL;
for (l = e->layers; l ; l = l->next)
{
@ -232,7 +241,7 @@ evas_objects_at_position(Evas e, double x, double y)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (RECTS_INTERSECT(x, y, 1, 1,
ob->current.x, ob->current.y,
@ -251,6 +260,7 @@ evas_object_in_rect(Evas e, double x, double y, double w, double h)
Evas_Layer layer;
Evas_Object o;
if (!e) return NULL;
o = NULL;
for (l = e->layers; l ; l = l->next)
{
@ -261,7 +271,7 @@ evas_object_in_rect(Evas e, double x, double y, double w, double h)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (RECTS_INTERSECT(x, y, w, h,
ob->current.x, ob->current.y,
@ -280,6 +290,7 @@ evas_object_at_position(Evas e, double x, double y)
Evas_Layer layer;
Evas_Object o;
if (!e) return NULL;
o = NULL;
for (l = e->layers; l ; l = l->next)
{
@ -290,7 +301,7 @@ evas_object_at_position(Evas e, double x, double y)
Evas_Object ob;
ob = ll->data;
if ((ob->current.visible) && (!ob->pass_events))
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
{
if (RECTS_INTERSECT(x, y, 1, 1,
ob->current.x, ob->current.y,
@ -308,6 +319,8 @@ evas_raise(Evas e, Evas_Object o)
{
Evas_Layer layer;
if (!e) return;
if (!o) return;
layer = _evas_get_object_layer(e, o);
if (layer)
{
@ -327,6 +340,8 @@ evas_lower(Evas e, Evas_Object o)
{
Evas_Layer layer;
if (!e) return;
if (!o) return;
layer = _evas_get_object_layer(e, o);
if (layer)
{
@ -346,6 +361,8 @@ evas_stack_above(Evas e, Evas_Object o, Evas_Object above)
{
Evas_Layer layer;
if (!e) return;
if (!o) return;
layer = _evas_get_object_layer(e, o);
if (layer)
{
@ -361,16 +378,18 @@ evas_stack_above(Evas e, Evas_Object o, Evas_Object above)
}
void
evas_stack_below(Evas e, Evas_Object o, Evas_Object above)
evas_stack_below(Evas e, Evas_Object o, Evas_Object below)
{
Evas_Layer layer;
if (!e) return;
if (!o) return;
layer = _evas_get_object_layer(e, o);
if (layer)
{
o->current.stacking = 1;
layer->objects = evas_list_remove(layer->objects, o);
layer->objects = evas_list_prepend_relative(layer->objects, o, above);
layer->objects = evas_list_prepend_relative(layer->objects, o, below);
o->changed = 1;
e->changed = 1;
if ((o->current.visible) &&
@ -385,6 +404,8 @@ evas_move(Evas e, Evas_Object o, double x, double y)
{
int event_update = 0;
if (!e) return;
if (!o) return;
if ((o->type == OBJECT_LINE)) return;
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
@ -404,11 +425,15 @@ evas_resize(Evas e, Evas_Object o, double w, double h)
{
int event_update = 0;
if (!e) return;
if (!o) return;
if ((o->type == OBJECT_LINE)) return;
if ((o->type == OBJECT_TEXT)) return;
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
if (w < 0) w = 0;
if (h < 0) h = 0;
o->current.w = w;
o->current.h = h;
o->changed = 1;
@ -422,6 +447,8 @@ 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)
{
if (!e) return;
if (!o) return;
if (x) *x = o->current.x;
if (y) *y = o->current.y;
if (w) *w = o->current.w;
@ -433,6 +460,8 @@ evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double
void
evas_show(Evas e, Evas_Object o)
{
if (!e) return;
if (!o) return;
o->current.visible = 1;
o->changed = 1;
e->changed = 1;
@ -443,9 +472,12 @@ evas_show(Evas e, Evas_Object o)
void
evas_hide(Evas e, Evas_Object o)
{
if (!e) return;
if (!o) return;
o->current.visible = 0;
o->changed = 1;
e->changed = 1;
if (e->mouse.button_object == o) e->mouse.button_object = NULL;
if (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))
evas_event_move(e, e->mouse.x, e->mouse.y);
}
@ -466,7 +498,10 @@ evas_object_get_named(Evas e, char *name)
for (ll = layer->objects; ll; ll = ll->next)
{
o = ll->data;
if ((o->name) && (!strcmp(name, o->name))) return o;
if (!o->delete_me)
{
if ((o->name) && (!strcmp(name, o->name))) return o;
}
}
}
return NULL;
@ -475,6 +510,8 @@ evas_object_get_named(Evas e, char *name)
void
evas_object_set_name(Evas e, Evas_Object o, char *name)
{
if (!e) return;
if (!o) return;
if (o->name) free(o->name);
o->name = NULL;
if (name)
@ -484,5 +521,7 @@ evas_object_set_name(Evas e, Evas_Object o, char *name)
char *
evas_object_get_name(Evas e, Evas_Object o)
{
if (!e) return NULL;
if (!o) return NULL;
return o->name;
}

View File

@ -43,6 +43,7 @@ evas_add_rectangle(Evas e)
Evas_List l;
Evas_Layer layer;
if (!e) return NULL;
o = oo = malloc(sizeof(struct _Evas_Object_Rectangle));
memset(o, 0, sizeof(struct _Evas_Object_Rectangle));
o->type = OBJECT_RECTANGLE;

View File

@ -53,28 +53,13 @@ _evas_object_get_previous_translated_coords(Evas e, Evas_Object o,
void
evas_update_rect(Evas e, int x, int y, int w, int h)
{
if (!e) return;
if (w <= 0) return;
if (h <= 0) return;
e->updates = imlib_update_append_rect(e->updates, x, y, w, h);
e->changed = 1;
}
#if 0
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
break;
case RENDER_METHOD_BASIC_HARDWARE:
break;
case RENDER_METHOD_3D_HARDWARE:
break;
case RENDER_METHOD_ALPHA_HARDWARE:
break;
case RENDER_METHOD_IMAGE:
break;
default:
break;
}
#endif
/* drawing */
void
evas_render(Evas e)
@ -98,6 +83,7 @@ evas_render(Evas e)
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) return;
if ((!e->changed) ||
(!e->current.display) ||
(!e->current.drawable) ||
@ -652,6 +638,8 @@ evas_render(Evas e)
Visual *
evas_get_optimal_visual(Evas e, Display *disp)
{
if (!e) return NULL;
if (!disp) return NULL;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -696,6 +684,8 @@ evas_get_optimal_visual(Evas e, Display *disp)
Colormap
evas_get_optimal_colormap(Evas e, Display *disp)
{
if (!e) return 0;
if (!disp) return 0;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:
@ -740,6 +730,7 @@ evas_get_optimal_colormap(Evas e, Display *disp)
void
evas_get_drawable_size(Evas e, int *w, int *h)
{
if (!e) return;
if (w) *w = e->current.drawable_width;
if (h) *h = e->current.drawable_height;
}
@ -747,6 +738,7 @@ evas_get_drawable_size(Evas e, int *w, int *h)
void
evas_get_viewport(Evas e, double *x, double *y, double *w, double *h)
{
if (!e) return;
if (x) *x = e->current.viewport.x;
if (y) *y = e->current.viewport.y;
if (w) *w = e->current.viewport.w;
@ -757,6 +749,7 @@ evas_get_viewport(Evas e, double *x, double *y, double *w, double *h)
void
evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c)
{
if (!e) return;
e->current.display = disp;
e->current.drawable = d;
e->current.visual = v;
@ -767,6 +760,7 @@ evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c)
void
evas_set_output_image(Evas e, Imlib_Image image)
{
if (!e) return;
e->current.image = image;
e->changed = 1;
}
@ -774,6 +768,9 @@ evas_set_output_image(Evas e, Imlib_Image image)
void
evas_set_output_colors(Evas e, int colors)
{
if (!e) return;
if (colors < 2) colors = 1;
else if (colors > 256) colors = 256;
e->current.colors = colors;
e->changed = 1;
}
@ -781,6 +778,9 @@ evas_set_output_colors(Evas e, int colors)
void
evas_set_output_size(Evas e, int w, int h)
{
if (!e) return;
if (w < 1) w = 1;
if (h < 1) h = 1;
e->current.drawable_width = w;
e->current.drawable_height = h;
e->changed = 1;
@ -789,6 +789,7 @@ 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)
{
if (!e) return;
e->current.viewport.x = x;
e->current.viewport.y = y;
e->current.viewport.w = w;
@ -799,6 +800,13 @@ 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)
{
if (!e) return;
if ((method != RENDER_METHOD_ALPHA_SOFTWARE) &&
(method != RENDER_METHOD_BASIC_HARDWARE) &&
(method != RENDER_METHOD_3D_HARDWARE) &&
(method != RENDER_METHOD_ALPHA_HARDWARE) &&
(method != RENDER_METHOD_IMAGE))
return;
if (!e->current.display)
{
e->current.render_method = method;
@ -809,6 +817,9 @@ evas_set_output_method(Evas e, Evas_Render_Method method)
void
evas_set_scale_smoothness(Evas e, int smooth)
{
if (!e) return;
if (smooth <= 0) smooth = 0;
else smooth = 1;
switch (e->current.render_method)
{
case RENDER_METHOD_ALPHA_SOFTWARE:

View File

@ -48,6 +48,7 @@ evas_add_text(Evas e, char *font, int size, char *text)
Evas_List l;
Evas_Layer layer;
if (!e) return NULL;
o = oo = malloc(sizeof(struct _Evas_Object_Text));
memset(o, 0, sizeof(struct _Evas_Object_Text));
o->type = OBJECT_TEXT;
@ -160,6 +161,8 @@ evas_get_text_string(Evas e, Evas_Object o)
{
Evas_Object_Text oo;
if (!e) return NULL;
if (!o) return NULL;
IF_OBJ(o, OBJECT_TEXT) return "";
oo = o;
return oo->current.text;
@ -170,6 +173,8 @@ evas_get_text_font(Evas e, Evas_Object o)
{
Evas_Object_Text oo;
if (!e) return NULL;
if (!o) return NULL;
IF_OBJ(o, OBJECT_TEXT) return "";
oo = o;
return oo->current.font;
@ -180,6 +185,8 @@ evas_get_text_size(Evas e, Evas_Object o)
{
Evas_Object_Text oo;
if (!e) return 0;
if (!o) return 0;
IF_OBJ(o, OBJECT_TEXT) return 0;
oo = o;
return oo->current.size;
@ -191,6 +198,8 @@ evas_text_at_position(Evas e, Evas_Object o, double x, double y,
{
Evas_Object_Text oo;
if (!e) return -1;
if (!o) return -1;
IF_OBJ(o, OBJECT_TEXT) return -1;
oo = o;
switch (e->current.render_method)
@ -281,6 +290,8 @@ evas_text_at(Evas e, Evas_Object o, int index,
{
Evas_Object_Text oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_TEXT) return;
oo = o;
switch (e->current.render_method)
@ -359,6 +370,8 @@ evas_text_get_ascent_descent(Evas e, Evas_Object o,
int a, d;
Evas_Object_Text oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_TEXT) return;
oo = o;
a = 0; d = 0;
@ -432,6 +445,8 @@ evas_text_get_max_ascent_descent(Evas e, Evas_Object o,
int a, d;
Evas_Object_Text oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_TEXT) return;
oo = o;
a = 0; d = 0;
@ -505,6 +520,8 @@ evas_text_get_advance(Evas e, Evas_Object o,
int a, d;
Evas_Object_Text oo;
if (!e) return;
if (!o) return;
IF_OBJ(o, OBJECT_TEXT) return;
oo = o;
a = 0; d = 0;
@ -573,7 +590,9 @@ evas_text_get_inset(Evas e, Evas_Object o)
Evas_Object_Text oo;
int inset;
IF_OBJ(o, OBJECT_TEXT) return 0.0;
if (!e) return 0;
if (!o) return 0;
IF_OBJ(o, OBJECT_TEXT) return 0;
oo = o;
switch (e->current.render_method)
{
@ -640,6 +659,8 @@ evas_text_get_inset(Evas e, Evas_Object o)
void
evas_set_text(Evas e, Evas_Object o, char *text)
{
if (!e) return;
if (!o) return;
switch (o->type)
{
case OBJECT_TEXT:
@ -647,8 +668,12 @@ evas_set_text(Evas e, Evas_Object o, char *text)
Evas_Object_Text oo;
oo = (Evas_Object_Text)o;
if ((text) && (oo->current.text) && (!strcmp(oo->current.text, text)))
return;
if (oo->current.text) free(oo->current.text);
oo->current.text = strdup(text);
oo->current.text = NULL;
if (text)
oo->current.text = strdup(text);
oo->previous.text = NULL;
{
switch (e->current.render_method)
@ -749,6 +774,10 @@ evas_set_text(Evas e, Evas_Object o, char *text)
void
evas_set_font(Evas e, Evas_Object o, char *font, int size)
{
if (!e) return;
if (!o) return;
if (!font) return;
if (size < 0) size = 0;
switch (o->type)
{
case OBJECT_TEXT:
@ -756,6 +785,8 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
Evas_Object_Text oo;
oo = (Evas_Object_Text)o;
if ((oo->current.font) && (!strcmp(oo->current.font, font)))
return;
if (oo->current.font) free(oo->current.font);
oo->current.font = strdup(font);
oo->previous.font = NULL;