void View::render() { clearSurface(screenSurface); clearSurface(overlaySurface); renderBorder(); renderOverlay(); renderMerged(); SDL_Flip(screenSurface); }
void label_t::paint() { clearSurface(); auto cr = graphics.getContext(); auto bounds = getBounds(); cairo_set_source_rgb(cr, 0, 0, 0); int textLeft; int textBot = (bounds.height / 2 - lastExtents.height / 2) + lastExtents.height; if (alignment == g_text_alignment::CENTER) { textLeft = bounds.width / 2 - lastExtents.width / 2; } else if (alignment == g_text_alignment::RIGHT) { textLeft = bounds.width - lastExtents.width; } else { textLeft = 0; } cairo_move_to(cr, textLeft, textBot); cairo_set_font_face(cr, font->getFace()); cairo_set_font_size(cr, fontSize); cairo_show_text(cr, text.c_str()); }
void CAR::clear() { for(int i=dp->AR_XSTART;i<dp->AR_WIDTH+dp->AR_XSTART;i++) for(int j=dp->AR_YSTART;j<dp->AR_HEIGHT+dp->AR_YSTART;j++) setFirstPixel(i,j,ARbackgroundColor,AR_XSTART,AR_YSTART, AR_WIDTH,AR_HEIGHT); if(bSurface) { clearSurface(AR_YSTART,0,range); //clearSurface(AR_YSTART2,stR,edR); } }
void Button_t::paint() { cr = graphics.getContext(); clearSurface(); bounds = getBounds(); if (enabled) { if (shapeColor == ARGB(120, 211, 211, 211)) shapeColor = previous; if (state.focused) border = RGB(0, 200, 0); else border = RGB(180, 180, 180); } else { previous = shapeColor; shapeColor = ARGB(120, 211, 211, 211); } // prepare double x = 0.5; double y = 0.5; double width = bounds.width - 1; double height = bounds.height - 1; double radius = 2.5; double degrees = M_PI / 180.0; cairo_new_sub_path(cr); cairo_arc(cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees); cairo_arc(cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees); cairo_arc(cr, x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees); cairo_arc(cr, x + radius, y + radius, radius, 180 * degrees, 270 * degrees); cairo_close_path(cr); cairo_set_source_rgba(cr, ARGB_TO_CAIRO_PARAMS(shapeColor)); cairo_fill_preserve(cr); cairo_set_source_rgba(cr, ARGB_TO_CAIRO_PARAMS(border)); cairo_set_line_width(cr, 1); cairo_stroke(cr); if (pathToLoad) { pngSurface = graphics.getContext(); cairo_set_source_surface(pngSurface, png, pngPosition.x, pngPosition.y); cairo_paint(pngSurface); } }
void button_t::paint() { auto cr = graphics.getContext(); clearSurface(); auto bounds = getBounds(); // choose colors g_color_argb background; if (enabled) { background = state.pressed ? RGB(230, 230, 230) : (state.hovered ? RGB(255, 255, 255) : RGB(248, 248, 248)); } else { background = RGB(200, 200, 200); } g_color_argb border; if (enabled) { if (state.focused) { border = RGB(55, 155, 255); } else { border = RGB(180, 180, 180); } } else { border = RGB(160, 160, 160); } // prepare double x = 0.5; double y = 0.5; double width = bounds.width - 1; double height = bounds.height - 1; double radius = 2.5; double degrees = M_PI / 180.0; cairo_new_sub_path(cr); cairo_arc(cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees); cairo_arc(cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees); cairo_arc(cr, x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees); cairo_arc(cr, x + radius, y + radius, radius, 180 * degrees, 270 * degrees); cairo_close_path(cr); cairo_set_source_rgba(cr, G_COLOR_ARGB_TO_FPARAMS(background)); cairo_fill_preserve(cr); cairo_set_source_rgba(cr, G_COLOR_ARGB_TO_FPARAMS(border)); cairo_set_line_width(cr, 1); cairo_stroke(cr); }
void Label_t::paint() { clearSurface(); cr = graphics.getContext(); bounds = getBounds(); cairo_set_source_rgba(cr, ARGB_TO_CAIRO_PARAMS(shapeColor)); int textLeft; int textBot = (bounds.height / 2 - lastExtents.height / 2) + lastExtents.height; if (alignment == TextAlignment::CENTER) textLeft = bounds.width / 2 - lastExtents.width / 2; else if (alignment == TextAlignment::RIGHT) textLeft = bounds.width - lastExtents.width; else textLeft = 0; cairo_move_to(cr, textLeft, textBot); cairo_set_font_face(cr, font->getFace()); cairo_set_font_size(cr, fontSize); cairo_show_text(cr, text.c_str()); }
meshOptimizer::~meshOptimizer() { clearSurface(); }