librelist archives

« back to archive

save something to image

save something to image

From:
Fela Winkelmolen
Date:
2010-07-04 @ 13:00
Hi!

I am implementing turtle graphics in hackety hack, and am trying to add an 
option to save the content of a window (or part of it) to a file. Isn't there 
a way to do that, or even a way to somehow access the raw pixel data of a 
Shoes::Image or of other Widgets?

Thanks,

- Fela

Re: [shoes] save something to image

From:
i5m
Date:
2010-07-04 @ 15:24
Ashbb discovered snapshot that does PDFs: 
http://github.com/ashbb/shoes_hack_note/blob/master/md/hack018.md

On 4 Jul 2010, at 14:00, Fela Winkelmolen <fela.kde@gmail.com> wrote:

> Hi!
> 
> I am implementing turtle graphics in hackety hack, and am trying to add an 
> option to save the content of a window (or part of it) to a file. Isn't there 
> a way to do that, or even a way to somehow access the raw pixel data of a 
> Shoes::Image or of other Widgets?
> 
> Thanks,
> 
> - Fela

Re: [shoes] save something to image

From:
ashbb
Date:
2010-07-04 @ 15:48
Hi Fela,

> to save the content of a window (or part of it) to a file.
Umm... I think there is no feature in Shoes so far, sorry.

As i5m mentioned, you may want to use `snapshot` method. Yes, it works. But
there are two big restrictions so far.
Look at a tiny note:
http://github.com/ashbb/shoes_hack_note/blob/master/md/hack018.md

BTW. Why do you need to save raw pixel data?
Can I look at your turtle graphics code?

This is mine for learning metaprogramming and DSL:

http://github.com/ashbb/ruby_metaprogramming_study_note/blob/master/notes/Turtle_Graphics_with_Shoes.md

Although it may be different from what you want to do. :-P

ashbb

Re: [shoes] save something to image

From:
Steve Klabnik
Date:
2010-07-04 @ 15:58
Hey ashbbb -

Fela is adding a turtle graphics DSL for Hackety! You can look at his branch
at HTTP://github.com/Fela/hacketyhack to see how It's going...

On Jul 4, 2010 11:49 AM, "ashbb" <ashbbb@gmail.com> wrote:
> Hi Fela,
>
>> to save the content of a window (or part of it) to a file.
> Umm... I think there is no feature in Shoes so far, sorry.
>
> As i5m mentioned, you may want to use `snapshot` method. Yes, it works.
But
> there are two big restrictions so far.
> Look at a tiny note:
> http://github.com/ashbb/shoes_hack_note/blob/master/md/hack018.md
>
> BTW. Why do you need to save raw pixel data?
> Can I look at your turtle graphics code?
>
> This is mine for learning metaprogramming and DSL:
>

http://github.com/ashbb/ruby_metaprogramming_study_note/blob/master/notes/Turtle_Graphics_with_Shoes.md
>
> Although it may be different from what you want to do. :-P
>
> ashbb

Re: [shoes] save something to image

From:
Fela Winkelmolen
Date:
2010-07-04 @ 16:08
> Hi Fela,
> 
> > to save the content of a window (or part of it) to a file.
> 
> Umm... I think there is no feature in Shoes so far, sorry.
> 
> As i5m mentioned, you may want to use `snapshot` method. Yes, it works. But
> there are two big restrictions so far.
> Look at a tiny note:
> http://github.com/ashbb/shoes_hack_note/blob/master/md/hack018.md
> 
> BTW. Why do you need to save raw pixel data?
> Can I look at your turtle graphics code?

I wanted to allow the user to save their creations to file. I will try to see 
if I can get anything done with the _snapshot method

the branch I'm working in is: 
http://github.com/fela/hacketyhack/tree/turtle-script

> This is mine for learning metaprogramming and DSL:
> http://github.com/ashbb/ruby_metaprogramming_study_note/blob/master/notes/T
> urtle_Graphics_with_Shoes.md
> 
> Although it may be different from what you want to do. :-P
> 
> ashbb

Re: [shoes] save something to image

From:
Devyn Cairns
Date:
2010-07-04 @ 17:27
we need an object.snapshot method, could be as simple as taking _snapshot's
source and modifying it to take the snapshot from the object's left, top to
left+width, top+height

On Sun, Jul 4, 2010 at 9:08 AM, Fela Winkelmolen <fela.kde@gmail.com> wrote:

> > Hi Fela,
> >
> > > to save the content of a window (or part of it) to a file.
> >
> > Umm... I think there is no feature in Shoes so far, sorry.
> >
> > As i5m mentioned, you may want to use `snapshot` method. Yes, it works.
> But
> > there are two big restrictions so far.
> > Look at a tiny note:
> > http://github.com/ashbb/shoes_hack_note/blob/master/md/hack018.md
> >
> > BTW. Why do you need to save raw pixel data?
> > Can I look at your turtle graphics code?
>
> I wanted to allow the user to save their creations to file. I will try to
> see
> if I can get anything done with the _snapshot method
>
> the branch I'm working in is:
> http://github.com/fela/hacketyhack/tree/turtle-script
>
> > This is mine for learning metaprogramming and DSL:
> >
> http://github.com/ashbb/ruby_metaprogramming_study_note/blob/master/notes/T
> > urtle_Graphics_with_Shoes.md
> >
> > Although it may be different from what you want to do. :-P
> >
> > ashbb
>



-- 
   ~devyn

Re: [shoes] save something to image

From:
ashbb
Date:
2010-07-05 @ 13:57
Hi devyn,

Looks good!
I don't come up with how to implement the idea right now, though. :-P

ashbb

Re: [shoes] save something to image

From:
ashbb
Date:
2010-07-05 @ 13:49
Fela,

> I wanted to allow the user to save their creations to file.
I see.
I looked through your code quickly:
http://github.com/fela/hacketyhack/blob/turtle-script/h-ety-h/turtlescript.rb

And thought about `saving their creations`.

Why not save their code (DSL) like turtle_barbwire.rb instead of image file?
http://github.com/fela/hacketyhack/blob/turtle-script/samples/turtle_barbwire.rb

If you implement save/load DSL function, we can exchange our DSLs easily and
run them with our own Hackety Hack. :)

ashbb

Re: [shoes] save something to image

From:
Fela Winkelmolen
Date:
2010-07-05 @ 16:04
On Mon, Jul 5, 2010 at 3:49 PM, ashbb <ashbbb@gmail.com> wrote:

> Fela,
>
>
> > I wanted to allow the user to save their creations to file.
> I see.
> I looked through your code quickly:
>
> http://github.com/fela/hacketyhack/blob/turtle-script/h-ety-h/turtlescript.rb
>
> And thought about `saving their creations`.
>
> Why not save their code (DSL) like turtle_barbwire.rb instead of image
> file?
>
> http://github.com/fela/hacketyhack/blob/turtle-script/samples/turtle_barbwire.rb
>
> If you implement save/load DSL function, we can exchange our DSLs easily
> and run them with our own Hackety Hack. :)
>
> ashbb
>

The code can already be exchanged using the hackety-hack website, what I
wanted to do was to be able to share nice images created, with your grandma
or other people that don't want to install HH.. Saving to pdf worked just
fine, thanks (png in not supported right?)

- fela

Re: [shoes] save something to image

From:
Steve Klabnik
Date:
2010-07-05 @ 17:04
We use libgif in shoes, I'm sure that there'd be some fairly easy way to add
support for exporting to a .gif...

Something to look into.