On 6/26/05, Carl Read <[EMAIL PROTECTED]> wrote:
>=20
> On Saturday, 25-June-2005 at 23:47:09 Volker Nitsch wrote,
>=20
> >On 6/25/05, Petr Krenzelok <[EMAIL PROTECTED]> wrote:
>=20
> >> >If you have a transparent face in View, it can be used to grab an ima=
ge
> >> >of the faces under it.  However, I can only get this to work on a lay=
out in
> >> >an open window - when I attempt it on layout, all I get is a black im=
age.
> >> >
> >> >Here's an example of this:  Just run it, click on the "Grab Area" but=
ton
> > and you'll see what I mean...
> >> >
> >> >
> >> >rebol []
> >> >lo: layout [
> >> >    title "Grab area test."
> >> >    at 30x20
> >> >    b: box 80x30 with [color: none] ; Transparent box.
> >> >    button "Grab Area" [
> >> >        window-grab: to-image b
> >> >        unview/all
> >> >    ]
> >> >]
> >> >lo-grab: to-image b
> >> >
> >> >
> >>=3D20
> >> Look, I am no guru at View, but imo following happens. Feel free to
> >> correct me eventually:
> >>
> >> you create snapshot of  'b (lo-grab), even before it is being shown fo=
r
> >> the first time. Imo layout just defines structures, but does not apply
> >> effect, until the face is actually shown.
> >
> >Pekr, if you continue at that pace, you will be guru shortly ;)
> >And the solution is:
> >You can show things without viewing them.
> >That forces /view to paint into the internal buffers.
> >A to-image just dumps these buffers, without a 'show there is just black=
.
> >So
> >
> >!>> lo: layout [
> >[       title "Grab area test."
> >[       at 30x20
> >[       b: box 80x30 with [color: none] ; Transparent box.
> >[       button "Grab Area" [
> >[               window-grab: to-image b
> >[               unview/all
> >[           ]
> >[    ]
> >!>> show lo
> >; ^^^^^^^^!!!!!!!!!
> >!>> lo-grab: to-image lo
> >=3D3D=3D3D make image! [220x102 #{
> >C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8
> >C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C...
> >!>> view layout[image lo-grab]
>=20
> Thanks Volker (and Petr), but that still doesn't do what I want, which is=
 to capture 'b, not 'lo.
>=20

Tried a bit, quite confusing. found two ways:=20
1) One was with 'view, grabbing the face itself does not work without it.
2) But what you can do is:
  lo-grab: copy/part at to-image lo 30x20 80x30
(note you have to get it from the whole layout, not just the box)
Easier than those numbers to exact face-content:
  lo-grab: copy/part at to-image lo b/offset b/size

> And incidentally, you don't need to SHOW a layout before capturing it - t=
his works just fine...
>=20
> pic: to-image layout [text "Some text." button "A button"]
> view layout [image pic]
>=20

Ooops. hmm. Once long before something did not work! Must have been
something different. Ok, thanks for the tip :)

> -- Carl Read.
>=20
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>=20
>=20


--=20
-Volker

"Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem." David
Wheeler
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to