World: r3wp
[View] discuss view related issues
older newer | first last |
Gabriele 30-Aug-2005 [2362] | a dot? view layout [box 50x50 effect [draw [pen none fill-pen white box 25x25 26x26]]] |
Geomol 30-Aug-2005 [2363] | A single dot is not a problem. I would like line-width to take effect. Thanks for the input, but these are all work-arounds. I think, we need a dot command in draw. I've started work on a DeLuxe Paint like paint program. Lines, boxes, circles and so works ok, but if the user just make a dot, I have a problem. It should work with line-width > 1 too. |
Gabriele 30-Aug-2005 [2364x2] | what is a dot with line-width > 1 like? |
i guess, you just want a filled circle? | |
Geomol 30-Aug-2005 [2366x2] | yes |
But I want it to be pixel-correct, so if I extend that dot (filled circle) to a line, it should look correct. | |
Gabriele 30-Aug-2005 [2368x2] | AGG is sub-pixel correct ;) |
view layout [box 400x400 white effect [draw [pen black line-width 10 line-cap round line 30x30 300x30 line 50x100 70x100 translate 0.5 0.5 pen none fill-pen black circle 30x100 5]]] | |
Geomol 30-Aug-2005 [2370x6] | That might be a good way to do it. Let's see... |
view layout [i: image black effect [draw [pen white line-width 10 line-cap round line 20x 20 80x20 line 40x40 70x40 line-width 3 line 30x60 80x60 line-width 1 line 25x80 80x80 transl ate 0.5 0.5 pen none fill-pen white circle 20x40 5 circle 20x60 1.5 circle 20x80 0.5]] image (i/size * 5) (to-image i)] | |
Yes, looking good. Just a bit irritating with the need of translate. A dot command at the same position as the start of a line would be desireable. | |
I hope, I make sense! :-D | |
Sorry, linebreaks. | |
view layout [i: image black effect [draw [pen white line-width 10 line-cap round line 20x20 80x20 line 40x40 70x40 line-width 3 line 30x60 80x60 line-width 1 line 25x80 80x80 translate 0.5 0.5 pen none fill-pen white circle 20x40 5 circle 20x60 1.5 circle 20x80 0.5]] image (i/size * 5) (to-image i)] | |
james_nak 30-Aug-2005 [2376] | Very nice. Looks like dpaint. |
Henrik 30-Aug-2005 [2377] | Generic newbie-like question: I was spying on source request-dir and am baffled as to how it works? There are many function names, I can't seem to access directly, such as F-LIST and DIROUT. Where do they come from? request-dir: func [ "Requests a directory using a popup list." /title "Change heading on request." title-line /dir "Set starting directory" where [file!] /keep "Keep previous directory path" /offset xy ][ if block? dirout [ dirout: layout dirout max-dirs: to-integer f-list/size/y - 4 / f-txt/size/y center-face dirout ] set-face f-title any [title-line "Select a directory:"] if not all [keep path] [ path: copy either where [clean-path where] [what-dir] ] if all [not empty? path slash = last path] [remove back tail path] last-path: path result: none show-dir either offset [inform/offset dirout xy] [inform dirout] result ] |
Pekr 30-Aug-2005 [2378] | ... as for request-dir - today I saw another native one dialog. Dunno programmers do have to produce one themselves or not. It was with mySQL installation procedure. I looked like typical Windows request-file requestor, but it had set filter to "directory". Could anyone check on that, please? I really do not like that inconsistency in rebol ... |
Chris 30-Aug-2005 [2379x2] | probe req-dir |
I imagine 'request-dir is bound to this context. | |
Henrik 30-Aug-2005 [2381x4] | thanks |
REBOL [ title: "Multi-File Search" author: "Henrik Mikael Kristensen" ] search-function: func [/local files results] [ results: copy [] status/color: red show status nof-files: length? files: read to-file get-face search-dir forall files [ if not dir? first files [ data: read/lines first files status/text: join "Searching: " first files set-face status-progress divide index? files nof-files show [status status-progress] forall data [ if found? find/any first data get-face search-string [ insert tail results reduce [first files index? data first data] ] ] ] ] status/color: gray results-list/data: results status/text: reform ["Results:" length? results "found"] show [results-list status] ] main: layout [ style header button 100x20 gray edge [size: 1x1] backdrop effect [gradient 0x1 200.200.200 180.180.180] across space 2 origin 8 label white gray 300x20 "Search Multiple Files" font [align: 'center size: 14] return search-string: field (as-pair 228 22) btn 70 "Search" [ if not empty? search-string/text [search-function] ] return search-dir: field (as-pair 228 22) btn 70 "Directory..." [set-face search-dir request-dir] return status: label white gray 300x20 "Results" font [align: 'center size: 14] return space 0x0 header "File" header 50 "Line" header 132 "Text" box gray 18x20 return results-list: text-list 300x200 data [] [print "test"] return status-progress: progress gray white 300x10 ] set-face search-dir %. inform center-face main | |
crude prototype, but it helped me find the file I had been looking for :-) I don't know how to do actual multi columns with the internal text-list. the plan was to allow scrolling (I can't get that working) and when you click on a search result, the file pops up in the viewtop editor. feel free to perfect it... | |
(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 [2411] | :-) New version uploaded with guide-lines for rectangle, circle and so, and 2 new drawing tools, ellipse and filled ellipse. |
older newer | first last |