void Creeping:: init() { DEBUG_PRINT_LINE; deinit(); font_render = new FontRender(conf.get_conf()); std::vector<std::string> text; std::string logo; MessageReader mr; mr.make(conf.get_conf()->lineText, conf.get_conf()->bRss, &text, &logo); std::vector<std::string>::iterator i; for (i = text.begin(); i != text.end(); i++) { CSurface * surf = new_surface(wnd); surf->set_tex_color(conf.get_conf()->window.clForeground); surf->set_text( &(*i), font_render); } if(!logo.empty()) { CSurface * surf = new_surface(wnd); surf->set_image(&logo); surf->as_logo(); } DEBUG_PRINT_LINE; }
// This function initializes our background. It should be called once in // the beginning of the program void initialize_background(void){ // First we load the file "texture.png" located in the directory "images" surface *texture = new_image("texture.png"); // Next we allocate space for our background. It'll have the same // width than the screen. But how the first 100 lines of the screen // will be occupied by the scores, it'll have a height 100 pixels // smaller. background = new_surface(window_width, window_height - 100); // Now we apply the texture to our bigger surface. apply_texture(texture, background); // Done. Now we don't need the texture anymore. We destroy the surface // that stores the texture. destroy_surface(texture); }
static inline void allocator_configure_surface_info (GstVaapiDisplay * display, GstVaapiVideoAllocator * allocator) { const GstVideoInfo *vinfo; GstVaapiSurface *surface = NULL; GstVaapiImage *image = NULL; gboolean updated; GstVideoFormat fmt; vinfo = &allocator->video_info; fmt = gst_vaapi_video_format_get_best_native (GST_VIDEO_INFO_FORMAT (vinfo)); gst_video_info_set_format (&allocator->surface_info, fmt, GST_VIDEO_INFO_WIDTH (vinfo), GST_VIDEO_INFO_HEIGHT (vinfo)); /* nothing to configure */ if (USE_NATIVE_FORMATS || GST_VIDEO_INFO_FORMAT (vinfo) == GST_VIDEO_FORMAT_ENCODED) return; surface = new_surface (display, vinfo); if (!surface) goto bail; image = gst_vaapi_surface_derive_image (surface); if (!image) goto bail; if (!gst_vaapi_image_map (image)) goto bail; updated = gst_video_info_update_from_image (&allocator->surface_info, image); allocator->has_direct_rendering = !USE_NATIVE_FORMATS && updated && (GST_VAAPI_IMAGE_FORMAT (image) == GST_VIDEO_INFO_FORMAT (vinfo)); GST_INFO ("has direct-rendering for %s surfaces: %s", GST_VIDEO_INFO_FORMAT_STRING (&allocator->surface_info), allocator->has_direct_rendering ? "yes" : "no"); gst_vaapi_image_unmap (image); bail: if (surface) gst_vaapi_object_unref (surface); if (image) gst_vaapi_object_unref (image); }
void onDraw(SkCanvas* canvas) override { SkAutoTUnref<SkSurface> surface(new_surface(SMALL_W, SMALL_H)); canvas->scale(ZOOM, ZOOM); SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(SK_Scalar1); for (int i = 0; i < REPEAT_LOOP; ++i) { SkPath line, path; line.moveTo(1, 2); line.lineTo(SkIntToScalar(4 + i), 1); paint.getFillPath(line, &path); draw_fatpath(canvas, surface, path); canvas->translate(0, SMALL_H); } }
void add_frame() { frames.push_back(new_surface()); }