all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: ynyaaa@gmail.com
Cc: 39735@debbugs.gnu.org
Subject: bug#39735: 27.0.60; bugs about XBM images
Date: Sun, 02 Aug 2020 10:38:53 +0200	[thread overview]
Message-ID: <875za1mogy.fsf@gnus.org> (raw)
In-Reply-To: <86mu9apvc7.fsf@gmail.com> (ynyaaa@gmail.com's message of "Sat, 22 Feb 2020 23:09:28 +0900")

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





  reply	other threads:[~2020-08-02  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22 14:09 bug#39735: 27.0.60; bugs about XBM images ynyaaa
2020-08-02  8:38 ` Lars Ingebrigtsen [this message]
2020-08-02 14:19   ` Eli Zaretskii
2020-08-02 14:36     ` Lars Ingebrigtsen
2020-08-02 16:26       ` Eli Zaretskii
2020-08-02 17:04         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875za1mogy.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=39735@debbugs.gnu.org \
    --cc=ynyaaa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.