From: "Pfrommer, Julius" <julius.pfrommer@web.de>
To: emacs-devel@gnu.org
Subject: Unifying code for drawing on a cairo context
Date: Sat, 23 Apr 2022 11:06:16 +0200 [thread overview]
Message-ID: <f0dbf270-1515-e728-c6a8-b43ffe2761c7@web.de> (raw)
The X and the PGTK toolkits both support a cairo "glass". Their code for
drawing on a cairo context is virtually identical. Yet the
implementations have started to diverge.
As an example, x_draw_horizontal_wave and pgtk_draw_horizontal_wave are
virtually the same. But the X implementation takes a "GC" graphics
context, whereas the PGTK implementation now takes a "color" integer
argument.
https://git.savannah.gnu.org/cgit/emacs.git/tree/src/xterm.c#n5155
https://git.savannah.gnu.org/cgit/emacs.git/tree/src/pgtkterm.c#n1995
Obviously maintaining duplicate code is an anti-pattern. I'd like to
pull out common cairo functionality bit-by-bit into methods to be used
by both the X and the PGTK toolkit.
With the cairo primitives unified between X and PGTK, adding a cairo
"glass" for more toolkits should also become easier as a future option
(ns, haiku, w32).
But I'm unsure about how this fits with ongoing development and which
conventions to follow.
- Would the unified cairo function be called cairo_draw_horizontal_wave,
establishing a new cairo_ prefix convention?
- Should such functions generally take an immediate cairo_t context as
input or some "larger" struct that includes that cairo_t and can be
extended in the future (e.g. with foreground and background color
information).
- Is it okay to create the files cairoterm.h/.c or can we expect
functionality beyond "term" to be added over time as well?
Regards,
Julius
next reply other threads:[~2022-04-23 9:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-23 9:06 Pfrommer, Julius [this message]
2022-04-23 9:18 ` Unifying code for drawing on a cairo context Eli Zaretskii
2022-04-23 11:58 ` Po Lu
2022-04-23 12:04 ` Eli Zaretskii
2022-04-29 8:01 ` Pfrommer, Julius
2022-04-29 8:33 ` Po Lu
2022-04-29 8:35 ` Po Lu
2022-04-29 9:07 ` Pfrommer, Julius
2022-04-29 9:20 ` Po Lu
2022-04-29 10:43 ` Eli Zaretskii
2022-04-23 11:51 ` Po Lu
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0dbf270-1515-e728-c6a8-b43ffe2761c7@web.de \
--to=julius.pfrommer@web.de \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).