Thread: Drawing single pixel (again...)
hi!
need draw single pixel(s) in gtk c application.
pixel values arrives during program runtime, can't drawn image or other predefined array.
use gdk_draw_point() before, , worked charm.
read on gnome.org
i turn cairo, drawing single pixels in not allowed, emulates drawing unity lines or rects. it, working incredibly slow: cairo_rectangle() @ least 10000 times slower gdk_draw_point(). unacceptable.warning
gdk_draw_point has been deprecated since version 2.22 , should not used in newly-written code. use cairo_rectangle() , cairo_fill() or cairo_move_to() , cairo_stroke() instead.
found function here (scroll example 1), unfortunately can't imagine how use it, i'm novice in c. search on web gdkpixbuf examples, found nothing.
q1: mentioned function not deprecated?
q2: there simple example exist anywhere how use function?
q3: other ways draw single pixels exist? (i mean not slow ones).
when draw first pixels in basic 20 yrs ago, newer can't imagine in 21th century becomes huge world-wide problem.
thank much!![]()
as far can tell gdk drawing functions deprecated since gtk+ 3.0 replaced cairo drawing functions.
if cairo_rectangle() slow maybe can draw image move_to(), line_to() , stroke() functions instead.
did test following image drawn using move_to() , line_to() , cairo draws fast (granted it's not complicated image)
i'm curious trying need light individual pixels?
drawing lines or polygons faster lighting pixels.
skip gtk+ altogether , use xlib directly draw pixels using xputpixel() function set pixel value in image ( of type ximage).
there c++ library creating png images called pngwriter will let set pixels on png image drawing surface, simple use , fast.
way use libpng directly yourself.
libpng official png library. it's platform independent , supports of png's features.
create image libpng create rectangular array represents image surface pixel colours written out png image, think fastest method if have lots of pixel data.
flk gui toolkit option let draw pixels. opengl option if have to.
suggest using xlib, pngwriter or libpng (libpng solution produce faster executable) if don't want use cairo.
see there quite few options you, , there others i'm not aware of.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Drawing single pixel (again...)
Ubuntu
Comments
Post a Comment