[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#39735: 27.0.60; bugs about XBM images
From: |
Lars Ingebrigtsen |
Subject: |
bug#39735: 27.0.60; bugs about XBM images |
Date: |
Sun, 02 Aug 2020 10:38:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
ynyaaa@gmail.com writes:
> (1)XBM image with :file property can not be scaled with :width or :height.
>
> (let ((f (locate-file "gnus/preview.xbm" image-load-path)))
> (image-size (create-image f 'xbm nil :width 128)))
> error-> Invalid image specification
>
> (2)XBM image with :data property has no way to scale with different
> aspect ratio.
>
> :width and :height image properties are interpreted as adittional
> properties on :data property.
I think these are probably somewhat connected: :width and :height have a
special meaning for some XBM images:
If the specification is for a bitmap loaded from memory it must
contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where
WIDTH and HEIGHT are integers > 0. DATA may be:
So the Emacs XBM functions uses :width and :height so specify the
dimensions of the data, not how big the image is going to turn out to be
displayed. It's unfortunate that we're using the same properties for
two different things.
I'm not sure how to fix that. XBM images aren't used much, I would
imagine...
Eli, would it make sense to do a backwards-incompatible change here and
rename the XBM parameters to :xbm-width and :xbm-height?
> (3)XBM :data string can not be used as raw bit pattern
> if it looks like contents of XBM file,
>
> (let ((data "\
> #define b_width 1
> #define b_height 1
> static char b[] = {0x01}
> "))
> (image-size
> (create-image data 'xbm t :width 8 :height (length data))))
> error-> Invalid image specification
This is more of the same: It's the overloading of :width/:height, which
means that we don't allow those parameters for data like that:
DATA may be:
1. a string large enough to hold the bitmap data, i.e. it must
have a size >= (WIDTH + 7) / 8 * HEIGHT
2. a bool-vector of size >= WIDTH * HEIGHT
3. a vector of strings or bool-vectors, one for each line of the
bitmap.
4. a string containing an in-memory XBM file. WIDTH and HEIGHT
may not be specified in this case because they are defined in the
XBM file.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#39735: 27.0.60; bugs about XBM images,
Lars Ingebrigtsen <=