static void st_polygon_pick (ClutterActor *self, const ClutterColor *pick_color) { CoglPath *selection_path; gfloat coords[8]; StPolygon *area = ST_POLYGON (self); StPolygonPrivate *priv = area->priv; if (!clutter_actor_should_pick_paint (self)) return; coords[0] = priv->ulc_x; coords[1] = priv->ulc_y; coords[2] = priv->llc_x; coords[3] = priv->llc_y; coords[4] = priv->lrc_x; coords[5] = priv->lrc_y; coords[6] = priv->urc_x; coords[7] = priv->urc_y; cogl_set_source_color4ub (pick_color->red, pick_color->green, pick_color->blue, pick_color->alpha); selection_path = cogl_path_new(); cogl_path_polygon (selection_path, (float *)coords, 4); cogl_path_fill (selection_path); cogl_object_unref (selection_path); }
static void st_polygon_paint (ClutterActor *self) { StPolygon *area = ST_POLYGON (self); StPolygonPrivate *priv = area->priv; if (priv->debug) { gfloat coords[8]; CoglPath *selection_path; cogl_set_source_color4f (.50, .50, .50, .50); coords[0] = priv->ulc_x; coords[1] = priv->ulc_y; coords[2] = priv->llc_x; coords[3] = priv->llc_y; coords[4] = priv->lrc_x; coords[5] = priv->lrc_y; coords[6] = priv->urc_x; coords[7] = priv->urc_y; selection_path = cogl_path_new(); cogl_path_polygon (selection_path, (float *)coords, 4); cogl_path_fill (selection_path); cogl_object_unref (selection_path); } }
static void test_paint_polyg (void) { gfloat poly_coords[] = { -50, -50, +50, -30, +30, +30, -30, +40 }; cogl_path_polygon (poly_coords, 4); }
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); }
void _cogl_pango_display_list_render (CoglPangoDisplayList *dl, const CoglColor *color) { GSList *l; for (l = dl->nodes; l; l = l->next) { CoglPangoDisplayListNode *node = l->data; CoglColor draw_color; if (node->pipeline == NULL) { if (node->type == COGL_PANGO_DISPLAY_LIST_TEXTURE) node->pipeline = _cogl_pango_pipeline_cache_get (dl->pipeline_cache, node->d.texture.texture); else node->pipeline = _cogl_pango_pipeline_cache_get (dl->pipeline_cache, NULL); } if (node->color_override) /* Use the override color but preserve the alpha from the draw color */ cogl_color_init_from_4ub (&draw_color, cogl_color_get_red_byte (&node->color), cogl_color_get_green_byte (&node->color), cogl_color_get_blue_byte (&node->color), cogl_color_get_alpha_byte (color)); else draw_color = *color; cogl_color_premultiply (&draw_color); cogl_pipeline_set_color (node->pipeline, &draw_color); cogl_push_source (node->pipeline); switch (node->type) { case COGL_PANGO_DISPLAY_LIST_TEXTURE: _cogl_pango_display_list_render_texture (node); break; case COGL_PANGO_DISPLAY_LIST_RECTANGLE: cogl_rectangle (node->d.rectangle.x_1, node->d.rectangle.y_1, node->d.rectangle.x_2, node->d.rectangle.y_2); break; case COGL_PANGO_DISPLAY_LIST_TRAPEZOID: { float points[8]; CoglPath *path; points[0] = node->d.trapezoid.x_11; points[1] = node->d.trapezoid.y_1; points[2] = node->d.trapezoid.x_12; points[3] = node->d.trapezoid.y_2; points[4] = node->d.trapezoid.x_22; points[5] = node->d.trapezoid.y_2; points[6] = node->d.trapezoid.x_21; points[7] = node->d.trapezoid.y_1; path = cogl_path_new (); cogl_path_polygon (path, points, 4); cogl_path_fill (path); cogl_object_unref (path); } break; } cogl_pop_source (); } }