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

World: r3wp

[View] discuss view related issues

Henrik
20-Dec-2009
[9366]
hmm... well, I guess you need to keep that going, while the button 
is held down, otherwise no events are fired.
Nicolas
20-Dec-2009
[9367x2]
Yeah, that's the problem.
Could I flick over to event detection every tenth of a second somehow?
Pekr
20-Dec-2009
[9369]
yes, you can ... well, but I am not much experienced in that. You 
need to test event/type for 'time value. But how to get time events 
there? Maybe setting face/rate: desired-value-per-second could help?
Nicolas
20-Dec-2009
[9370x6]
I'll try that
Here's a prototype
window: layout [i: image rate 5 load %gtfo.jpg key escape [halt]]

zoom-in: does [i/size: i/size * 5 / 4]
zoom-out: does [i/size: i/size * 4 / 5]
down: false
alt-down: false

insert-event-func [
	probe event/type
	switch/all event/type [
		down [down: true]
		up [down: false]
		time [if down [zoom-in]]		
		alt-down [alt-down: true]
		alt-up [alt-down: false]
		time [if down [zoom-in] if alt-down [zoom-out]]
	]
	center-face i
	show window
	event
]

view/options window [resize]
REBOL []


window: layout [i: image rate 5 load http://rebol.com/graphics/kits.jpg
key escape [halt]]

zoom-in: does [i/size: i/size * 5 / 4]
zoom-out: does [i/size: i/size * 4 / 5]
down: false
alt-down: false

insert-event-func [
	probe event/type
	switch/all event/type [
		down [down: true]
		up [down: false]
		time [if down [zoom-in]]		
		alt-down [alt-down: true]
		alt-up [alt-down: false]
		time [if down [zoom-in] if alt-down [zoom-out]]
	]
	center-face i
	show window
	event
]

view/options window [resize]
Can comments be deleted?
I guess they can't. Anyway, thanks for your help!
Pekr
20-Dec-2009
[9376]
comments here in Altme? No - they can't be deleted ...
Nicolas
20-Dec-2009
[9377x2]
This is the first step to creating a zooming user interface
What do you mostly use rebol for?
Pekr
20-Dec-2009
[9379]
as for me - simple CGI stuff, some automatition tasks, few GUI utils 
....
Graham
22-Dec-2009
[9380x2]
In easy-vid, Carl creates layouts of a fixed size, and fits all his 
text accordingly.  Hypernotes creates layouts that are variable in 
height.  How is this done?
ie. control the width and let the height expand to as necessary.
Gabriele
23-Dec-2009
[9382]
set the width and then use size-text
Graham
25-Dec-2009
[9383]
If you use unview/only window, why should any other windows close 
down as well?
Henrik
25-Dec-2009
[9384]
they shouldn't
Graham
25-Dec-2009
[9385x4]
I wonder if it's the Z order that is the problem
Maybe it's just a rebgui issue ...
It's also occuring if I use the close gadget at the top right ..
Yes, it seems to be a result of using rebgui's display/parent ...
Dockimbel
12-Jan-2010
[9389x3]
Can't find the DRAW group anymore, so I'm posting here.
Does anyone know if IMAGE-FILTER BILINEAR is working in Draw? I see 
no differences with NEAREST mode (which looks horrible when scaling 
down a big image, even with preserved aspect ratio).
If BILINEAR filter is not working or not implemented (while being 
documented), that would be really a pity to have to code my own bilinear 
filter in REBOL which would be probably too slow to use, or install 
a 10MB library like ImageMagic...
Henrik
12-Jan-2010
[9392x2]
bilinear only works with scaling up
forget making smooth thumbnails with R2 :-)
Dockimbel
12-Jan-2010
[9394]
I'm finishing attached files management for CureCode with thumbnails 
generation....too bad, you'll have horrible thumbnails...


Once again with REBOL, stuck at 95% of the goal and no (simple) way 
to workaround. That's how I usually loose all the time gained by 
using REBOL instead of another language...Where's that Rant channel? 
:-)
Henrik
12-Jan-2010
[9395]
Fortunately R3 has no problem with this.
Dockimbel
12-Jan-2010
[9396]
Nice, so now could you port Cheyenne + CureCode to R3 in one night? 
If not, I can't see how R3 can help me.
Henrik
12-Jan-2010
[9397]
Just trying to help :-) I could see the use here for launching r3 
processes from Cheyenne for limited special functions. I assume the 
thumbnails are generated once?
Dockimbel
12-Jan-2010
[9398]
Yes, I know, I'm really pissed off by the misleading Draw documentation...
Pekr
12-Jan-2010
[9399x2]
there are wrappers to image-magick, no? Or - you could use nconvert 
from xnview package from command line too ...
just workarounds too ... before Cyphre fixes/extends Draw ... but 
I doubt any native changes are going to be backported to R2.
Dockimbel
12-Jan-2010
[9401]
Yes, once only, I guess CALL would be ok, just need to install ImageMagic 
on Windows, test it, then install it on Linux server, test again, 
then add this package to the list of dependencies to maintain...cool!
Pekr
12-Jan-2010
[9402x2]
get used to what other environments do ;-)
... well, just kidding ... I thought it is a one-time job ....
Dockimbel
12-Jan-2010
[9404]
Well, the point in using REBOL+my own closely integrated frameworks 
is to avoid third-party dependencies...
Pekr
12-Jan-2010
[9405]
Try contact Cyphre ... or I will ask him ...
Dockimbel
12-Jan-2010
[9406]
If R2/Draw is not going to be updated, there's no point in bothering 
him.
Geomol
12-Jan-2010
[9407]
Doc, I might have a resizer to make thumbs...
Graham
12-Jan-2010
[9408]
can't you call R3 from R2 ?
Dockimbel
12-Jan-2010
[9409]
Ah nice! I started looking at http://en.wikipedia.org/wiki/Lanczos_resampling
to see if a REBOL implementation would be fast enough.
Geomol
12-Jan-2010
[9410x3]
Just a test:

set 'resize func [img /local sz c1 c3 i2] [
	if file? img [img: load-image img]

	scale: img/size/x / 160
	sz: as-pair 160 round img/size/y / scale
	c1: 1x0 * sz
	c3: 0x1 * sz


 i2: to-image layout [origin 0 box sz effect [draw [image img 0x0 
 c1 sz c3]]]
	save/png %img.png i2
]
Call RESIZE with a loaded image. It'll save the img.png file, that'll 
have x-size of 160. It looks ok here.
Change the 160 to some other value, if you need other size.
Dockimbel
12-Jan-2010
[9413]
That's almost the code I've made already. The issue is not having 
BILINEAR or any other good enough filter for thumbnails.
Geomol
12-Jan-2010
[9414]
(or give it as an argument)
Dockimbel
12-Jan-2010
[9415]
I'm working with 64x64