These are chat archives for jheinen/GR.jl

Jun 2016
Josef Heinen
Jun 29 2016 06:26

This is an example, how to set the window size to w x h (in pixels):

   mwidth, mheight, width, height = GR.inqdspsize()
   if w > h
        ratio = float(h) / w
        msize = mwidth * w / width
        GR.setwsviewport(0, msize, 0, msize * ratio)
        GR.setwswindow(0, 1, 0, ratio)
        ratio = float(w) / h
        msize = mheight * h / height
        GR.setwsviewport(0, msize * ratio, 0, msize)
        GR.setwswindow(0, ratio, 0, 1)

The normalized viewport, you can use, is give by the arguments to the setwswindow() function.

Jun 29 2016 08:29
Big thanks! I will try this...
Jun 29 2016 11:29
And one more small question. Does gr framework has something like getPixel(x, y) : color-index ?
Josef Heinen
Jun 29 2016 13:44
There is no function to obtain a pixel value from GR's graphics core (yet). But if you are using GR in a GUI environment (Qt, wxWidgets, Gtk), you can inquire pixels (from the widget's pixmap) using functions provided by the GUI's API to get RGBA values ...
Jun 29 2016 14:07
I had similar problems with another canvas. I solved it by saving entire area into the image and analizing this image in a memory. Can i save OpenGL based canvas into the image file?