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

World: r3wp

[View] discuss view related issues

Anton
24-Oct-2006
[5916]
I think I've seen weirdness with time events like that, but never 
got around to documenting the bug because it would have taken too 
long to describe it fully.
Maxim
24-Oct-2006
[5917]
where is the changes dialect documented? do you know?
Rebolek
24-Oct-2006
[5918]
AFAIK nowhere :/ Add 'offset to dialect words.
Anton
24-Oct-2006
[5919x2]
In my own little text file that I collected over the years. :)
Thanks Rebolek. I had written a face/changes: [offset] example somewhere... 
it's supposed to attempt hardware scrolling, if graphic card supports 
it.
Maxim
31-Oct-2006
[5921]
stupid question... can't we set the progress bar value directly within 
the dialect?

view layout [progress 0.3]

I find it a bit ugly to have to do this:

view layout [prg: progress do [prg/data: 0.3]]
Rebolek
31-Oct-2006
[5922]
>>  view layout [progress with [data: 0.3]]
Maxim
31-Oct-2006
[5923x2]
why didn't I think of that... I used the 'WITH block all the time...
but still the 'with block is the "hack" method.  I was surprised 
to notice that we still cannot reach the decimal value within the 
1.3.2 release... there is an error lingering since years in VID.
Rebolek
31-Oct-2006
[5925]
hehe :)
Maxim
31-Oct-2006
[5926x2]
the switch case, which reaches the face's multi object, has a decimal 
element, but its not of the proper type, so it never gets matched...
meaning, although it should be able to address a decimal function 
within the multi object, it never does cause the switch which should 
trigger the case, will never match.
Rebolek
31-Oct-2006
[5928]
that's strange
Maxim
31-Oct-2006
[5929x2]
I remember giving the solution to Carl... and he replying....   "Oops!" 
hehe
this might predate RAMBO... maybe the fix never got included in the 
release, or its there and my latest code is just not trying to use 
the proper function within the multi object...
Rebolek
31-Oct-2006
[5931]
so will you RAMBO it? 1.3.3 is right behind the door... ;))))
Maxim
31-Oct-2006
[5932x3]
I'll try to find where its going wrong...
just found it... its in the grow-facets VID func:


			pair!   [append pairs val]
			integer! [append pairs val]
			string! [append texts val]
			tuple!  [append colors val]
			block!  [append/only blocks val]
			file!   [append files val]
			url!    [append files val]
			image!  [append images val]
			char!   [new/keycode: val]
			logic!  [new/data: new/state: val]
			decimal! [new/data val]
			time!   [new/rate: val]

note how the decimal! type is not properly set!
I'll RAMBO it right away.
Rebolek
31-Oct-2006
[5935]
yes, nice :)
Maxim
31-Oct-2006
[5936]
done.
Brock
31-Oct-2006
[5937x2]
can anyone provide a very simplistic example of how you would set 
the background of a face to be transparent?  I've tried using a view 
face and by defining the face in vid with no luck.  I'd also like 
to be able to save the resultant face out to an image with the transparency 
maintained... is this also possible?
here's the program I am using this in...
Henrik
31-Oct-2006
[5939]
set color to none for the face
Brock
31-Oct-2006
[5940x2]
REBOL [
	Title: "REBOL Logo Maker"
	Purpose: "Generate a Hilight image"
	Author: ["Carl Sassenrath" "Gabriele Santilli"]
	Version: 1.0.0

 Rights: "REBOL logo is a registered trademark of REBOL Technologies, 
 USA."
]

debug?: false
hilight-colour: 255.0.0 ;0.112.99	;request-color
character: uppercase request-text
font-type: "font-sans-serif"
xthin-chars: charset "I!J"
thin-chars: charset "1234567890ABDEFPRSZ"
normal-chars: charset"CGHKLNOTUVXY"
wide-chars: charset "WMQ"
xwide-chars: charset ""
special-chars: charset "*"

if font-type = "font-serif"[
;get-char: func [character][

 if find character xthin-chars 	[if debug? [print "xthin"] char-offset: 
 8x2 char-size: 14]

 if find character thin-chars 	[if debug? [print "thin"] char-offset: 
 7x2 char-size: 14]

 if find character normal-chars	[if debug? [print "normal"] char-offset: 
 6x2 char-size: 14]

 if find character wide-chars	[if debug? [print "wide"] char-offset: 
 5x2 char-size: 14]

 if find character xwide-chars	[if debug? [print "xwide"] char-offset: 
 4x2 char-size: 14]

 if find character special-chars	[if debug? [print "special"] char-offset: 
 5x-2 char-size: 28]
;]
]
if font-type = "font-sans-serif"[
;get-char: func [character][

 if find character xthin-chars 	[if debug? [print "xthin"] char-offset: 
 9x2 char-size: 14]

 if find character thin-chars 	[if debug? [print "thin"] char-offset: 
 7x2 char-size: 14]

 if find character normal-chars	[if debug? [print "normal"] char-offset: 
 6x2 char-size: 14]

 if find character wide-chars	[if debug? [print "wide"] char-offset: 
 5x2 char-size: 14]

 if find character xwide-chars	[if debug? [print "xwide"] char-offset: 
 4x2 char-size: 14]

 if find character special-chars	[if debug? [print "special"] char-offset: 
 4x-2 char-size: 26]
;]
]



font-style: make face/font [style: 'bold  name: font-type  size: 
char-size]

hilights: [
	transform 0 1 1 0x0 0x0
	fill-pen snow pen snow
	circle 10x10 9
	fill-pen black pen black
	circle 13x13 9
	fill-pen hilight-colour	;0.112.99
	pen hilight-colour	;serve dark green - 0.112.99
	circle 11x11 9
	fill-pen white pen white
	font font-style
	text 1 char-offset character 
		;]
	;]
]



insert-event-func func [face evt][
	if evt/type = 'resize [
		bx/size: out/size: evt/offset
		bx/size/y: out/size/y: evt/offset/x / 23 * 23
		n: to-decimal bx/size/x / 23
		;t-x: to-decimal bx/size/x / 23 + 5
		;t-y: to-decimal bx/size/y / 23 - 2
;		probe highlights ;logo-shape
;		halt
		hilights/3: n
		hilights/4: n
		loc: to-pair :t-x :t-y
		show out
	]
	evt
]


view/options center-face out: layout [
	origin 0

 bx: box 23x23 green effect [draw hilights effect [key: green]][  
  ;logo-shape][	; 

  file: request-file/only/save/file join %hilight- [character ".png"]
		if not file [exit]
		if not find file ".png" [append file ".png"]
		save/png file to-image bx
	]
][resize]
this was Carl & Gabrielle's Rebol logo maker that I am repurposing.
Henrik
31-Oct-2006
[5942]
>> view layout [backdrop effect [gradient 0x1 black white] y: box 
"test"]
(escape)
>> y/color
== none
Brock
31-Oct-2006
[5943x2]
thanks Henrik, however, I still don't see any transparency saved.
view layout [
	bx: box "test" [
			file: request-file/only/save/file %sample.png
			if not file [exit]
			if not find file ".png" [append file ".png"]
			save/png file to-image bx
	]

]
Pekr
31-Oct-2006
[5945x3]
don't you need to use effect merge?
view layout [b1: box 100x100 red at b1/offset b2: box 50x50 green 
edge [size: 2x2 color: blue] effect [merge]]
uhm, sorry, that works too, while I thought it will not :-)

 view layout [b1: box 100x100 red at b1/offset b2: box 50x50  edge 
 [size: 2x2 color: blue] with [color: none]]
Henrik
31-Oct-2006
[5948]
effect merge is only used when merging DRAW results with the background, 
AFAIK
Pekr
31-Oct-2006
[5949x2]
not sure - there was some change between 2.1 and later View iirc, 
maybe merge was first needed, later it was not, or vice versa ...
ah, now I get it - if there is some effect involved, simply setting 
color to none would not work, it is needed to add merge to effect 
block ... it is well described in view-system doc
Brock
1-Nov-2006
[5951x8]
hmm, still unable to save out the transparent png file to maintain 
the transparent part in the png file.  I was able to produce an image 
with two coloured boxes and then one box was then made transparent, 
however when saving that image out, the background appears the default 
grey colour that is used when no colour is specified.
I'm missing something key here... can the background colour be made 
transparent?
view lay: layout[
	origin 0
	backdrop 255.0.0
	box green 30x30
	at 15x15 box blue 30x30 effect[merge]
]

save/png %sample.png to-image lay
presents an image with a red background, green box in upper left 
corner and the blue box is transparent in the lower right corner. 
 Save result shows red background image with green box.
adding effect [merge] to the backdrop now makes the backdrop transparent, 
however the save result shows the background in the default grey 
now instead of red.
removing the backdrop line altogether doesn't change the saved result 
from the step above.
adding   lay/color: none  after the definition of the layout block 
changes the saved result to now have a black background with the 
green box appearing inside in the top left corner.
changing the backdrop line to be   backdrop with [color: none]   
again saves out with the default grey background.
Rebolek
1-Nov-2006
[5959x2]
I;m not sure if PNG saver supports transparent color
Hm, seems I had different oppinion two years ago :) http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlHSHC
Cyphre
1-Nov-2006
[5961]
>> i: logo.gif
== make image! [100x24 #{
252525141414141414141414141414141414141414141414141414141414
14141414141414141414141414141414141414141414...
>> i/alpha: 128
== 128
>> save/png %test.png i
>>
Rebolek
1-Nov-2006
[5962]
Cyphre: This is is alpha channel, I think transparency means key 
color
Cyphre
1-Nov-2006
[5963x3]
IMO 'key color' is only alpha = 255 isn't it?
Maybe I don't know what exactly need?
what you exactly need