These are chat archives for jheinen/GR.jl

2nd
Jul 2016
DeadbraiN
@tmptrash
Jul 02 2016 21:07
I have tried code above and it works. Thank! The window size is correct. But i can't set world coordinates to the same size, like window has. Let's say, i need a window 400x300px. And if i call for example, fillrect(1, 400, 1, 300) it will not be within the window. I found, that on my resolution i have to add 7.5 to x and -10 to y. But why?
mwidth, mheight, width, height = GR.inqdspsize()
w = 400
h = 300
if w >= h
    ratio = float(h) / w
    msize = mwidth * w / width
    GR.setwsviewport(0, msize, 0, msize * ratio)
    GR.setwswindow(0, 1, 0, ratio)
else
    ratio = float(w) / h
    msize = mheight * h / height
    GR.setwsviewport(0, msize * ratio, 0, msize)
    GR.setwswindow(0, ratio, 0, 1)
end

setviewport(0, 1, 0, ratio)
#setwindow(1, w + 7.5, -10, h) # 1280 x 720
setwindow(1, w, 1, h)
#...
drawrect(1, w, 1, h) # draws incorrect rect