Re: Question about the GdkGC

Tom Liu wrote:

When I create a GdkGC, I have to give a GdkDrawable to attach this GC,
But when I draw line or rectangle, I still need the GdkDrawable as

You need to provide a GdkDrawable so that the GdkGC can reference a
colormap; the colormap is created when you create a GdkDrawable
and; if I'm not mistaken; thats because creating the colormap requires
some knowlage of the rendering architechture (Win or XFree86)
(and thats handled at the GdkDrawable level).

Is these because one GdkGC can work on multile GdkDrawable after it
Yes it can.

Another question: the CreateGC and releaseGC is a expensive job? Should
I create and release it every time I need to draw or just keep a global
copy for better performance.
A GdkGC is like a structure that holds a bunch of paramaters
to draw with when using any GdkDrawables; instead of passing
alot of arguments to the drawing functions; the arguments that
probably won't change from one function call to the next; are
stored in the graphics context.

Does that help ?


"Life would be so much easier if we could just look at the source code."
        -- Francois Baumier

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]