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

World: r3wp

[View] discuss view related issues

Pekr
10-Mar-2006
[4467]
http://big.faceless.org/products/graph/examples.jsp?initial=browsershare
Geomol
10-Mar-2006
[4468x3]
I see. The examples are in matplotlib syntax. And matplotlib is a 
python 2D plotting library. So, as you say, it's probably better 
to find the best plotting library (or make a new one), than making 
an implementation of matplotlib. It could be the best one around 
though.
I think, we have a problem with the way, AGG is implemented. E.g. 
arguments to LINE are pairs (like 100x100). To be able to make a 
smooth curve using LINE, the arguments have to be decimals. Try the 
following code to see:
img: make image! reduce [370x290 white]
blk: [pen blue line-width 0.7 line]

for t 0.0 2.0 0.01 [s: sine 360 * t append blk as-pair round t * 
185 round 290 - (s * 145 + 145)]
draw img blk
view layout [image img]
Rebolek
10-Mar-2006
[4471]
Yes, decimal support for pair!  I hope this comes in R3 (or sooner? 
;)
Oldes
10-Mar-2006
[4472x2]
Flash is using twips, which seems to be enough.
And not just Flash - http://www.applecore99.com/api/api012.asp
Rebolek
10-Mar-2006
[4474]
Twips are screen-independent units to ensure that the proportion 
of screen elements are the same on all display systems. A twip is 
defined as being 1/1440 of an inch.

This seems more complicated than decimal pair to me, because you 
need to recompute from twips to actual pixels, so you need to know 
screen resolution and size.
Anton
11-Mar-2006
[4475x3]
I think the ephemeral vector! datatype might have been using decimals.
Geomol, don't forget you can just use a higher resolution and scale 
it.
scale: 10
img: make image! reduce [370x290 white]

blk: compose [scale (1 / scale) (1 / scale) pen blue line-width 7 
line ]
for t 0.0 2.0 0.01 [
	s: sine 360 * t

 append blk as-pair round t * 185 * scale round 290 - (s * 145 + 145) 
 * scale
]
draw img blk
view layout [image img]
Oldes
11-Mar-2006
[4478x3]
That's the way how the twips works 1px = 20twips so 1.2px = 24twips 
- the scaling is done on the draw engine side so you don't need to 
scale it yourself. In my dialect i just have directive 'units twips' 
and then the interpreter know that 24x24 is equal to 1.2x.1.2  --- 
if I'm not using twips all values are multiplied by 20 and rounded 
- that's the way how it's in Flash and in my Rebol/Flash dialect
(in Flash internals - in actionscript there is not decimal pair datatype, 
what I know)
Anyway, if there will be the decimal pair datatype, I will be very 
lucky :-))
Anton
11-Mar-2006
[4481]
OK, so that would be more comfortable and handy.
Geomol
11-Mar-2006
[4482]
Anton, good point with the scale. :-)
PhilB
11-Mar-2006
[4483]
Is it possible to add effects to am image using the draw dialect 
? (ie do something like tinting an image inside the draw dialect)
Henrik
11-Mar-2006
[4484x2]
yes
I think you need to use the image inside the DRAW block.
PhilB
11-Mar-2006
[4486]
The docs arent clear on how to do it though ....
Henrik
11-Mar-2006
[4487x2]
hmm... wait
I don't think you can squeeze everything into the DRAW block, but 
you can of course do it inside the EFFECT block. I do remember seeing 
in the AGG test program in the Viewtop something that let you use 
transparency on top of an image, but I'm not sure taht's what you 
want
PhilB
11-Mar-2006
[4489]
I wanted to use the an effect block inside of the draw dialect but 
I suspect that its not possible.
Henrik
11-Mar-2006
[4490]
no that's not possible
PhilB
11-Mar-2006
[4491]
OK .... thanks.
Geomol
11-Mar-2006
[4492x2]
The EFFECT block is like a graphical pipeline. You can have a serie 
of effects and DRAW blocks after each other. Like:

img: to-image layout [box red "Red" box green "Green" box blue "Blue"]

view layout [box 200x400 white effect [draw [image img] tint 40 draw 
[translate 100x100 image img]]]
Phil, maybe you can use this to have, what you're after?
Rebolek
11-Mar-2006
[4494]
Oldes: that's bad design that one pixel equals to twips. From the 
definition twip should be resolution-independent, so it's nonsense 
to set it to some fixed value. But I know it's not your but Macromedia's 
fault.
PhilB
12-Mar-2006
[4495]
Gemol .... that is interesting (I understand now what is meant by 
a a graphical pipeline) but not quite what I wanted. 

I have a draw block with a number of images and I want to apply an 
effect indivdual images.
Anton
12-Mar-2006
[4496]
You must precompute the images with the effects, then use them in 
the final draw block.
Henrik
13-Mar-2006
[4497]
http://www.hmkdesign.dk/rebol/tab-view/tab-view.r<-- a very small 
demo.
ChristianE
13-Mar-2006
[4498]
Small, yet very nice! Clear and cool, reminds me on e.g. the buttons 
of my old tape deck. I think you've already said it before: the BTN 
style's look is nice, but it's way too under-represented in VID, 
making typical layouts look inconsistend. This one helps.
Henrik
13-Mar-2006
[4499x2]
yep, actually it was more inspired by the segmented button in OSX. 
I think it conveys a much better message of grouped buttons than 
just using TOG buttons with OF 'group
now I'm beginning to wonder how SCROLLER would look :-)
Graham
13-Mar-2006
[4501]
infinitely segmented button ?
Henrik
13-Mar-2006
[4502x2]
yeah
now I've run into the problem with VID elements sharing the same 
font object, which means that if I create three tab views, and change 
the font in the first one, the other two incorrectly also change. 
where exactly is this fixed? I've tried putting the font object inside 
the init code for the element, but this makes it impossible to change 
the font settings from within the layout.
Ashley
13-Mar-2006
[4504]
I hit that problem with shared para object and the fix was:

stylize/master [
	area: area with [insert tail init [para: make para []]]
]

so something similiar for font should work.
ChristianE
14-Mar-2006
[4505]
If it's the LAYOUT user who want's different fonts, let him specify 
them.

If it''s you wanting to to have e.g. a second bold font just for 
the pressed tab in one tab-view, I think you may for example allocate 
two font objects and dynamically swap them in the FEEL/REDRAW.
Code fragment:


 redraw: func [face action offset] [... face/font: pick face/fonts 
 face/state ...]

You may even get along with changing a single font object:


 redraw: func [face action offset] [... face/font/style: if face/state 
 ['bold] ...]
Anton
15-Mar-2006
[4506]
Henrik, yes, if you expect the user will want to change the font 
attributes, you should clone the font in INIT, like this :

	font: make font []


That clones the original, shared font object that the style comes 
with. Now every instance of your style has its own font object.

(The same goes for any other facets that are objects. If you don't 
want to share them, clone them in init.)
Henrik
15-Mar-2006
[4507]
now it's a chicken and egg thing. If I clone the object inside INIT, 
the font settings inside the layout is ignored, apparently because 
they are parsed before INIT is run.
Maxim
15-Mar-2006
[4508]
imagine all the fun I am trying using VID within GLayout  ;-)
Pekr
15-Mar-2006
[4509]
GWhat? :-)
Gabriele
15-Mar-2006
[4510]
henrik, just clone on change. VID also uses a flag in face/flags 
to indicate if a given subobject has been already cloned or not (so 
to clone only once)
Henrik
15-Mar-2006
[4511]
FACE/CHANGES ?
DideC
15-Mar-2006
[4512]
In face/flags, if 'font word is in the block, then the font has already 
been cloned.
Maxim
15-Mar-2006
[4513]
Pekr:  hahahaha
Anton
15-Mar-2006
[4514x3]
Henrik, can I see an example of what you mean by "font settings inside 
the layout" ? because I am not sure it's true, given:
view layout [style bx box "box" navy with [append init [font: make 
font []]] bx bx bx font-size 40 bx]
On Gabriele's note, use FLAG-FACE? to check for flags:

	>> layout [b: box]
	>> flag-face? b font
	== none
	>> layout [b: box font-size 30]
	>> flag-face? b font
	== [font]

and FLAG-FACE when you want to set a flag yourself.