[vwnc] How to copy a Cairo PNG image to the clipboard

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] How to copy a Cairo PNG image to the clipboard

Maarten Mostert-2
Hi,
 
There must be a very simple wy to copy a Cairo image to the clipboard to be able to paste it into other applications.
 
Has anyone n idea how to do to this ?
 
Regards,
 
@+Maarten,

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Mark Plas

You can send #toClipboard to a Pixmap so if you can convert a Cairo image to a Pixmap then that should work.

 

This is an example that's shown in the #toClipboard method:

 

                Image fromUser asRetainedMedium toClipboard

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Maarten MOSTERT
Sent: zaterdag 2 januari 2010 10:14
To: VWNC
Subject: [vwnc] How to copy a Cairo PNG image to the clipboard

 

Hi,

 

There must be a very simple wy to copy a Cairo image to the clipboard to be able to paste it into other applications.

 

Has anyone n idea how to do to this ?

 

Regards,

 

@+Maarten,


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Travis Griggs-3

On Jan 4, 2010, at 1:08 AM, Mark Plas wrote:

> You can send #toClipboard to a Pixmap so if you can convert a Cairo  
> image to a Pixmap then that should work.
>
> This is an example that's shown in the #toClipboard method:
>
>                 Image fromUser asRetainedMedium toClipboard
>
>
>
> From: [hidden email] [mailto:[hidden email]] On  
> Behalf Of Maarten MOSTERT
> Sent: zaterdag 2 januari 2010 10:14
> To: VWNC
> Subject: [vwnc] How to copy a Cairo PNG image to the clipboard
>
> Hi,
>
> There must be a very simple wy to copy a Cairo image to the  
> clipboard to be able to paste it into other applications.
>
> Has anyone n idea how to do to this ?

Primitive 776 is implemented for Windows, not for X11, and not for  
OSX. It was implemented for old Mac OS, but that's not supported  
anymore. IOW, if all you want is Windows, the above should work fine.

--
Travis Griggs
Objologist
10 2 letter words: "If it is to be, it is up to me"


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Maarten Mostert-2
Oké If I write the Cairo Image to a png file I can read it with Imagereader
and push it to the Clipboard.

This is not the most elegant way but really cool .....

@+Maarten,

----- Original Message -----
From: "Travis Griggs" <[hidden email]>
To: "VWNC List" <[hidden email]>
Sent: Monday, January 04, 2010 4:43 PM
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard


>
>
> On Jan 4, 2010, at 1:08 AM, Mark Plas wrote:
>
>> You can send #toClipboard to a Pixmap so if you can convert a Cairo
>> image to a Pixmap then that should work.
>>
>> This is an example that's shown in the #toClipboard method:
>>
>>                 Image fromUser asRetainedMedium toClipboard
>>
>>
>>
>> From: [hidden email] [mailto:[hidden email]] On
>> Behalf Of Maarten MOSTERT
>> Sent: zaterdag 2 januari 2010 10:14
>> To: VWNC
>> Subject: [vwnc] How to copy a Cairo PNG image to the clipboard
>>
>> Hi,
>>
>> There must be a very simple wy to copy a Cairo image to the
>> clipboard to be able to paste it into other applications.
>>
>> Has anyone n idea how to do to this ?
>
> Primitive 776 is implemented for Windows, not for X11, and not for
> OSX. It was implemented for old Mac OS, but that's not supported
> anymore. IOW, if all you want is Windows, the above should work fine.
>
> --
> Travis Griggs
> Objologist
> 10 2 letter words: "If it is to be, it is up to me"
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Steven Kelly
In reply to this post by Maarten Mostert-2
Re: [vwnc] How to copy a Cairo PNG image to the clipboard
Can't you just display the Cairo image on a Pixmap? Something like this:
 
myNewPixmap := Pixmap extent: aCairoPngImage extent.
aCairoPngImage displayOn: myNewPixmap graphicsContext.
myNewPixmap toClipboard
 
If that doesn't work, and you decide to go the PNG route, you may be able to write and read the PNG stream in memory, rather than using a file: that's what we did when interfacing with GDI+ (although then we were going the other way to you):
 
winImageFrom: image
"WinGDIPlusInterface and PNGWriter are both in the public store"
 | ws |
 ws := (ByteArray new: image bitsInstVar size // 4) writeStream.
 Refactory.PNG.PNGImageWriter writeImage: image on: ws.
 ^Graphics.WinGDIPlus.GDIPlusBitmap fromBytes: ws contents
 
Steve


From: [hidden email] on behalf of Maarten MOSTERT
Sent: Tue 05/01/2010 06:38
To: VWNC List
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Oké If I write the Cairo Image to a png file I can read it with Imagereader
and push it to the Clipboard.

This is not the most elegant way but really cool .....

@+Maarten,

----- Original Message -----
From: "Travis Griggs" <[hidden email]>
To: "VWNC List" <[hidden email]>
Sent: Monday, January 04, 2010 4:43 PM
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard


>
>
> On Jan 4, 2010, at 1:08 AM, Mark Plas wrote:
>
>> You can send #toClipboard to a Pixmap so if you can convert a Cairo
>> image to a Pixmap then that should work.
>>
>> This is an example that's shown in the #toClipboard method:
>>
>>                 Image fromUser asRetainedMedium toClipboard
>>
>>
>>
>> From: [hidden email] [[hidden email]] On
>> Behalf Of Maarten MOSTERT
>> Sent: zaterdag 2 januari 2010 10:14
>> To: VWNC
>> Subject: [vwnc] How to copy a Cairo PNG image to the clipboard
>>
>> Hi,
>>
>> There must be a very simple wy to copy a Cairo image to the
>> clipboard to be able to paste it into other applications.
>>
>> Has anyone n idea how to do to this ?
>
> Primitive 776 is implemented for Windows, not for X11, and not for
> OSX. It was implemented for old Mac OS, but that's not supported
> anymore. IOW, if all you want is Windows, the above should work fine.
>
> --
> Travis Griggs
> Objologist
> 10 2 letter words: "If it is to be, it is up to me"
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Maarten Mostert-2
Re: [vwnc] How to copy a Cairo PNG image to the clipboard
Hi Steve,
 
Well both your tips seem worked:
 
With a normal Cairo's Image Surface:
 
myNewPixmap := Pixmap extent: aCairoImage extent.
aCairoImage displayOn: myNewPixmap graphicsContext.
myNewPixmap toClipboard
 
and through the GDI ° interface:
 
ws := ByteArray new writeStream.
aCairoImage writeToPngStream:  ws.
(Graphics.WinGDIPlus.GDIPlusBitmap fromBytes: ws contents) asRetainedMedium toClipboard.
 
 
If I poke around the Cairo documentation I still have the impression that the Win32 Surface is capable of directly supplying the Dip Win32 Bitmap Windows seems to expect.
 
 
It would be cool if Cairo could do this job directly on all platforms. Obviouly if cincom could file an AR to fix OSX and Linux that would excellent. This really is basic functionality everyone is using all the time.
 
Regards,
 
@+Maarten,
 
 
----- Original Message -----
Sent: Tuesday, January 05, 2010 11:15 AM
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Can't you just display the Cairo image on a Pixmap? Something like this:
 
myNewPixmap := Pixmap extent: aCairoPngImage extent.
aCairoPngImage displayOn: myNewPixmap graphicsContext.
myNewPixmap toClipboard
 
If that doesn't work, and you decide to go the PNG route, you may be able to write and read the PNG stream in memory, rather than using a file: that's what we did when interfacing with GDI+ (although then we were going the other way to you):
 
winImageFrom: image
"WinGDIPlusInterface and PNGWriter are both in the public store"
 | ws |
 ws := (ByteArray new: image bitsInstVar size // 4) writeStream.
 Refactory.PNG.PNGImageWriter writeImage: image on: ws.
 ^Graphics.WinGDIPlus.GDIPlusBitmap fromBytes: ws contents
 
Steve


From: [hidden email] on behalf of Maarten MOSTERT
Sent: Tue 05/01/2010 06:38
To: VWNC List
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard

Oké If I write the Cairo Image to a png file I can read it with Imagereader
and push it to the Clipboard.

This is not the most elegant way but really cool .....

@+Maarten,

----- Original Message -----
From: "Travis Griggs" <[hidden email]>
To: "VWNC List" <[hidden email]>
Sent: Monday, January 04, 2010 4:43 PM
Subject: Re: [vwnc] How to copy a Cairo PNG image to the clipboard


>
>
> On Jan 4, 2010, at 1:08 AM, Mark Plas wrote:
>
>> You can send #toClipboard to a Pixmap so if you can convert a Cairo
>> image to a Pixmap then that should work.
>>
>> This is an example that's shown in the #toClipboard method:
>>
>>                 Image fromUser asRetainedMedium toClipboard
>>
>>
>>
>> From: [hidden email] [[hidden email]] On
>> Behalf Of Maarten MOSTERT
>> Sent: zaterdag 2 januari 2010 10:14
>> To: VWNC
>> Subject: [vwnc] How to copy a Cairo PNG image to the clipboard
>>
>> Hi,
>>
>> There must be a very simple wy to copy a Cairo image to the
>> clipboard to be able to paste it into other applications.
>>
>> Has anyone n idea how to do to this ?
>
> Primitive 776 is implemented for Windows, not for X11, and not for
> OSX. It was implemented for old Mac OS, but that's not supported
> anymore. IOW, if all you want is Windows, the above should work fine.
>
> --
> Travis Griggs
> Objologist
> 10 2 letter words: "If it is to be, it is up to me"
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc