emacs-devel
[Top][All Lists]
Advanced

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

Re: Stipples support in MS-Windows port


From: Elijah G.
Subject: Re: Stipples support in MS-Windows port
Date: Sat, 25 May 2024 18:27:45 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (windows-nt)

Eli Zaretskii <eliz@gnu.org> writes:

>> +  /* Convert X bitmap to W32 bitmap */
>                                       ^
> Style: C comments should end in a period and 2 spaces before "*/".

Thank you, it's now fixed.

>> +  dpyinfo->bitmaps[id - 1].height = width;
>> +  dpyinfo->bitmaps[id - 1].width = height;
>> +  dpyinfo->bitmaps[id - 1].stipple = bitmap;
>> +  dpyinfo->bitmaps[id - 1].file = xlispstrdup (file);
>> +  printf("%s\n", dpyinfo->bitmaps[id - 1].file);
>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This printf should probably be removed or commented out.

It was already removed from the patch that i sent to bug-gnu-emacs
(bug#71159).

I'm wondering if the patch must be here or to the bug tracker, if
should it be sent here i think bug#71159 can be closed.

>> +static void
>> +w32_fill_stipple_pattern (HDC hdc, struct glyph_string *s, Emacs_GC *gc,
>> +                      int x, int y, unsigned int width, unsigned int height)
>> +{
>> +  /* BUG: stipple bitmap has the inverted colors, inverting
>> +     those 2 functions color must fix this. */
>
> Can we fix this before installing, please?  If there are problems with
> inverting the colors that you are unsure how to fix, please describe
> those problems in detail, so that others could provide advice or code.

I would like fix it, but I don't have a clear answer as to why this
problem happens, I just left the notice there as a temp solution in case
someone comes up with a better solution.

I could see that BitBlt maybe can fix this (I've had problems for test
it).

Also I don't think w32_create_pixmap_from_bitmap_data cause this
problem, as far as i could see it's a problem with the bitmap data

  image_create_bitmap_from_data (struct frame *f, char *bits,
                                                        ^^^^
                                              (as example this function)

One solution that i was thinking is using a kind of inverse-video for
make it use fg as bg and vice-versa but I'm not sure how.

Also I was thinking in modifying bitmap data with something like this,
but i don't have idea how:

  for (i = 0; i < height; i++)
    {
      -- Invert bitmap data--
      for (j = 0; j < w1; j++)
        {
          -- Invert bitmap data--
        }
    }


> Finally, this change needs a NEWS entry, in the "Changes in Emacs 30.1
> on Non-Free Operating Systems" section.

Done.

>> I would like if someone else can test it for see if there are any
>> issues.
>
> Please suggest how to test this.

Sure, after apply patch and build Emacs, i open runemacs.exe with -Q,
inside the scratch-buffer i paste these code snippets and eval them:

 (let* ((w (window-font-width))
        (stipple `(,w 1 ,(apply #'unibyte-string
                               (append (make-list (1- (/ (+ w 7) 8)) ?\0)
                                       '(1))))))
   (insert "\n" (propertize (concat  (make-string 15 ?\s)
                                    "THIS IS A TEST"
                                    (make-string 15 ?\s))
                            'face `(:background "red" :foreground "blue" 
:stipple ,stipple))))

The first makes a stipple with blue lines with a red background.

 (let ((str "foobar"))
   (make-face 'foo)
   (set-face-stipple 'foo (list 2 2 (string 1 2)))
   (put-text-property 0 3 'face 'foo str)
   (insert str))

This one makes a chess board-like stipple.

font-lock-mode must be disabled for make this work.

Also i use this for test xbm files, in my case i use gnus.xbm file from
etc/images/gnus/:
 (set-face-attribute 'region nil :stipple "path/to/xbm/file")

This set a stipple attribute to region face.

Attachment: 0001-Stipple-support-for-MS-Windows.patch
Description: Text Data


reply via email to

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