void gtk_css_style_render_outline (GtkCssStyle *style, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { GtkBorderStyle border_style[4]; GtkRoundedBox border_box; double border_width[4]; GdkRGBA colors[4]; border_style[0] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_STYLE)); if (border_style[0] != GTK_BORDER_STYLE_NONE) { cairo_rectangle_t rect; compute_outline_rect (style, x, y, width, height, &rect); border_style[1] = border_style[2] = border_style[3] = border_style[0]; border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100); border_width[3] = border_width[2] = border_width[1] = border_width[0]; colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_COLOR)); colors[3] = colors[2] = colors[1] = colors[0]; _gtk_rounded_box_init_rect (&border_box, rect.x, rect.y, rect.width, rect.height); _gtk_rounded_box_apply_outline_radius_for_style (&border_box, style, GTK_JUNCTION_NONE); render_border (cr, &border_box, border_width, 0, colors, border_style); } }
void gtk_css_style_render_border (GtkCssStyle *style, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height, guint hidden_side, GtkJunctionSides junction) { GtkBorderImage border_image; double border_width[4]; border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100); border_width[1] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100); border_width[2] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100); border_width[3] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100); if (gtk_border_image_init (&border_image, style)) { gtk_border_image_render (&border_image, border_width, cr, x, y, width, height); } else { GtkBorderStyle border_style[4]; GtkRoundedBox border_box; GdkRGBA colors[4]; /* Optimize the most common case of "This widget has no border" */ if (border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0) return; border_style[0] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_STYLE)); border_style[1] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE)); border_style[2] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE)); border_style[3] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE)); hide_border_sides (border_width, border_style, hidden_side); colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)); colors[1] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR)); colors[2] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR)); colors[3] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR)); _gtk_rounded_box_init_rect (&border_box, x, y, width, height); _gtk_rounded_box_apply_border_radius_for_style (&border_box, style, junction); render_border (cr, &border_box, border_width, hidden_side, colors, border_style); } }
void ui::menu::render() { if(visible) { render_shape(); render_border(); for(auto i:items) i->render(); subtitle.render(); title.render(); } }
void Button::render() const{ if(!is_visible()) return; ColorRGBAf color = get_background_color(); float x = get_x(); float y = get_y(); float w = get_width(); float h = get_height(); UIManager::get().render_box(x, y, w, h, color); //Draw outline if needed if(m_render_border){ render_border(); } }
void render_block(int x, int y, int number) { char str[5]; char border; int i, j; if(number) { border = borders[(log_base2(number)-1) % numborders]; sprintf(str, "%d", number); i = x+2; j = y+2; write_str(i, j, str); } else { border = '.'; } render_border(x, y, border); }
void gtk_css_style_render_outline (GtkCssStyle *style, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { GtkBorderStyle border_style[4]; GtkRoundedBox border_box; double border_width[4]; GdkRGBA colors[4]; border_style[0] = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_STYLE)); if (border_style[0] != GTK_BORDER_STYLE_NONE) { int offset; border_style[1] = border_style[2] = border_style[3] = border_style[0]; border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100); border_width[3] = border_width[2] = border_width[1] = border_width[0]; colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_COLOR)); colors[3] = colors[2] = colors[1] = colors[0]; offset = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_OFFSET), 100); _gtk_rounded_box_init_rect (&border_box, x, y, width, height); _gtk_rounded_box_shrink (&border_box, - border_width[GTK_CSS_TOP] - offset, - border_width[GTK_CSS_RIGHT] - offset, - border_width[GTK_CSS_LEFT] - offset, - border_width[GTK_CSS_BOTTOM] - offset); _gtk_rounded_box_apply_outline_radius_for_style (&border_box, style, GTK_JUNCTION_NONE); render_border (cr, &border_box, border_width, 0, colors, border_style); } }
void _gtk_9slice_render (Gtk9Slice *slice, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { int img_width, img_height; cairo_surface_t *surface; cairo_save (cr); /* Top side */ surface = slice->surfaces[BORDER_MIDDLE][BORDER_TOP]; img_height = cairo_image_surface_get_height (surface); render_border (cr, surface, SIDE_TOP, x + slice->distances[SIDE_LEFT], y, width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT], (gdouble) img_height, slice->modifiers[SIDE_TOP]); /* Bottom side */ surface = slice->surfaces[BORDER_MIDDLE][BORDER_BOTTOM]; img_height = cairo_image_surface_get_height (surface); render_border (cr, surface, SIDE_BOTTOM, x + slice->distances[SIDE_LEFT], y + height - img_height, width - slice->distances[SIDE_LEFT] - slice->distances[SIDE_RIGHT], (gdouble) img_height, slice->modifiers[SIDE_BOTTOM]); /* Left side */ surface = slice->surfaces[BORDER_LEFT][BORDER_MIDDLE]; img_width = cairo_image_surface_get_width (surface); render_border (cr, surface, SIDE_LEFT, x, y + slice->distances[SIDE_TOP], (gdouble) img_width, height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM], slice->modifiers[SIDE_LEFT]); /* Right side */ surface = slice->surfaces[BORDER_RIGHT][BORDER_MIDDLE]; img_width = cairo_image_surface_get_width (surface); render_border (cr, surface, SIDE_RIGHT, x + width - img_width, y + slice->distances[SIDE_TOP], (gdouble) img_width, height - slice->distances[SIDE_TOP] - slice->distances[SIDE_BOTTOM], slice->modifiers[SIDE_RIGHT]); /* Top/Left corner */ surface = slice->surfaces[BORDER_LEFT][BORDER_TOP]; img_width = cairo_image_surface_get_width (surface); img_height = cairo_image_surface_get_height (surface); render_corner (cr, surface, x, y, (gdouble) img_width, (gdouble) img_height); /* Top/right corner */ surface = slice->surfaces[BORDER_RIGHT][BORDER_TOP]; img_width = cairo_image_surface_get_width (surface); img_height = cairo_image_surface_get_height (surface); render_corner (cr, surface, x + width - img_width, y, (gdouble) img_width, (gdouble) img_height); /* Bottom/left corner */ surface = slice->surfaces[BORDER_LEFT][BORDER_BOTTOM]; img_width = cairo_image_surface_get_width (surface); img_height = cairo_image_surface_get_height (surface); render_corner (cr, surface, x, y + height - img_height, (gdouble) img_width, (gdouble) img_height); /* Bottom/right corner */ surface = slice->surfaces[BORDER_RIGHT][BORDER_BOTTOM]; img_width = cairo_image_surface_get_width (surface); img_height = cairo_image_surface_get_height (surface); render_corner (cr, surface, x + width - img_width, y + height - img_height, (gdouble) img_width, (gdouble) img_height); cairo_restore (cr); }
void render_borders(int ring, ws2811_led_t color, Buffer* buffer) { for(int border=0; border<6; border++) { render_border(border, ring, color, buffer); } }