[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Several suggestions for image support

From: Kim F. Storm
Subject: Re: Several suggestions for image support
Date: 21 Apr 2004 03:08:26 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

David Kastrup <address@hidden> writes:

> PNG images support transparency.  Emacs can't make use of it.  You can
> only have Emacs declare a particular color as transparent.  This is
> dissatisfactory.  It should tell the PNG decoding routines Emacs'
> background color for the purpose of transparency.
> I would find it important if an image specifier could restrict the
> displayed portion of an image.

I have just implemented image slicing via a new slice property:

        display ((slice X Y WIDTH HEIGHT) (image ...))

I have installed changes for W32 and MAC ports also, but as usual I
have no way to test if they actually do something sensible.

> The reason is that large images always appear as a single big
> character to Emacs.  If I could split such an image into a bunch of
> smaller images, I could walk through it with the cursor.  But it
> should only be necessary to instantiate the complete image itself once
> for this purpose.  Of course, one should find a way that does not
> cause all of the subimages to be entered separately into the image
> cache.

Try this with http://www.w3.org/Graphics/PNG/alphatest.png :

(setq im (create-image "alphatest.png" nil nil))
(insert "\n")
(insert-sliced-image im nil nil 5 4)
(insert "\n")

Note on XPM images:

There are severe problems with sliced XPM images, at least on X.  

The clip mask for each slice is taken from top/leftmost part of the
image, rather than the actual slice of the image.  I have tried a
zillion things to setup the clip mask (and rewrite other parts of the
code) to make this work, but to no avail.

So I hereby ask for help from more skilled X people.  How do you setup
the clip mask of an image with an image mask so that XCopyArea will
use the corresponding part of the image mask when copying a slice from
the image ?

Here is some code to illustrate the bug:

(setq im2 (create-image "etc/gnus.png" nil nil))
(insert "\n")
(insert-sliced-image im2 nil nil 5 4)
(insert "\n")

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]