mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
Much, see ChangeLog
This commit is contained in:
parent
24cefa8d2a
commit
3838ffe065
31
ChangeLog
31
ChangeLog
@ -1,3 +1,34 @@
|
||||
2005-05-14 mallum,,, <mallum@openedhand.com>
|
||||
|
||||
* clutter/cltr-animator.c:
|
||||
Add initial outline
|
||||
* clutter/cltr-button.c: (cltr_button_new_with_pixbuf),
|
||||
(cltr_button_handle_xkeyevent), (cltr_button_handle_xevent),
|
||||
(cltr_button_paint):
|
||||
various tweaks/experimentation
|
||||
* clutter/cltr-core.c: (cltr_init), (cltr_display_height):
|
||||
* clutter/cltr-glu.c: (cltr_glu_set_color):
|
||||
* clutter/cltr-glu.h:
|
||||
Add unfilled rect call.
|
||||
* clutter/cltr-label.c: (cltr_label_new), (cltr_label_paint):
|
||||
* clutter/cltr-list.c: (distfunc), (cltr_list_cell_new),
|
||||
(cltr_list_show), (cltr_list_animate), (cltr_list_paint):
|
||||
update list a little.
|
||||
* clutter/cltr-overlay.c: (cltr_overlay_handle_xevent),
|
||||
(cltr_overlay_paint):
|
||||
* clutter/cltr-private.h:
|
||||
* clutter/cltr-texture.c: (cltr_texture_realize):
|
||||
* clutter/cltr-video.c: (cltr_video_paint):
|
||||
* clutter/cltr.h:
|
||||
* clutter/fonts.c: (draw_layout_on_pixbuf):
|
||||
Fix font alpha blending
|
||||
* examples/Makefile.am:
|
||||
* examples/player.c: (main):
|
||||
* examples/scratch.c: (main):
|
||||
tweaks.
|
||||
* examples/select.c:
|
||||
new example
|
||||
|
||||
2005-05-11 mallum,,, <mallum@openedhand.com>
|
||||
|
||||
* clutter/cltr-video.c: (got_buffering), (cltr_video_new),
|
||||
|
33
clutter/cltr-animator.c
Normal file
33
clutter/cltr-animator.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include "cltr.h"
|
||||
#include "cltr-private.h"
|
||||
|
||||
typedef void (*CltrAnimatorFinishFunc) (CltrAnimator *anim, void *userdata) ;
|
||||
|
||||
struct CltrAnimator
|
||||
{
|
||||
CltrWidget *widget;
|
||||
gint fps;
|
||||
int steps;
|
||||
};
|
||||
|
||||
|
||||
CltrAnimator*
|
||||
cltr_animator_new(CltrWidget *widget)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
cltr_animator_set_args(CltrAnimator *anim)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
cltr_animator_run(CltrAnimator *anim,
|
||||
CltrAnimatorFinishFunc *finish_callback
|
||||
gpointer *finish_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ cltr_button_new_with_pixbuf(Pixbuf *pixb)
|
||||
|
||||
button = CLTR_BUTTON(cltr_button_new(-1, -1));
|
||||
|
||||
return CLTR_WIDGET(button);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -191,7 +192,8 @@ cltr_button_handle_xkeyevent(CltrButton *button, XKeyEvent *xkeyev)
|
||||
break;
|
||||
default:
|
||||
/* ??? */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (button->state != old_state)
|
||||
{
|
||||
@ -203,7 +205,7 @@ cltr_button_handle_xkeyevent(CltrButton *button, XKeyEvent *xkeyev)
|
||||
{
|
||||
/* Evil - need to centralise focus management */
|
||||
ClutterMainContext *ctx = CLTR_CONTEXT();
|
||||
cltr_window_focus_widget(ctx->window, next_focus);
|
||||
cltr_window_focus_widget(CLTR_WIDGET(ctx->window), next_focus);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,6 +223,8 @@ cltr_button_handle_xevent (CltrWidget *widget, XEvent *xev)
|
||||
cltr_button_handle_xkeyevent(button, &xev->xkey);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +255,7 @@ cltr_button_paint(CltrWidget *widget)
|
||||
widget->y,
|
||||
widget->x + widget->width,
|
||||
widget->y + widget->height,
|
||||
widget->width/30,
|
||||
2, 5,
|
||||
NULL);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -25,9 +25,6 @@ cltr_init(int *argc, char ***argv)
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
|
||||
|
||||
|
||||
*/
|
||||
0
|
||||
};
|
||||
@ -38,7 +35,8 @@ cltr_init(int *argc, char ***argv)
|
||||
|
||||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
// XInitThreads ();
|
||||
|
||||
/* XInitThreads (); */
|
||||
|
||||
if ((CltrCntx.xdpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
|
||||
{
|
||||
@ -62,6 +60,10 @@ cltr_init(int *argc, char ***argv)
|
||||
|
||||
CltrCntx.gl_context = glXCreateContext(CltrCntx.xdpy, vinfo, 0, True);
|
||||
|
||||
pixel_set_vals(&CltrCntx.colors[CLTR_COL_BG], 0xff, 0xff, 0xff, 0xff );
|
||||
pixel_set_vals(&CltrCntx.colors[CLTR_COL_BDR],0xff, 0xff, 0xff, 0xff );
|
||||
pixel_set_vals(&CltrCntx.colors[CLTR_COL_FG], 0xff, 0xff, 0xff, 0xff );
|
||||
|
||||
cltr_events_init();
|
||||
|
||||
return 1;
|
||||
@ -82,3 +84,11 @@ cltr_display_height(void)
|
||||
|
||||
return DisplayHeight(ctx->xdpy, ctx->xscreen);
|
||||
}
|
||||
|
||||
PixbufPixel*
|
||||
cltr_core_get_color(CltrNamedColor col)
|
||||
{
|
||||
ClutterMainContext *ctx = CLTR_CONTEXT();
|
||||
|
||||
return &ctx->colors[col];
|
||||
}
|
||||
|
@ -11,75 +11,98 @@ cltr_glu_set_color(PixbufPixel *p)
|
||||
glColor4ub(p->r, p->b, p->g, p->a);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
DrawRoundedSquare(float LineWidth,
|
||||
float x,
|
||||
float y,
|
||||
float radius,
|
||||
float width,
|
||||
float height,
|
||||
float r,
|
||||
float b,
|
||||
float g)
|
||||
{
|
||||
double ang=0;
|
||||
|
||||
glColor3f(r, b, g);
|
||||
glLineWidth(LineWidth);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(x, y + radius);
|
||||
glVertex2f(x, y + height - radius); /* Left Line */
|
||||
|
||||
glVertex2f(x + radius, y);
|
||||
glVertex2f(x + width - radius, y); /* Top Line */
|
||||
|
||||
glVertex2f(x + width, y + radius);
|
||||
glVertex2f(x + width, y + height - radius); /* Right Line */
|
||||
|
||||
glVertex2f(x + radius, y + height);
|
||||
glVertex2f(x + width - radius, y + height);//Bottom Line
|
||||
glEnd();
|
||||
|
||||
float cX= x+radius, cY = y+radius;
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for(ang = PI; ang <= (1.5*PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY); //Top Left
|
||||
}
|
||||
cX = x+width-radius;
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for(ang = (1.5*PI); ang <= (2 * PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY); //Top Right
|
||||
}
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
cY = y+height-radius;
|
||||
for(ang = 0; ang <= (0.5*PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY); //Bottom Right
|
||||
}
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
cX = x+radius;
|
||||
for(ang = (0.5*PI); ang <= PI; ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY);//Bottom Left
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
void
|
||||
cltr_glu_rounded_rect(int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int line_width,
|
||||
int radius,
|
||||
PixbufPixel *col)
|
||||
{
|
||||
double ang = 0;
|
||||
int width = x2-x1, height = y2-y1;
|
||||
float cX = x1+radius, cY = y1+radius;
|
||||
|
||||
if (col)
|
||||
cltr_glu_set_color(col);
|
||||
|
||||
glLineWidth(line_width);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(x1, y1 + radius);
|
||||
glVertex2f(x1, y1 + height - radius); /* Left Line */
|
||||
|
||||
glVertex2f(x1 + radius, y1);
|
||||
glVertex2f(x1 + width - radius, y1); /* Top Line */
|
||||
|
||||
glVertex2f(x1 + width, y1 + radius);
|
||||
glVertex2f(x1 + width, y1 + height - radius); /* Right Line */
|
||||
|
||||
glVertex2f(x1 + radius, y1 + height);
|
||||
glVertex2f(x1 + width - radius, y1 + height); /* Bottom Line */
|
||||
glEnd();
|
||||
|
||||
/* corners */
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
/* Top Left */
|
||||
for(ang = PI; ang <= (1.5*PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
/* Top Right */
|
||||
|
||||
cX = x1 + width-radius;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
for(ang = (1.5*PI); ang <= (2 * PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
cY = y1 + height-radius;
|
||||
|
||||
/* Bottom Right */
|
||||
|
||||
for(ang = 0; ang <= (0.5*PI); ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
cX = x1 + radius;
|
||||
|
||||
/* Bottom Left */
|
||||
|
||||
for(ang = (0.5*PI); ang <= PI; ang = ang + 0.05)
|
||||
{
|
||||
glVertex2d(radius* cos(ang) + cX, radius * sin(ang) + cY);
|
||||
|
||||
}
|
||||
glEnd();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
cltr_glu_rounded_rect_filled(int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int radius,
|
||||
PixbufPixel *col)
|
||||
{
|
||||
double i = 0;
|
||||
double gap = 0.05;
|
||||
|
@ -6,12 +6,21 @@
|
||||
void
|
||||
cltr_glu_set_color(PixbufPixel *p);
|
||||
|
||||
void
|
||||
void
|
||||
cltr_glu_rounded_rect(int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int line_width,
|
||||
int radius,
|
||||
PixbufPixel *col);
|
||||
|
||||
void
|
||||
cltr_glu_rounded_rect_filled(int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int radius,
|
||||
PixbufPixel *col);
|
||||
|
||||
#endif
|
||||
|
@ -36,11 +36,11 @@ cltr_label_new(const char *text,
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
PixbufPixel bg = { 0xff, 0xff, 0xff, 0x00 };
|
||||
PixbufPixel bg = { 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
label->text = strdup(text);
|
||||
label->pixb = pixbuf_new(width, height);
|
||||
|
||||
|
||||
pixbuf_fill_rect(label->pixb, 0, 0, -1, -1, &bg);
|
||||
|
||||
font_draw(font,
|
||||
@ -113,10 +113,11 @@ cltr_label_paint(CltrWidget *widget)
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
/* glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND); */
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
cltr_texture_render_to_gl_quad(label->texture,
|
||||
cltr_widget_abs_x(widget),
|
||||
@ -125,6 +126,7 @@ cltr_label_paint(CltrWidget *widget)
|
||||
cltr_widget_abs_y2(widget));
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glPopMatrix();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "cltr-list.h"
|
||||
#include "cltr-private.h"
|
||||
|
||||
#define ANIM_FPS 200
|
||||
#define ANIM_FPS 50
|
||||
#define FPS_TO_TIMEOUT(t) (1000/(t))
|
||||
|
||||
typedef struct CltrListCell
|
||||
@ -39,7 +39,7 @@ distfunc(CltrList *list, int d)
|
||||
int maxdist = list->widget.height;
|
||||
|
||||
d = (maxdist-ABS(d)) ;
|
||||
return ( exp( (float)d/maxdist * 2.0 ) / exp(2.0) );
|
||||
return ( exp( (float)d/maxdist * 0.8 ) / exp(0.8) ) ;
|
||||
}
|
||||
|
||||
CltrListCell*
|
||||
@ -48,9 +48,9 @@ cltr_list_cell_new(CltrList *list)
|
||||
CltrListCell *cell = NULL;
|
||||
ClutterFont *font;
|
||||
gchar buf[24];
|
||||
PixbufPixel pixel = { 255, 20, 20, 255 }, font_pixel = { 255, 255, 255, 200 };
|
||||
PixbufPixel pixel = { 0xff, 0, 0, 0 }, font_pixel = { 255, 255, 255, 255};
|
||||
|
||||
font = font_new ("Sans Bold 96");
|
||||
font = font_new ("Sans Bold 48");
|
||||
|
||||
cell = g_malloc0(sizeof(CltrListCell));
|
||||
|
||||
@ -60,8 +60,6 @@ cltr_list_cell_new(CltrList *list)
|
||||
|
||||
g_snprintf(&buf[0], 24, "%i %i %i", rand()%10, rand()%10, rand()%10);
|
||||
|
||||
|
||||
|
||||
font_draw(font, cell->pixb, buf, 10, 10, &font_pixel);
|
||||
|
||||
cell->texture = cltr_texture_new(cell->pixb);
|
||||
@ -98,9 +96,9 @@ cltr_list_show(CltrWidget *widget)
|
||||
{
|
||||
CltrList *list = CLTR_LIST(widget);
|
||||
|
||||
int n_items = 50, i;
|
||||
int n_items = 20, i;
|
||||
|
||||
list->active_cell_y = 100;
|
||||
list->active_cell_y = (widget->height / 2) - (list->cell_height/2);
|
||||
|
||||
for (i=0; i<n_items; i++)
|
||||
{
|
||||
@ -174,7 +172,7 @@ cltr_list_animate(CltrList *list)
|
||||
|
||||
if (next_active->rect.y < list->active_cell_y)
|
||||
{
|
||||
cell_top->rect.y += 2;
|
||||
cell_top->rect.y += 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -196,7 +194,7 @@ cltr_list_animate(CltrList *list)
|
||||
|
||||
if (next_active->rect.y > list->active_cell_y)
|
||||
{
|
||||
cell_top->rect.y -= 2;
|
||||
cell_top->rect.y -= 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -228,12 +226,14 @@ cltr_list_timeout_cb(gpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cltr_list_paint(CltrWidget *widget)
|
||||
{
|
||||
GList *cell_item = NULL;
|
||||
CltrList *list = CLTR_LIST(widget);
|
||||
CltrListCell *cell = NULL;
|
||||
PixbufPixel col = { 0xff, 0, 0, 0xff };
|
||||
|
||||
int last;
|
||||
|
||||
@ -249,28 +249,64 @@ cltr_list_paint(CltrWidget *widget)
|
||||
|
||||
while (cell_item)
|
||||
{
|
||||
float scale = 0.0;
|
||||
|
||||
cell = (CltrListCell *)cell_item->data;
|
||||
|
||||
col.r = 0xff; col.g = 0; col.b = 0; col.a = 0xff;
|
||||
|
||||
cell->rect.y = last;
|
||||
|
||||
if (cell->rect.y + cell->rect.height >= 0)
|
||||
{
|
||||
cell->rect.width = list->cell_width * distfunc(list, cell->rect.y - list->active_cell_y);
|
||||
cell->rect.height = list->cell_height * distfunc(list, cell->rect.y - list->active_cell_y);
|
||||
scale = distfunc(list, cell->rect.y - list->active_cell_y);
|
||||
|
||||
cell->rect.width = list->cell_width * scale;
|
||||
cell->rect.height = list->cell_height * scale;
|
||||
|
||||
/* cell->rect.x = (list->widget.width - cell->rect.width) / 6; */
|
||||
cell->rect.x = 0;
|
||||
cell->rect.x = (list->widget.width - cell->rect.width) / 2;
|
||||
}
|
||||
|
||||
last = cell->rect.y + cell->rect.height;
|
||||
|
||||
if (last > 0 && cell->rect.y < list->widget.width) /* crappy clip */
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
if (cell_item == list->active_cell && list->state == CLTR_LIST_STATE_BROWSE)
|
||||
col.b = 0xff;
|
||||
else
|
||||
col.b = 0x00;
|
||||
|
||||
cltr_glu_rounded_rect_filled(cltr_rect_x1(cell->rect),
|
||||
cltr_rect_y1(cell->rect) + (5.0 * scale),
|
||||
cltr_rect_x2(cell->rect),
|
||||
cltr_rect_y2(cell->rect) - (5.0 * scale),
|
||||
10,
|
||||
&col);
|
||||
|
||||
col.r = 0xff; col.g = 0xff; col.b = 0xff; col.a = 0xff;
|
||||
|
||||
/*
|
||||
cltr_glu_rounded_rect(cltr_rect_x1(cell->rect) + 10,
|
||||
cltr_rect_y1(cell->rect) + 12,
|
||||
cltr_rect_x2(cell->rect) - 10,
|
||||
cltr_rect_y2(cell->rect) - 12,
|
||||
10,
|
||||
&col);
|
||||
*/
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
cltr_texture_render_to_gl_quad(cell->texture,
|
||||
cltr_rect_x1(cell->rect),
|
||||
cltr_rect_y1(cell->rect),
|
||||
cltr_rect_x2(cell->rect),
|
||||
cltr_rect_y2(cell->rect));
|
||||
cltr_rect_x1(cell->rect) + 100,
|
||||
cltr_rect_y1(cell->rect) + 10,
|
||||
cltr_rect_x2(cell->rect) - 100,
|
||||
cltr_rect_y2(cell->rect) - 10);
|
||||
}
|
||||
|
||||
cell_item = g_list_next(cell_item);
|
||||
|
@ -44,6 +44,7 @@ static gboolean
|
||||
cltr_overlay_handle_xevent (CltrWidget *widget, XEvent *xev)
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -53,12 +54,12 @@ cltr_overlay_paint(CltrWidget *widget)
|
||||
|
||||
glColor4f(0.5, 0.5, 0.5, 1.0);
|
||||
|
||||
cltr_glu_rounded_rect(widget->x,
|
||||
widget->y,
|
||||
widget->x + widget->width,
|
||||
widget->y + widget->height,
|
||||
widget->width/30,
|
||||
NULL);
|
||||
cltr_glu_rounded_rect_filled(widget->x,
|
||||
widget->y,
|
||||
widget->x + widget->width,
|
||||
widget->y + widget->height,
|
||||
widget->width/30,
|
||||
NULL);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
|
@ -75,6 +75,8 @@ struct ClutterMainContext
|
||||
|
||||
CltrWidget *window;
|
||||
GAsyncQueue *internal_event_q;
|
||||
|
||||
PixbufPixel colors[CLTR_N_COLS];
|
||||
};
|
||||
|
||||
ClutterMainContext CltrCntx;
|
||||
|
@ -292,7 +292,7 @@ cltr_texture_realize(CltrTexture *texture)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, /*GL_COMPRESSED_RGBA_ARB*/ GL_RGBA,
|
||||
texture->width,
|
||||
|
@ -864,13 +864,15 @@ cltr_video_paint(CltrWidget *widget)
|
||||
}
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
// glEnable(GL_BLEND);
|
||||
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
// glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
|
||||
cltr_texture_lock(video->frame_texture);
|
||||
|
||||
@ -884,7 +886,9 @@ cltr_video_paint(CltrWidget *widget)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 0.5);
|
||||
// glDisable(GL_BLEND);
|
||||
|
||||
// glColor4f(1.0, 1.0, 1.0, 0.5);
|
||||
|
||||
// glRecti(100, 100, 600, 600);
|
||||
}
|
||||
|
@ -30,6 +30,15 @@ typedef enum CltrDirection
|
||||
}
|
||||
CltrDirection;
|
||||
|
||||
typedef enum CltrNamedColor
|
||||
{
|
||||
CLTR_COL_BG = 0,
|
||||
CLTR_COL_BDR,
|
||||
CLTR_COL_FG,
|
||||
CLTR_N_COLS
|
||||
}
|
||||
CltrNamedColor;
|
||||
|
||||
typedef struct CltrRect
|
||||
{
|
||||
int x, y, width, height;
|
||||
|
@ -117,6 +117,8 @@ draw_layout_on_pixbuf (PangoLayout *layout,
|
||||
for (i = start_x ; i < end_x; i++)
|
||||
{
|
||||
PixbufPixel pixel;
|
||||
|
||||
#if 0
|
||||
int tr1, tg1, tb1, tr2, tg2, tb2;
|
||||
int a = (*b * color->a + 0x80) >> 8;
|
||||
|
||||
@ -145,7 +147,12 @@ draw_layout_on_pixbuf (PangoLayout *layout,
|
||||
tb1 = (255 - a) * pixel.a + 0x80;
|
||||
tb2 = a * color->a + 0x80;
|
||||
pixel.a = ((tb1 + (tb1 >> 8)) >> 8) + ((tb2 + (tb2 >> 8)) >> 8);
|
||||
|
||||
#endif
|
||||
pixel.r = color->r;
|
||||
pixel.g = color->g;
|
||||
pixel.b = color->b;
|
||||
pixel.a = (( *b * color->a ) >> 8 );
|
||||
|
||||
pixbuf_set_pixel (pixb, i, j, &pixel);
|
||||
b++;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
noinst_PROGRAMS = scratch photos player
|
||||
noinst_PROGRAMS = scratch photos player select
|
||||
|
||||
scratch_SOURCES = scratch.c
|
||||
scratch_CFLAGS = $(CLTR_CFLAGS) $(GST_CFLAGS) $(GCONF_CFLAGS)
|
||||
@ -24,4 +24,12 @@ player_LDFLAGS = \
|
||||
$(GCONF_LIBS) \
|
||||
$(top_builddir)/clutter/libclutter.la
|
||||
|
||||
select_SOURCES = select.c
|
||||
select_CFLAGS = $(CLTR_CFLAGS) $(GST_CFLAGS) $(GCONF_CFLAGS)
|
||||
select_LDFLAGS = \
|
||||
$(CLTR_LIBS) \
|
||||
$(GST_LIBS) \
|
||||
$(GCONF_LIBS) \
|
||||
$(top_builddir)/clutter/libclutter.la
|
||||
|
||||
|
||||
|
@ -53,9 +53,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
CltrWidget *win, *video, *label;
|
||||
CltrFont *font;
|
||||
PixbufPixel col = { 0xff, 0xff, 0xff, 0x66 };
|
||||
|
||||
pixel_set_vals(&col, 0x00, 0x00, 0x00, 0x99);
|
||||
PixbufPixel col = { 0x66, 0x00, 0x00, 0x99 };
|
||||
|
||||
cltr_init (&argc, &argv);
|
||||
|
||||
@ -64,7 +62,7 @@ main (int argc, char *argv[])
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
font = font_new("Sans bold 96");
|
||||
font = font_new("Baubau 72");
|
||||
|
||||
win = cltr_window_new(800, 600);
|
||||
|
||||
@ -74,9 +72,9 @@ main (int argc, char *argv[])
|
||||
|
||||
cltr_widget_add_child(win, video, 0, 0);
|
||||
|
||||
label = cltr_label_new("hello world", font, &col);
|
||||
label = cltr_label_new("Clutter", font, &col);
|
||||
|
||||
cltr_widget_add_child(win, label, 100, 300);
|
||||
cltr_widget_add_child(win, label, 10, 400);
|
||||
|
||||
cltr_window_on_xevent(CLTR_WINDOW(win), handle_xevent, video);
|
||||
|
||||
|
@ -84,11 +84,8 @@ main(int argc, char **argv)
|
||||
cltr_widget_add_child(win, test2, 400, 300);
|
||||
*/
|
||||
|
||||
list = cltr_list_new(640,480,640, 160);
|
||||
|
||||
cltr_widget_add_child(win, list, 0, 0);
|
||||
|
||||
cltr_window_focus_widget(CLTR_WINDOW(win), list);
|
||||
cltr_window_focus_widget(CLTR_WINDOW(win), test);
|
||||
|
||||
|
||||
cltr_widget_show_all(win);
|
||||
|
65
examples/select.c
Normal file
65
examples/select.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <clutter/cltr.h>
|
||||
|
||||
int
|
||||
usage(char *progname)
|
||||
{
|
||||
fprintf(stderr, "Usage ... check source for now\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
CltrWidget *win = NULL, *list = NULL;
|
||||
CltrFont *font = NULL;
|
||||
PixbufPixel col = { 0xff, 0, 0, 0xff };
|
||||
|
||||
gchar *img_path = NULL;
|
||||
gboolean want_fullscreen = FALSE;
|
||||
gint cols = 3;
|
||||
|
||||
cltr_init(&argc, &argv);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!strcmp ("--image-path", argv[i]) || !strcmp ("-i", argv[i]))
|
||||
{
|
||||
if (++i>=argc) usage (argv[0]);
|
||||
img_path = argv[i];
|
||||
continue;
|
||||
}
|
||||
if (!strcmp ("--cols", argv[i]) || !strcmp ("-c", argv[i]))
|
||||
{
|
||||
if (++i>=argc) usage (argv[0]);
|
||||
cols = atoi(argv[i]);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp ("-fs", argv[i]) || !strcmp ("--fullscreen", argv[i]))
|
||||
{
|
||||
want_fullscreen = TRUE;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp("--help", argv[i]) || !strcmp("-h", argv[i]))
|
||||
{
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
win = cltr_window_new(800, 600);
|
||||
|
||||
if (want_fullscreen)
|
||||
cltr_window_set_fullscreen(CLTR_WINDOW(win));
|
||||
|
||||
list = cltr_list_new(800, 600, 800, 600/5);
|
||||
|
||||
cltr_widget_add_child(win, list, 0, 0);
|
||||
|
||||
cltr_window_focus_widget(CLTR_WINDOW(win), list);
|
||||
|
||||
cltr_widget_show_all(win);
|
||||
|
||||
cltr_main_loop();
|
||||
}
|
Loading…
Reference in New Issue
Block a user