summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguillaume <guillaume>2007-01-29 02:46:37 +0000
committerguillaume <guillaume>2007-01-29 02:46:37 +0000
commit623e9ea41083fe2cd3f90e059f1d82e492fa2a93 (patch)
tree7e0a0561833c06f26a40fac2c3ce5e7a85a6ba9d
parent7b9475d05b6135601b9d19fc1f7769a95460fb4d (diff)
downloadberyl-desktop-manager-623e9ea41083fe2cd3f90e059f1d82e492fa2a93.tar.gz
beryl-desktop-manager-623e9ea41083fe2cd3f90e059f1d82e492fa2a93.tar.bz2
bdm: add test text widget
-rw-r--r--src/bdm.c20
-rw-r--r--src/testWidget.c31
2 files changed, 41 insertions, 10 deletions
diff --git a/src/bdm.c b/src/bdm.c
index abf4cfb..980aad2 100644
--- a/src/bdm.c
+++ b/src/bdm.c
@@ -53,9 +53,9 @@ static void renderImage(cairo_t * cr, BDMImage * image, ScreenArea * area)
cairo_rectangle(cr,widx,widy,widx+width,widy+height);
cairo_move_to(cr,widx+x,widy+y);
- cairo_clip(cr);
+ cairo_clip(cr);
- cairo_scale(cr,.5,.5);
+ //cairo_scale(cr,(float)image->attrib->width/(float)image->pixW,image->attrib->height/(float)image->pixH);
gdk_cairo_set_source_pixbuf(cr,image->pixbuf,x,y);
cairo_paint_with_alpha(cr,image->attrib->alpha);
@@ -107,21 +107,23 @@ static void renderText (cairo_t * cr, BDMText * text, ScreenArea * area)
pango_cairo_update_layout (cr, layout);
- cairo_set_source_rgba(cr,0,0,0,0);
- cairo_paint(cr);
cairo_save(cr);
cairo_set_operator (cr, text->attrib->cairoOperator);
pango_layout_get_pixel_size (layout, &w, &h);
- cairo_scale (cr, (float)text->attrib->width/(float)w,
- (float)text->attrib->height/(float)h);
+// cairo_scale (cr, (float)text->attrib->width/(float)w,
+// (float)text->attrib->height/(float)h);
cairo_rotate(cr,text->attrib->xrot);
- cairo_set_source_rgba (cr, text->color[0] / 65535.0, text->color[1] / 65535.0,
- text->color[2] / 65535.0, text->color[3] / 65535.0);
+// cairo_set_source_rgba (cr, text->color[0] / 65535.0, text->color[1] / 65535.0,
+// text->color[2] / 65535.0, text->color[3] / 65535.0);
+// cairo_rectangle (cr, text->widget->attrib->x, text->widget->attrib->y,
+// text->widget->attrib->x + w,
+// text->widget->attrib->y + h);
cairo_move_to (cr, text->widget->attrib->x + text->attrib->x,
text->widget->attrib->y + text->attrib->y);
+// cairo_clip (cr);
pango_cairo_show_layout (cr, layout);
- cairo_paint_with_alpha(cr, text->attrib->alpha);
+ cairo_paint_with_alpha (cr, text->attrib->alpha);
g_object_unref (layout);
cairo_restore (cr);
diff --git a/src/testWidget.c b/src/testWidget.c
index 0f7da4d..d55c3d6 100644
--- a/src/testWidget.c
+++ b/src/testWidget.c
@@ -7,7 +7,7 @@ BDMWidget * mywidget;
int init (BDMWidget * widget)
{
images = malloc(sizeof(BDMImage));
- texts = NULL;
+ texts = malloc(sizeof(BDMText));
mywidget = widget;
images->attrib = malloc(sizeof(BDMPaintAttribs));
@@ -17,6 +17,7 @@ int init (BDMWidget * widget)
images->attrib->alpha = 1.0f;
images->attrib->width = 100;
images->attrib->height = 100;
+ images->attrib->xrot = 0;
images->attrib->needsPainting = 1;
images->attrib->cairoOperator = CAIRO_OPERATOR_OVER;
images->attrib->updateFont = 0;
@@ -28,6 +29,34 @@ int init (BDMWidget * widget)
images->pixbuf = gdk_pixbuf_new_from_file("./babytux.png",NULL);
images->pixW = gdk_pixbuf_get_width(images->pixbuf);
images->pixH = gdk_pixbuf_get_height(images->pixbuf);
+
+ texts->attrib = malloc(sizeof(BDMPaintAttribs));
+
+ texts->attrib->x = 100;
+ texts->attrib->y = 100;
+ texts->attrib->alpha = 1.0f;
+ texts->attrib->width = 100;
+ texts->attrib->height = 100;
+ texts->attrib->xrot = 0;
+ texts->attrib->needsPainting = 1;
+ texts->attrib->cairoOperator = CAIRO_OPERATOR_OVER;
+ texts->attrib->updateFont = 1;
+
+ texts->next = 0;
+ texts->prev = 0;
+ texts->widget = widget;
+
+ texts->font = NULL;
+ texts->text = "Beryl? Sexy stuff!";
+ texts->family = "Sans";
+ texts->size = 20;
+ texts->color[0] = 0x0;
+ texts->color[1] = 0x0;
+ texts->color[2] = 0x0;
+ texts->color[3] = 0xffff;
+ texts->style = 0;
+ texts->ellipsize = 0;
+
widget->attrib->needsPainting = 1;
return 1;