aaaaaaaaaah errrrrrr .... stuff!

SVN revision: 3068
This commit is contained in:
Carsten Haitzler 2000-08-08 01:55:28 +00:00
parent 96ac5710df
commit fd578d9ec9
5 changed files with 84 additions and 58 deletions

View File

@ -8,10 +8,8 @@ typedef struct _Evas * Evas;
typedef struct _Evas_Gradient * Evas_Gradient; typedef struct _Evas_Gradient * Evas_Gradient;
typedef struct _Evas_Object_Any * Evas_Object; typedef struct _Evas_Object_Any * Evas_Object;
typedef struct _Evas_Object_Any * Evas_Object_Any; typedef struct _Evas_Object_Any * Evas_Object_Any;
typedef void * Evas_Group;
typedef int Evas_Callback_Type; typedef int Evas_Callback_Type;
typedef int Evas_Image_Format; typedef int Evas_Image_Format;
typedef int Evas_Blend_Mode;
typedef int Evas_Render_Method; typedef int Evas_Render_Method;
typedef struct _Evas_Render_Data * Evas_Render_Data; typedef struct _Evas_Render_Data * Evas_Render_Data;
typedef struct _Evas_List * Evas_List; typedef struct _Evas_List * Evas_List;
@ -25,7 +23,6 @@ typedef struct _Evas_Object_Rectangle * Evas_Object_Rectangle;
typedef struct _Evas_Object_Line * Evas_Object_Line; typedef struct _Evas_Object_Line * Evas_Object_Line;
typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box; typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box;
typedef struct _Evas_Object_Bits * Evas_Object_Bits; typedef struct _Evas_Object_Bits * Evas_Object_Bits;
typedef struct _Evas_Object_Evas * Evas_Object_Evas;
#define RENDER_METHOD_ALPHA_SOFTWARE 0 #define RENDER_METHOD_ALPHA_SOFTWARE 0
#define RENDER_METHOD_BASIC_HARDWARE 1 #define RENDER_METHOD_BASIC_HARDWARE 1
@ -49,12 +46,6 @@ typedef struct _Evas_Object_Evas * Evas_Object_Evas;
#define OBJECT_LINE 3 #define OBJECT_LINE 3
#define OBJECT_GRADIENT_BOX 4 #define OBJECT_GRADIENT_BOX 4
#define OBJECT_BITS 5 #define OBJECT_BITS 5
#define OBJECT_EVAS 6
#define BLEND_ONTOP 0
#define BLEND_ADD 1
#define BLEND_SUBTRACT 2
#define BLEND_RESHADE 3
struct _Evas struct _Evas
{ {
@ -63,11 +54,7 @@ struct _Evas
Drawable drawable; Drawable drawable;
Visual *visual; Visual *visual;
Colormap colormap; Colormap colormap;
struct {
int x, y, w, h;
} output;
struct { struct {
double x, y, w, h; double x, y, w, h;
} viewport; } viewport;
@ -81,6 +68,8 @@ struct _Evas
void (*object_renderer_data_free) (Evas _e, Evas_Object _o); void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
void (*evas_renderer_data_free) (Evas _e); void (*evas_renderer_data_free) (Evas _e);
int changed;
Evas_List layers; Evas_List layers;
Evas_List updates; Evas_List updates;
}; };
@ -136,11 +125,12 @@ struct _Evas_Object_Any
int type; int type;
struct { struct {
double x, y, w, h; double x, y, w, h;
Evas_Blend_Mode mode;
int zoomscale; int zoomscale;
int layer; int layer;
} current, previous; } current, previous;
int changed;
void (*object_free) (Evas_Object _o); void (*object_free) (Evas_Object _o);
Evas_List callbacks; Evas_List callbacks;
@ -154,8 +144,8 @@ struct _Evas_Object_Image
Evas_Object_Any object; Evas_Object_Any object;
struct { struct {
char *file; char *file;
double angle; int new_data;
int new_data; int scale;
struct _fill { struct _fill {
double x, y, w, h; double x, y, w, h;
} fill; } fill;
@ -167,7 +157,6 @@ struct _Evas_Object_Text
Evas_Object_Any object; Evas_Object_Any object;
struct { struct {
char *text; char *text;
double angle;
int r, g, b, a; int r, g, b, a;
} current, previous; } current, previous;
}; };
@ -206,14 +195,6 @@ struct _Evas_Object_Bits
} current, previous; } current, previous;
}; };
struct _Evas_Object_Evas
{
Evas_Object_Any object;
struct {
Evas *evas;
} current, previous;
};
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -234,7 +215,6 @@ Colormap evas_get_optimal_colormap(Evas e, Display *disp);
/* the output settings */ /* the output settings */
void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c); void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c);
void evas_set_output_rect(Evas e, int x, int y, int w, int h);
void evas_set_output_viewport(Evas e, double x, double y, double w, double 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); void evas_set_output_method(Evas e, Evas_Render_Method method);
@ -249,7 +229,6 @@ Evas_Object evas_add_rectangle(Evas e, int r, int g, int b, int a);
Evas_Object evas_add_line(Evas e, int r, int g, int b, int a); Evas_Object evas_add_line(Evas e, int r, int g, int b, int a);
Evas_Object evas_add_gradient_box(Evas e); Evas_Object evas_add_gradient_box(Evas e);
Evas_Object evas_add_bits(Evas e, char *file); Evas_Object evas_add_bits(Evas e, char *file);
Evas_Object evas_add_evas(Evas e, Evas evas);
/* set object settings */ /* set object settings */
void evas_set_image_file(Evas e, Evas_Object o, char *file); void evas_set_image_file(Evas e, Evas_Object o, char *file);
@ -260,7 +239,6 @@ void evas_set_bits_file(Evas e, Evas_Object o, char *file);
void evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a); void evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a);
void evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad); void evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad);
void evas_set_angle(Evas e, Evas_Object o, double angle); void evas_set_angle(Evas e, Evas_Object o, double angle);
void evas_set_blend_mode(Evas e, Evas_Blend_Mode mode);
void evas_set_zoom_scale(Evas e, Evas_Object o, int scale); void evas_set_zoom_scale(Evas e, Evas_Object o, int scale);
void evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2); void evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2);

View File

@ -1481,24 +1481,19 @@ void __evas_gl_line_draw(Display *disp, Window win,
dest_w = win_w; dest_w = win_w;
dest_h = win_h; dest_h = win_h;
} }
if (a < 255) glEnable(GL_BLEND);
{ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
else
glDisable(GL_BLEND);
glEnable(GL_DITHER); glEnable(GL_DITHER);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glShadeModel(GL_FLAT); glShadeModel(GL_FLAT);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
/* glEnable(GL_LINE_SMOOTH);*/ glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES); glBegin(GL_LINES);
glVertex2i(x1, y1); glVertex2d((double)x1 + 0.5, (double)y1 + 0.5);
glVertex2i(x2, y2); glVertex2d((double)x2 + 0.5, (double)y2 + 0.5);
glEnd(); glEnd();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);

View File

@ -16,11 +16,7 @@ evas_new(void)
e->current.viewport.y = 0.0; e->current.viewport.y = 0.0;
e->current.viewport.w = 0.0; e->current.viewport.w = 0.0;
e->current.viewport.h = 0.0; e->current.viewport.h = 0.0;
e->current.output.x = 0; e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
e->current.output.y = 0;
e->current.output.w = 0;
e->current.output.h = 0;
e->current.render_method = RENDER_METHOD_BASIC_HARDWARE;
return e; return e;
} }
@ -40,19 +36,76 @@ evas_free(Evas e)
void void
evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a) evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a)
{ {
switch (o->type)
{
case OBJECT_TEXT:
{
Evas_Object_Text oo;
oo = (Evas_Object_Text)o;
oo->current.r = r;
oo->current.g = g;
oo->current.b = b;
oo->current.a = a;
}
o->changed = 1;
e->changed = 1;
break;
case OBJECT_RECTANGLE:
{
Evas_Object_Rectangle oo;
oo = (Evas_Object_Rectangle)o;
oo->current.r = r;
oo->current.g = g;
oo->current.b = b;
oo->current.a = a;
}
o->changed = 1;
e->changed = 1;
break;
case OBJECT_LINE:
{
Evas_Object_Line oo;
oo = (Evas_Object_Line)o;
oo->current.r = r;
oo->current.g = g;
oo->current.b = b;
oo->current.a = a;
}
o->changed = 1;
e->changed = 1;
break;
default:
break;
}
} }
void void
evas_set_angle(Evas e, Evas_Object o, double angle) evas_set_angle(Evas e, Evas_Object o, double angle)
{ {
} switch (o->type)
{
void case OBJECT_GRADIENT_BOX:
evas_set_blend_mode(Evas e, Evas_Blend_Mode mode) {
{ Evas_Object_Gradient_Box oo;
oo = (Evas_Object_Gradient_Box)o;
oo->current.angle = angle;
}
o->changed = 1;
e->changed = 1;
break;
default:
break;
}
} }
void void
evas_set_zoom_scale(Evas e, Evas_Object o, int scale) evas_set_zoom_scale(Evas e, Evas_Object o, int scale)
{ {
o->current.zoomscale = scale;
o->changed = 1;
e->changed = 1;
} }

View File

@ -45,15 +45,6 @@ evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c)
e->current.colormap = c; e->current.colormap = c;
} }
void
evas_set_output_rect(Evas e, int x, int y, int w, int h)
{
e->current.output.x = x;
e->current.output.y = y;
e->current.output.w = w;
e->current.output.h = h;
}
void void
evas_set_output_viewport(Evas e, double x, double y, double w, double h) evas_set_output_viewport(Evas e, double x, double y, double w, double h)
{ {

View File

@ -126,9 +126,18 @@ main(int argc, char **argv)
__evas_gl_line_draw(d, win, win_w, win_h, __evas_gl_line_draw(d, win, win_w, win_h,
10, 20, 100, 160, 10, 20, 100, 160,
255, 255, 255, 255); 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, __evas_gl_line_draw(d, win, win_w, win_h,
10, 20, 100, 20, 10, 20, 100, 20,
0, 0, 0, 255); 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, __evas_gl_line_draw(d, win, win_w, win_h,
10, 20, 10, 200, 10, 20, 10, 200,
255, 255, 0, 100); 255, 255, 0, 100);