void ExamplePath2:: draw_frame(void) { fastuidraw::vec2 translate, scale, window_dims(window_dimensions()); fastuidraw::PainterSurface::Viewport vwp(0, 0, window_dims.x(), window_dims.y()); float stroke_width, border; m_surface_gl->viewport(vwp); m_painter->begin(m_surface_gl, fastuidraw::Painter::y_increases_downwards); /* Set the translate and scale so that the path is stretched across * the entire window, but have some border around the path so that * all of the stroking is visible. */ stroke_width = 8.0f; border = 3.0f * stroke_width; scale = window_dims / (m_path_bounds.size() + fastuidraw::vec2(2.0f * border)); translate = -m_path_bounds.m_min_point + fastuidraw::vec2(border); m_painter->shear(scale.x(), scale.y()); m_painter->translate(translate); /* first fill the path with the color red, using the odd-even fill rule */ m_painter->fill_path(fastuidraw::PainterBrush() .color(1.0f, 0.0f, 0.0f, 1.0f), m_path, m_example_fill_rule); /* then stroke the path with transparent orange, applying a * - stroking width of 8.0 * - rounded joins * - rounded caps */ m_painter->stroke_path(fastuidraw::PainterBrush() .color(1.0f, 0.6f, 0.0f, 0.8f), fastuidraw::PainterStrokeParams() .width(stroke_width), m_path, fastuidraw::StrokingStyle() .join_style(fastuidraw::Painter::rounded_joins) .cap_style(fastuidraw::Painter::rounded_caps)); m_painter->end(); fastuidraw_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); fastuidraw_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); m_surface_gl->blit_surface(GL_NEAREST); }
LVAL xswindow_frame_size(V) { return(window_dimensions('S', TRUE)); }
LVAL xswindow_size(V) { return(window_dimensions('S', FALSE)); }
LVAL xswindow_frame_location(V) { return(window_dimensions('L', TRUE)); }
LVAL xswindow_location(V) { return(window_dimensions('L', FALSE)); }