1. specific question about the code of EuGTK

-------------------------------------------------------------- 
-- the following graphic routines have to be implemented 
-- in a different manner from all other GTK stuff 
-------------------------------------------------------------- 
export function gdk_canvas(atom drawable) 
return peek4u(drawable+52) 
end function 
 
export function gdk_context(atom drawable) 
return peek4u(get(drawable,"style")+540) 
end function 

I am very curious about the use of these functions and specifically - what the number 52 and 540 represent.

My goal is to figure out how to copy a cairo image surface directly to the data/bitmap of a window control in GDK/GTK.

new topic     » topic index » view message » categorize

2. Re: specific question about the code of EuGTK

These are just offsets into the C structure where pointers to the items are found. Necessary to 'peek' into the structure because GTK did not provide accessor methods to get those, unlike most objects which do have accessor methods.

As for copying cairo graphics to the window - I'm not sure I can answer that; can you give more detail of exactly what you're trying to accomplish?

new topic     » goto parent     » topic index » view message » categorize

3. Re: specific question about the code of EuGTK

irv said...

These are just offsets into the C structure where pointers to the items are found. Necessary to 'peek' into the structure because GTK did not provide accessor methods to get those, unlike most objects which do have accessor methods.

As for copying cairo graphics to the window - I'm not sure I can answer that; can you give more detail of exactly what you're trying to accomplish?

-- drawin is a GTK container in this case 
object cairowin = get(drawin,"window") -- need the GDK window which is different from GTK window 
object GDK_cr = create(GdkCairo,cairowin) 
-- the cr is what is used to draw using Cairo 

Note that I do not need those offsets. It is a cleaner interface, and GTK has decided to replace GDK drawing with Cairo.

new topic     » goto parent     » topic index » view message » categorize

4. Re: specific question about the code of EuGTK

I used the old drawing routines because they work. I could never get Cairo to work. Perhaps you can add the necessary routines to do that?

new topic     » goto parent     » topic index » view message » categorize

5. Re: specific question about the code of EuGTK

for now I am using wxEuphoria for the simple reason that in that system, I start at the frame and then have a window under that. When I was using EuGTK, the top level is Window, and I had a container for my drawing area. But the drawing was coordinated with the top level Window. For example, a menu bar appears to float on top.

As far as Cairo is concerned, I have a C program which does the Cairo calls. As of now, I am drawing to an image surface, and setting that surface to the Cairo CR of the GDK window. Let me know if you would like to see that code.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu