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

World: r3wp

[View] discuss view related issues

Maxim
2-Nov-2006
[6001x6]
dark haloes are sometimes due to the contrast of actual pixels when 
two colors are placed side-by side.
consider this to be 2 pixels

[b g r]  [b g r]
if you had these two colors side by side 
(- meening that pixel channel is not lit):

[b - - ] [- - r]
then I guess you can understand that our eye will notice that large 
4 channel gap in between pixels.
the ordering of channels also means that these side-effects only 
occur in one direction:

if you placed  [ - - r]  [b - - ]  there would be no edge between 
red and blue (but will be from blue to next pixel)
MS's new font aliasing engine uses this technique to use sub channels 
so that edges actually hit pixel channels instead of complete pixels... 
 whic is why some letters look colored on edges... but when you see 
it, there is very nice increase in overall quality... its like increasing 
the resolution of your screen by a factor of 3 !
Louis
2-Nov-2006
[6007]
Maxim, thanks. I'll study that doc.
Gabriele
2-Nov-2006
[6008]
brock, why don't you just use an alpha channel?
Brock
2-Nov-2006
[6009x2]
I was able to get Anton's example to work in the scenario I had indicated 
above.  I'm open to looking into your suggestion, do you have an 
example that I can use.  I checked some of the rebol/view docs and 
the image datatype doc and don't see anything that guides me in the 
direction you are suggesting.
By the way Anton, thanks for your example, works well except for 
the fringing around the ani-aliased part of the image... still maintains 
some of the colour of the original background colour.
Gabriele
2-Nov-2006
[6011x3]
if i understand correctly, you need to use draw to produce a transparent 
image. is that correct?
so my question is, why do you need to make one color transparent, 
instead of using the alpha channel?
img: make image! 50x50
img/alpha: 255 ; make bg transparent
draw img [pen black line-width 2 circle 25x25 20]
save/png %test.png img
Maxim
2-Nov-2006
[6014]
he is not using draw. AFAIK
Brock
2-Nov-2006
[6015]
Maxim, yes, I'm using draw.
Maxim
2-Nov-2006
[6016]
doh... sorry.
Brock
2-Nov-2006
[6017]
I'm creating the image in a block, then using draw to display the 
final image.
Maxim
2-Nov-2006
[6018x3]
can you give us a real equivalent example?
there are many possible edge defects... seeing them will help us 
cure the booboo :-)
right now we're like swatting flies in the dark... with you having 
the infra red goggles and saying: 
LEFT ! LEFT! .. oh no  RIGHT! RIGHT
;-)
Brock
2-Nov-2006
[6021x6]
hilight-colour: 255.0.0 ;0.112.99	;request-color


font-style: make face/font [style: 'bold  name: "font-sans-serif" 
 size: 26]

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

view center-face out: layout [
	origin 0
	bx: box 23x23 50.50.50 effect [draw hilights effect []][ 
		file: request-file/only/save/file %hilight.png
		if not file [exit]
		if not find file ".png" [append file ".png"]
		save/png file to-image bx
		img: load file
		colour: pick img 1x1

  repeat i length? img [if colour = pick img i [poke img i 0.0.0.255]]
		save/png file img
	]
]
this is a stripped down version (this time one that works without 
error)
clicking on the image brings up the save requestor
Using Gabriel's method creates a clean image without the fringing....
hilight-colour: 255.0.0 ;0.112.99	;request-color


font-style: make face/font [style: 'bold  name: "font-sans-serif" 
 size: 26]

img: make image! 23x23
img/alpha: 255	;make bg transparent


draw img [
	transform 0 1 1 0x0 0x0
	fill-pen snow pen snow	;white circle
	circle 10x10 9
	fill-pen black pen black	;black circle
	circle 13x13 9
	fill-pen hilight-colour	;0.112.99
	pen hilight-colour	;serve dark green - 0.112.99
	circle 11x11 9
	fill-pen snow pen snow
	font font-style
	text 1 6x0 "*"
]

file: request-file/only/save/file %hilight.png
if not file [exit]
if not find file ".png" [append file ".png"]
save/png file img
Thanks all for your input/suggestions.
Anton
3-Nov-2006
[6027]
The "bulk-set alpha" method as shown by Gabriele should evaluate 
quite a lot faster, too.
Brock
3-Nov-2006
[6028]
I had problems with his version for resizine the image on the fly. 
 I didn't look at it very long.  I'm rethinking whether I need the 
resize feature as I will likely build a small GUI where are the parameters 
are set.
Graham
5-Nov-2006
[6029]
I have access to the F1 - F12 keys .. but what about the Alt-F1 - 
F12, or other modifiers?
Maxim
5-Nov-2006
[6030x4]
in the event you have alt/shift/ctrl members.	
event/shift  for example.
when set to true the modifier was pressed when you pressed the key.
combinations exist.
the Alt key is sometimes consumed by the OS, same for the Tab... 
I think someone mentionned that tab + shift is never sent to REBOL.
Graham
5-Nov-2006
[6034]
I have to see if rebgui allows me all of this ...
Louis
5-Nov-2006
[6035x2]
I'm looking for a script to allow communication between users on 
a lan. rim.r looks like it would work, but the cgi script that ties 
it together is missing. Does anyone have it?
Is something even better available?
Anton
6-Nov-2006
[6037x2]
There is only event/control and event/shift,   nothing to detect 
Alt key.
Tab and Shift+Tab  can be trapped by Rebol.  But Ctrl+Tab cannot 
be caught by Rebol because Windows consumes this key event before 
it is sent to the application window (eg. Rebol's window).
Maxim
6-Nov-2006
[6039]
wasn't there the Alt support in a prior version.  I am almost shure 
I used to support it in an old app of mine...
Anton
6-Nov-2006
[6040]
nope
Pekr
6-Nov-2006
[6041]
but it can be surelly overriden, or can't it?
Maxim
6-Nov-2006
[6042x3]
events are a datatype not objects, you cannot set any values in them.
which is why Anton reversed enginerred the do-face mechanism... but 
in any case, the events are generated by the internal REBOL HAL which 
accepts some (but not all) OS events and feeds the event port with 
them.
it has been a long standing request that more OS events been sent 
to scripts...
Pekr
6-Nov-2006
[6045x2]
and that was my point. It could accept even ctrl+tab, as that is 
trappable. But, I remember how Holger argued with me about cross-platform 
issues ....
as long as Cyphre is on View part of R3, I believe the situation 
will be corrected :-)
Maxim
6-Nov-2006
[6047x4]
ahh cross platform is a moot point for many of us. really... the 
fact that REBOL runs on all platforms is very good.
the fact that OUR apps run on all apps is not needed in many/most 
cases
especialy in corp env.  and in any case, we will adapt our apps to 
use any os features REBOL gives us :-)
that's the point for a user to use Apple or windows... why strip 
their power from them.?