/* x,y,width,height describes a rectangle in the gl render buffer coordinatespace,anditstopleftcornerisdrawnatthecurrent
position according to the cairo translation. */
/** *gdk_cairo_draw_from_gl: *@cr:acairocontext *@surface:Thesurfacewe'rerenderingfor(notnecessarilyinto) *@source:TheGLIDofthesourcebuffer *@source_type:Thetypeofthe@source *@buffer_scale:Thescale-factorthatthe@sourcebufferisallocatedfor *@x:Thesourcexpositionin@sourcetostartcopyingfrominGLcoordinates *@y:Thesourceypositionin@sourcetostartcopyingfrominGLcoordinates *@width:Thewidthoftheregiontodraw *@height:Theheightoftheregiontodraw * *DrawsGLcontentontoacairocontext. * *IttakesarenderbufferID(@source_type==GL_RENDERBUFFER)oratexture *id(@source_type==GL_TEXTURE)anddrawsitonto@crwithanOVERoperation, *respectingthecurrentclip.Thetopleftcorneroftherectanglespecified *by@x,@y,@widthand@heightwillbedrawnatthecurrent(0,0)positionof *the`cairo_t`. * *Thiswillworkfor*all*`cairo_t`,aslongas@surfaceisrealized,butthe *fallbackimplementationthatreadsbackthepixelsfromthebuffermaybe *usedinthegeneralcase.Inthecaseofdirectdrawingtoasurfacewith *nospecialeffectsappliedto@critwillhoweveruseamoreefficient *approach. * *ForGL_RENDERBUFFERthecodewillalwaysfallbacktosoftwareforbuffers *withalphacomponents,somakesureyouuseGL_TEXTUREifusingalpha. * *CallingthismaychangethecurrentGLcontext. * *Deprecated:4.6:Thefunctionisoverlycomplexandproducesbrokenoutput *invariouscombinationsofarguments.IfyouwanttodrawwithGLtextures *inGTK,use[ctor@Gdk.GLTexture.new];ifyouwanttousethattexturein *Cairo,use[method@Gdk.Texture.download]todownloadthedataintoaCairo *imagesurface.
*/ void
gdk_cairo_draw_from_gl (cairo_t *cr,
GdkSurface *surface, int source, int source_type, int buffer_scale, int x, int y, int width, int height)
{
GdkGLContext *paint_context;
cairo_surface_t *image;
guint framebuffer; int alpha_size = 0;
gboolean es_use_bgra = FALSE;
paint_context = gdk_surface_get_paint_gl_context (surface, NULL); if (paint_context == NULL)
{
g_warning ("gdk_cairo_draw_gl_render_buffer failed - no paint context"); return;
}
if (source_type == GL_RENDERBUFFER)
{ /* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, source);
} else
{
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, source, 0);
}
/* The implicit format conversion is going to make this path slower */ if (!gdk_gl_context_get_use_es (paint_context))
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
cairo_image_surface_get_data (image)); else
glReadPixels (x, y, width, height, es_use_bgra ? GL_BGRA : GL_RGBA, GL_UNSIGNED_BYTE,
cairo_image_surface_get_data (image));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.