r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

Henrik
30-Aug-2005
[2384]
(and post it here again!)
Geomol
30-Aug-2005
[2385x4]
AGG used in the draw dialect is very good at anti-aliasing. But then 
some (maybe) unexpected results occur, when anti-alias is turned 
off:
view layout [i: image black effect [draw [anti-alias off circle 50x50 
20 line 20x20 80x20 20x80 20x20]] image (i/size * 5) (to-image i)]
It's interesting, that a translate 0.5 0.5 will give a more 'even' 
result:
view layout [i: image black effect [draw [translate 0.5 0.5 anti-alias 
off circle 50x50 20 line 20x20 80x20 20x80 20x20]] image (i/size 
* 5) (to-image i)]
Anton
31-Aug-2005
[2389]
Yes, normally you think of a pixel offset (say, 0x0) is at the centre 
of the pixel. But it's not, it's at the top left of the pixel. If 
you zoom in, logically 0x0 should be at the top left of the square 
that represents the zoomed-in pixel.
Geomol
31-Aug-2005
[2390x6]
But shouldn't that be the case with end-points of lines too?
To illustrate it:
view layout [i: image black effect [draw [line-width 4 line-cap round 
pen white line 30x20 80x20 pen none fill-pen white circle 20x20 2 
pen white line 30x40 80x40 translate 0.5 0.5 pen none fill-pen white 
circle 20x40 2]] image (i/size * 5) (to-image i)]
Top looks wrong, bottom is correct (and need translate).
Even easier to see with a line-width of 2:
(Maybe I should report it to RAMBO? Is it a bug?)
view layout [i: image black effect [draw [line-width 2 line-cap round 
pen white line 30x20 80x20 pen none fill-pen white circle 20x20 1 
pen white line 30x40 80x40 translate 0.5 0.5 pen none fill-pen white 
circle 20x40 1]] image (i/size * 5) (to-image i)]
Anton
31-Aug-2005
[2396x2]
I agree, that seems to be an inconsistency. Cyphre is probably aware 
of it, but worth a bug report. If you have some time maybe compare 
with other commands, too.
It is arguable which one is wrong, though, the line or the circle.
Geomol
31-Aug-2005
[2398]
Bug report sent.


I'm spending the day making a DPaint kind of program in REBOL. Will 
release the work so far later today.
Rebolek
31-Aug-2005
[2399]
Geomol that's great! Will it support animation? ;)
Henrik
31-Aug-2005
[2400]
and animbrushes?
Geomol
31-Aug-2005
[2401x2]
One step at a time! :-)
My DPaint clone "Canvas" version 0.1. It's a few hours of work, around 
150 lines of code. Only REBOL makes it possible! :-) There's some 
way to a full DPaint clone, but it's a good start.


Instructions here: http://home.tiscali.dk/john.niclasen/canvas/canvas.html
Canvas here: http://home.tiscali.dk/john.niclasen/canvas/canvas.r
Henrik
31-Aug-2005
[2403]
great stuff! but drawing is a bit slow here. would it be an idea 
to limit mouse input to a certain amount per second?
Geomol
31-Aug-2005
[2404]
Yes, that could be a solution.
Is it also slow, if you turn anti-alias off? Hit 'a'!
Henrik
31-Aug-2005
[2405]
it seems to be about the same speed
james_nak
31-Aug-2005
[2406]
That's very cool G. Works really well on my PC.
Brock
31-Aug-2005
[2407]
Works well here as well, nice job.
Cyphre
31-Aug-2005
[2408]
Geomol: regarding AGG in ALIASED mode: I'm working on improvements 
in this mode so the graphic shoudl be 'pixel precise'.
Geomol
31-Aug-2005
[2409]
Good to know, Cyphre. And thanks guys! Preciate it. I hope, this 
'little' project will turn out well. I need a DPaint program to do 
the graphics for a phone-game, I'm involved in.
DideC
1-Sep-2005
[2410]
Geomol: impressive !!!
Geomol
1-Sep-2005
[2411x2]
:-) New version uploaded with guide-lines for rectangle, circle and 
so, and 2 new drawing tools, ellipse and filled ellipse.
There seem to be a small anomaly, when doing thick circles and ellipses, 
in the right side, where the circle/ellipse starts and ends. It may 
have something to do with "line-cap round", but if that is left out, 
there will be a tiny gap, when drawing really thick circles/ellipses.

Maybe Cyphre should check it out!?
Henrik
1-Sep-2005
[2413x2]
I changed BITMAP-SIZE to 1024x768 and as I suspected it really slows 
down now...
it could be a graphics driver problem, but I also tried it on my 
linux laptop and it's also very slow there.
Geomol
1-Sep-2005
[2415]
Henrik, it must be something special with your setup, and you get 
slow console output on the
do http://www.rebol.com/speed.r

speed-test, as we talked about. You could post your speed output 
here somewhere and specify your setup. Maybe others have a solution!
Henrik
1-Sep-2005
[2416x4]
Console:   0:00:16.274 - 31 KC/S
Processor: 0:00:00.631 - 1369 RHz (REBOL-Hertz)
Memory:    0:00:01.943 - 24 MB/S
Disk/File: 0:00:01.121 - 27 MB/S
I have an ATI Radeon 9500 graphics card with the latest Catalyst 
drivers and the test is run on a Celeron 2.6 Ghz PC with 640 MB of 
PC133 memory
adding a framerate limiter in your code helps nothing
but I've always had this problem that painting large surfaces in 
REBOL takes a long time on my machine and it doesn't really matter 
what drivers I use
Geomol
1-Sep-2005
[2420]
I get:
Console:   0:00:01.703 - 297 KC/S
Processor: 0:00:00.406 - 2128 RHz (REBOL-Hertz)
Memory:    0:00:01.344 - 35 MB/S
Disk/File: 0:00:00.203 - 150 MB/S

on a 2.4GHz Pentium 4, 512 MB ram (not sure about speed, it's an 
ASUS P4P800 board), ATi Radeon 9600, not the newest drivers.
Henrik
1-Sep-2005
[2421x3]
ok, I take back the part of the framerate limiter :-)
try this: http://hmkdesign.dk/rebol/canvas.r
ah... it's dangerous, because it misses events on my slow laptop 
now, but drawing is much speedier on my "broken" PC
Geomol
1-Sep-2005
[2424]
Well, it's a work-around, if you have slow graphics.
Henrik
1-Sep-2005
[2425]
I've put a limiter on SHOW so that it only shows every interval, 
but doesn't miss as many position samples. so even though the framerate 
appears slow, it's actually very responsive. it's SHOW that's the 
killer.
Geomol
1-Sep-2005
[2426]
Oki doki!
Henrik
1-Sep-2005
[2427]
sorry, it only shows every X interval... adjustable in the display-canvas 
function
Geomol
1-Sep-2005
[2428]
We have to see, when there is more stuff in the program, if I should 
put in such a mechanism.
Henrik
1-Sep-2005
[2429]
ok, looking forward to see some progress :-)
Geomol
1-Sep-2005
[2430]
:-) Just fixed a bug with line tool, if start and end point is the 
same. Well, that's progress! ;-P
Henrik
1-Sep-2005
[2431]
alright. :-) would it be hard to add straight X/Y line drawing with 
the shift key?
Geomol
1-Sep-2005
[2432x2]
:-D Didn't remember that before now. I'll check it on my Amiga...
Hmm the feel function "over" doesn't get an event, but engage do. 
Shift can be checked with event/shift.