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

World: r3wp

[AGG] to discus new Rebol/View with AGG

shadwolf
5-Dec-2005
[664]
stylize/master [
	rte: box with [
		color: gray 
	    tampon: ""
	    buffer: []
	    line-index: 0
	    char-sz: none
	  	current-text-offset: 0x0
	  	cursor-text-offset: 0x0
	  	max-text-offset: 0x0
	  	text-color: black
	  	pane: []
	  	
	  	set-font-style: func [ font-s [word!]] [
	  		switch font-s [

      bold [insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset] [as-pair 0 
      (line-index * 20)]) "" ]]]

      normal [insert tail buffer compose/deep [[ [size: 11 style: []] ( 
      either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 (line-index 
      * 20)]) "" ]]]

      underline[insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 
      (line-index * 20)]) "" ]]]

      italic [insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 
      (line-index * 20)]) "" ]]]
	  		]
	  	]
	  	
		feel: make feel [
			engage: func [f a e] [
				switch a [
				   
					key [ probe e/key
						switch/default e/key [
							#"^M" [
							line-index: line-index + 1

       f/current-text-offset: as-pair 0 f/current-text-offset/y + 20]

       insert tail f/buffer compose/deep [[ [size: 11 style: [(font-s)]](as-pair 
       0 (line-index * 20)) "" ]]
							
						][
							f/tampon: rejoin [f/tampon to-string e/key]
							draw-text: []
							print "f/buffer:"
							probe f/buffer
							foreach line-to-draw f/buffer [
								print "line-to-draw"
							;line-to-draw: f/buffer/1
								;probe line-to-draw
							;set [font-style start-offset text-to-show ] line-to-draw
							
								font-style: line-to-draw/1
								start-offset: line-to-draw/2
								line-to-draw/3: rejoin [line-to-draw/3 to-string e/key]
							;probe font-style 
							;probe start-offset
							
								font-obj: make face/font font-style
							;probe font-obj 
								text-to-show: line-to-draw/3
								;probe text-to-show

         insert tail draw-text  compose [ font (font-obj) pen (f/text-color) 
         text (start-offset) (text-to-show)]
							] 
							;print "draw-text:"
							;probe draw-text
							

       ;draw-text: compose [ pen (f/text-color) text (f/current-text-offset) 
       (f/tampon)]
				    		f/effect: make effect reduce [ 'draw draw-text  ]
				    		draw-text: none 
				    		;probe f/current-text-offset

       f/cursor-text-offset: as-pair (f/cursor-text-offset/x + 9) f/current-text-offset/y 
				    		;show f
						]
						f/pane/1/offset: f/cursor-text-offset 
						show f
					]
					down [
						;insert f/buffer compose [(as-pair 0 (line-index * 20)) ""]
						focus f show f
					]
					
				]
			]
		]
		append init [

   insert buffer compose/deep [[[size: 11 style: []] (as-pair 0 (line-index 
   * 20)) ""]]
			probe buffer

   insert pane make face [ color: red size: 2x20 offset: cursor-text-offset 
    ]
			show self 
		]
	]
]


view layout [
  across
  	btn "bold" [test-rte/set-font-style 'bold]
  	btn "underline" [test-rte/set-font-style 'underline]
  	btn "italic" [test-rte/set-font-style 'italic]
  	btn "normal" [test-rte/set-font-style 'normal]
  return
  	test-rte: rte 300x300
]
Henrik
5-Dec-2005
[665]
shadwolf, well, it's a start :-)
shadwolf
5-Dec-2005
[666x4]
i will be really glad if  some AGG guru could have a look on this 
script and modify enhace it and maybe make a tiny lib  ^^
what we need for text  to begin is bold/italic/underline/normal/color 
 If you have 10 more minutes to pend on it  images  would be a plus 
 ^^
Henrik yes ... hum i guess you  didn't see this script runing lol 
it looks like I was drunk when i wrote that  lol
my main idea was to use draw and use a cursor /input output similator 
but i'm not really a specialist in that kind of motion
ICarii
5-Dec-2005
[670]
hiya shadwolf.. also working on something similar in the past.  Never 
finished it though an alpha for flounder is still on the website.
shadwolf
5-Dec-2005
[671x2]
As  all of us i use premade stuff included in over priced C libraries 
 for "prfessionnel"
icarii can you past url of this project here this will allow ppl 
to compare / merge technics ...
ICarii
5-Dec-2005
[673x2]
http://rebol.mustard.co.nz/projects.htm
I'm intending to move flounder to AGG when i get a spare moment
shadwolf
5-Dec-2005
[675]
by extension i was planing this to be once a short and full working 
solution will be found to insert it to RebGUI as a basic widget  
of this set  ^^
ICarii
5-Dec-2005
[676x2]
uses draw at present but not many differences
nice idea for widget
shadwolf
5-Dec-2005
[678]
but u know ... hen u are drunk  you have full ideas then the next 
morning on wake up you read back the code and  "Hoooooooo damn ... 
was is this ?? i made it  ?? no serrious that can be ... What does 
all those lines are supposed to do  ???"
ICarii
5-Dec-2005
[679]
hehe
shadwolf
5-Dec-2005
[680]
Shadwolf -> Drunk Coder .....  hum not all the  time but this time 
yes  ..
Graham
5-Dec-2005
[681]
Hey Shadwolf ... don't miss Ashley's message to you in RebGUI channel!
shadwolf
5-Dec-2005
[682x6]
done  ^^
but then i have a abnormal bug witch means nothing ...
how can a widget in external context mode works better than a widget 
internal context mode
having the same strict code lol
Founder-a4 with rebol/view 1.3 ** Script Error: Invalid argument: 
+
** Where: view
** Near: show scr-face
if new [do-events]
>>
i have looked long time ago at rebconsole code ... but without understanding 
it mutch ...
ICarii
6-Dec-2005
[688]
that's probably because the script was written for view 1.2.48 i 
think
Rebolek
6-Dec-2005
[689]
Are the AGG bugfixes part of View 1.3.2 ?
Pekr
6-Dec-2005
[690]
what was particularly fixed in agg? can svg work continue?
shadwolf
7-Dec-2005
[691x2]
Svg  works need a dubeged matrix  -> scaling problem  and  gradients 
that feet ratio  information and   not  fixed area  ^^ those things 
can be script coded but this will complicate the SCV rendering engine 
and makes it slower for nothing ...
SVC = SVG
Pekr
7-Dec-2005
[693x3]
Those are exactly the questions/request, which I would expect to 
be answered by RT
iirc Cyphre said some fixes will be mady ... such features are not 
fixes though, so we can only hope ...
shadwolf - have you put your request into rambo?
Cyphre
9-Dec-2005
[696x2]
Shadwolf: the matrix problem you had should be fixed in DRAW 1.3.2. 
The gradient ratio parameters will be added probably in the next 
release.
I'll post resume of AGG fixes/improvement very soon in this group 
so you are informed.
Josh
15-Dec-2005
[698x4]
I'm trying to isolate a possible bug having to do with 'line-pattern 
.  I don't think using a negative number should cause rebol to lock 
up the CPU
Submitting to RAMBO
(Warning, this will lock up whatever instance of rebol you are running 
it in)

sp: 0
b: layout [
    c: box 400x400 white effect [
		draw [
			'pen 255.23.23 23.255.23 
			'line-pattern 1 sp
			'curve 50x350 200x50 350x350 200x300
		]
	]
	button "boom" [sp: sp - 1 show c]
]
view b
I don't know why someone would use a negative number, but this shouldn't 
happen if they do
Geomol
15-Dec-2005
[702]
May be a hard thing to check for without hitting performance too 
much, because of the late binding in REBOL. I can live with it.
Carl
15-Dec-2005
[703x2]
Good one Josh. Keep them coming.
BTW, I've got a solution to the late-binding issue. I plan to write 
a blog about it soon.
Izkata
15-Dec-2005
[705]
On View 1.3.1, it didn't lock up for me..
Josh
15-Dec-2005
[706x3]
I'm using REBOL/View 1.3.2.3.1 5-Dec-2005 Core 2.6.3
I thought I submitted a RAMBO ticket earlier for it, but now I can't 
find it
Ah, nm, found it
shadwolf
28-Dec-2005
[709x2]
josh hum does it work with sp: -2 ? ( joking lol ) Cyphre thank you 
very mutch  and carl too for your hard work i'm a little far those 
last month from rebol ... but  i still have lot of  wants i will 
restart to work on the SVG rederer once all will be set /fixe if 
you have suggestions  about the svg engine make them to me i ill 
try to  add them too. ( a less 1000 lines SVG engines this will be 
very nice and flexible ...)
josh negative size for a line .... the issue no one would imagine. 
 lol but a good debug  lol this kind of issue can be really annoying 
for an miss parsing of the SVG data content for example -> crash 
so you  stend lot of hours trying to see if the crash comme from 
your SVG renderer engine from the SVG file or from rebol or from 
the engine or rebol/view VM ^^ you are right a message comming fromt 
the VM like "Error the size entrer for the lline is negative  " isntead 
of the vm crash would be nice  ^^
Rebolek
29-Dec-2005
[711]
9-Dec 9:53 Cyphre "I'll post resume of AGG fixes/improvement very 
soon in this group so you are informed." Please, Cyphre, can you 
post it before competition's dead line so everyone can made use of 
it? :)
Cyphre
30-Dec-2005
[712]
Ok, so here it is:

-fixed image keying bug (swapped color components in keying tuple!)
-line width is now now changing according to scale

-fixed rendering of transformed images(now uses aplha premultiplied 
data)

-fixed LINE-PATTERN bug (multiple line patterns in DRAW block should 
work properly now)

-fixed MATRIX bug(wrong matrix calcualtion was corrected in this 
case)

-fixed SKEW command inconsistency (now it takes degrees as arguments 
instead of radians)

-fixed FILL-PEN bug when filling images (now it doesn't render images 
upside down)

-fixed ANTI-ALIAS cmd(now it is possible to switch this mode within 
one DRAW block)

-removed POP command (was obsolete, PUSH with block! arg is used 
instead)
-fixed fill/outline pixel aligning problem
-fixed visual bug when rendering circle with line-width > 1
-fixed text character encoding problem
-improved gradients: added REFLECT and REPEAT modes, example:
view layout [
	origin 0
	box 400x460 effect [
		draw [
			pen none
			fill-pen linear 10x10 0 190 0 1 1 black red green blue black
			box 10x10 390x90

   fill-pen linear 10x160 0 190 0 1 1 black red green blue black repeat
			box 10x100 390x180

   fill-pen linear 10x310 0 190 0 1 1 black red green blue black reflect
			box 10x190 390x270
			fill-pen radial 80x350 0 20 0 1 1 black red green blue black
			circle 80x350 70

   fill-pen radial 190x350 0 20 0 1 1 black red green blue black repeat
			circle 190x350 70

   fill-pen radial 320x350 0 20 0 1 1 black red green blue black reflect
			circle 320x350 70
		]
	]
]
Pekr
30-Dec-2005
[713]
would make it for nice blog entry :-)