GNU bug report logs -
#16992
feature request: background images
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 07/11/2024 7:04, Eli Zaretskii wrote:
> Yes, it's okay to post partial changesets for review.
Here is the incomplete patch that implements background images.
This should build and work for x+cairo and w32 (both mingw64 and
mingw.org's)
It works by adding a call to complex_bkg_clear_frame_area on all
functions that clear the background. These are the functions for w32
port. For the cairo port, they are parallel:
w32_clear_frame_area, w32_clear_glyph_string_rect,
w32_draw_stretch_glyph_string, w32font_draw
I know I'm missing at least w32_draw_image_glyph_string, but works well
enough for a test.
To setup the backgroud image for a frame, you would do something like
this:
(progn
(setq bkg (create-image "icons/hicolor/128x128/apps/emacs.png"))
(frame-set-background-image (selected-frame) bkg 'center nil)
(frame-set-background-policy (selected-frame) t))
There are new fields in the frame struct that control general activation
(background_policy), and the image to use (background_image).
The image can be placed in the center, or on sides or corners with 'n,
's, 'se, 'sw, etc. The background can be filled be repeating the image
passing t as the last parameter of frame-set-background-image.
Also, in this patch I am drawing a red line to mark the current
fill-column value for each window, to show how it would work.
The simple frame image code would not change much from where it is:
would add offsets, and more backends, and more points on the code that
may clear the background.
Right now, the background is cleared normally, and then the image is
painted over if the rect was cleared with the frame's background
pixel. So, frames with colored background will work. I haven't tested
yet with a default font that has a background different from the frame's
color.
Apart from the obvious overhead of drawing the image pixels,
unfortunately the frame contents can't be scrolled to reuse text pixels
(dispnew.c:scrolling_window). I don't think this can't be fixed without
big changes.
I attach a couple of screenshots to see what to expect.
[0001-Support-for-background-images-on-frames.patch (text/plain, attachment)]
[emacs_R5JevGsu5Z.png (image/png, attachment)]
[msrdc_mtQ0HAdC5U.png (image/png, attachment)]
This bug report was last modified 216 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.