PyGTk - Drawing onto an Image - not using deprecated functions what is best method?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nick belshaw
    New Member
    • Dec 2010
    • 2

    #1

    PyGTk - Drawing onto an Image - not using deprecated functions what is best method?

    using PyGtk - no problems.
    I can draw onto an Image using a PixBuf, Drawable etc

    pixbuf = image.get_pixbu f()
    drawable = pixbuf.render_p ixmap_and_mask( )[0]
    drawable.draw_l ine(drawable.ne w_gc(),10,20,10 0,120)
    pixbuf.get_from _drawable(drawa ble,cmap,0,0,0, 0,100,120

    However...
    if I read about render_pixmap_a nd_mask I am told..
    "...a convenience method; applications that need to render pixbufs with dither offsets or to specific drawables should use the render_to_drawa ble_alpha() or render_to_drawa ble() methods..."

    and if I read about render_to_drawa ble I am told...
    "This method is deprecated in PyGTK 2.2 and above. Use the gtk.gdk.Drawabl e.draw_pixbuf() method instead."

    so do I presume I should not use "render_pixmap_ and_mask"?

    but I can not find any other way documented to do this?
    Trying to get it to work I just can not get a Drawable and a graphics_contex t to give me what I want and I keep going round in circles trying to make this work without using the apparently deprecated functions...

    I would be most grateful if someone could show me the best way to correctly handle this so I can draw on an Image.
    ...or is "render_pixmap_ and_mask" guaranteed for the future?

    thanks for any info - and Merry Christmas All

    nick
    Oxford
Working...