[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] [RFC] clipboard support for various data types



Hi,

as I already discussed with Rene and the one or other on #pygame,
an easy to use image support for the pygame.scrap clipboard
implementation is needed.

Currently it only accepts strings, which - although it allows
e.g. buffered surfaces - does not ensure interoperability with other
applications like Gimp, image viewers and whatever else.

Rene mentioned an enhancement of the pygame.image saving routines, so
that they can store surface information directly into character
buffers. This'd be great, but leaves several questions for the scrap
module open, such as the exact format identification to share the
contents between the pygame application and others.

I looked over the Qt and Gtk+ clipboard implementations and noted, that
they use the mime-type RFC to identify the stored contents. I'd prefer
that mechanism as well as it would a) ensure interoperability with two
major UI toolkits, and b) allow an unique identification base for
whatever is placed into the clipboard for other applications.

I am not sure, how native Win32, QNX and Mac OS applications handle
that, but I guess that they treat content in a similar manner.

However, storing surface data in the one or other format or receiving
image information from other applications will also bring several other
issues for X11 up, which will make it necessary to implement a minimum
subset of the X ICCCM standard[0].
Although this sounds like a big task, this should not be that much work
if the interface are kept generic enough

If this support will be added and the implementations be made, it would
be a nice addition to have support for user-defined content types as
well, so that a user can define his own specific conversion formats for
sharing his own contents, which can be received by other applications,
which offer support for that.

[0] The X implementations have a maximum protocol size for transferring
data, which makes it necessary to send and receive information in
multiple chunks, must guarantee successful transports to or from an
application, have to deal with X failures, must support multiple string
conversions for different locale encodings and more.

Feedback is welcome.

Regards
Marcus

Attachment: pgpw6FFd3MvFO.pgp
Description: PGP signature