static void test_paint_elp () { cogl_path_ellipse (0, 0, CLUTTER_INT_TO_FIXED (60), CLUTTER_INT_TO_FIXED (40)); }
static void test_coglbox_paint(ClutterActor *self) { TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self); ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF}; ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF}; ClutterFixed texcoords[4] = { CLUTTER_FLOAT_TO_FIXED (0.3f), CLUTTER_FLOAT_TO_FIXED (0.3f), CLUTTER_FLOAT_TO_FIXED (0.7f), CLUTTER_FLOAT_TO_FIXED (0.7f) }; priv = TEST_COGLBOX_GET_PRIVATE (self); cogl_color (&cback); cogl_rectangle (0,0,400,400); cogl_color (&cwhite); cogl_push_matrix (); cogl_translate (100,100,0); cogl_texture_rectangle (priv->cogl_handle, 0, 0, CLUTTER_INT_TO_FIXED (200), CLUTTER_INT_TO_FIXED (200), texcoords[0], texcoords[1], texcoords[2], texcoords[3]); cogl_pop_matrix(); }
static void test_paint_rect () { cogl_path_rectangle (CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (-25), CLUTTER_INT_TO_FIXED (100), CLUTTER_INT_TO_FIXED (50)); }
static void test_paint_line () { cogl_path_line (CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (-25), CLUTTER_INT_TO_FIXED (50), CLUTTER_INT_TO_FIXED (25)); }
static void test_paint_curve () { cogl_path_move_to (CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (+50)); cogl_path_curve_to (CLUTTER_INT_TO_FIXED (+100), CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (-100), CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (+50), CLUTTER_INT_TO_FIXED (+50)); }
static VALUE rb_cogl_texture_rectangle (int argc, VALUE *argv, VALUE self) { VALUE x1in, y1in, x2in, y2in, tx1, ty1, tx2, ty2; CoglFixed x1, y1, x2, y2; CoglHandle tex = rb_cogl_texture_get_handle (self); rb_scan_args (argc, argv, "26", &x1in, &y1in, &x2in, &y2in, &tx1, &ty1, &tx2, &ty2); x1 = rbclt_num_to_fixed (x1in); y1 = rbclt_num_to_fixed (y1in); if (x2in == Qnil) x2 = CLUTTER_INT_TO_FIXED (cogl_texture_get_width (tex)) + x1; else x2 = rbclt_num_to_fixed (x2in); if (y2in == Qnil) y2 = CLUTTER_INT_TO_FIXED (cogl_texture_get_height (tex)) + y1; else y2 = rbclt_num_to_fixed (y2in); cogl_texture_rectangle (tex, x1, y1, x2, y2, tx1 == Qnil ? 0 : rbclt_num_to_fixed (tx1), ty1 == Qnil ? 0 : rbclt_num_to_fixed (ty1), tx2 == Qnil ? COGL_FIXED_1 : rbclt_num_to_fixed (tx2), ty2 == Qnil ? COGL_FIXED_1 : rbclt_num_to_fixed (ty2)); return self; }
static void test_paint_polyg () { gint poly_coords[] = { CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (+50), CLUTTER_INT_TO_FIXED (-30), CLUTTER_INT_TO_FIXED (+30), CLUTTER_INT_TO_FIXED (+30), CLUTTER_INT_TO_FIXED (-30), CLUTTER_INT_TO_FIXED (+40) }; cogl_path_polygon (poly_coords, 4); }
static void test_paint_polyl () { ClutterFixed poly_coords[] = { CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (-50), CLUTTER_INT_TO_FIXED (+50), CLUTTER_INT_TO_FIXED (-30), CLUTTER_INT_TO_FIXED (+30), CLUTTER_INT_TO_FIXED (+30), CLUTTER_INT_TO_FIXED (-30), CLUTTER_INT_TO_FIXED (+40) }; cogl_path_polyline (poly_coords, 4); }
static void clutter_x11_texture_pixmap_paint (ClutterActor *self) { ClutterX11TexturePixmap *texture = CLUTTER_X11_TEXTURE_PIXMAP (self); ClutterX11TexturePixmapPrivate *priv = texture->priv; gint x_1, y_1, x_2, y_2; ClutterColor col = { 0xff, 0xff, 0xff, 0xff }; ClutterFixed t_w, t_h; GList *shape; CoglHandle cogl_texture; g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture)); /* If we have no shapes, just call what we had before */ if (priv->shapes==0) { CLUTTER_ACTOR_CLASS(clutter_x11_texture_pixmap_parent_class)->paint(self); return; } if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR(texture))) clutter_actor_realize (CLUTTER_ACTOR(texture)); CLUTTER_NOTE (PAINT, "painting X11 texture '%s'", clutter_actor_get_name (self) ? clutter_actor_get_name (self) : "unknown"); col.alpha = clutter_actor_get_paint_opacity (self); cogl_color (&col); clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2); CLUTTER_NOTE (PAINT, "paint to x1: %i, y1: %i x2: %i, y2: %i " "opacity: %i", x_1, y_1, x_2, y_2, clutter_actor_get_opacity (self)); t_w = CFX_ONE; t_h = CFX_ONE; cogl_texture = clutter_texture_get_cogl_texture(CLUTTER_TEXTURE(self)); if (cogl_texture == COGL_INVALID_HANDLE) return; /* so now we go through our shapes and render */ for (shape = priv->shapes; shape; shape = shape->next) { gint w = x_2 - x_1; gint h = y_2 - y_1; ClutterGeometry *geo = (ClutterGeometry*)shape->data; cogl_texture_rectangle ( cogl_texture, CLUTTER_INT_TO_FIXED(w * geo->x / priv->pixmap_width), CLUTTER_INT_TO_FIXED(h * geo->y / priv->pixmap_height), CLUTTER_INT_TO_FIXED(w * (geo->x+geo->width) / priv->pixmap_width), CLUTTER_INT_TO_FIXED(h * (geo->y+geo->height) / priv->pixmap_height), t_w * geo->x / priv->pixmap_width, t_h * geo->y / priv->pixmap_height, t_w * (geo->x+geo->width) / priv->pixmap_width, t_h * (geo->y+geo->height) / priv->pixmap_height); } }