<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to patches</title><link href="https://sourceforge.net/p/gnuplot/patches/" rel="alternate"/><link href="https://sourceforge.net/p/gnuplot/patches/feed.atom" rel="self"/><id>https://sourceforge.net/p/gnuplot/patches/</id><updated>2026-03-20T17:42:49.904000Z</updated><subtitle>Recent changes to patches</subtitle><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#7522" rel="alternate"/><published>2026-03-20T17:42:49.904000Z</published><updated>2026-03-20T17:42:49.904000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net85e77d1d8b2e3f07bcf59ab91102ac77d8c18e9d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;: open --&amp;gt; pending-accepted&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#d365" rel="alternate"/><published>2026-03-20T17:42:35.225000Z</published><updated>2026-03-20T17:42:35.225000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net5c8c1a68839768c4b4e207cfe9a7c940c0e1f6ec</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Got it.&lt;br/&gt;
Thanks very much.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#ff71" rel="alternate"/><published>2026-03-20T14:43:59.208000Z</published><updated>2026-03-20T14:43:59.208000Z</updated><author><name>Sethur</name><uri>https://sourceforge.net/u/sethris/</uri></author><id>https://sourceforge.nete415bc62529f1a1ea39d1a83b03f382c29515700</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi &lt;a class="user-mention" href="/u/sfeam/profile/"&gt;@sfeam&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have attached a patch to gd.trm that adds a short description. It also includes my e-mail address, but feel free to remove it or list it exclusively if this otherwise collides with the aesthetics of the comment block.&lt;/p&gt;
&lt;p&gt;As overall commit message, I would suggest the following, but feel free to adapt it to your preferred length. I have not included new lines in the paragraphs intentionally, so you can conveniently add them were you want them.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;gd terminal:  antialiased thick lines, dash patterns, and transparent line support

Replace libgd's native thick-line rendering (which can suffers from staircasing and zebra-stripe artifacts) with a custom signed-distance-field rasterizer that supports four endcap modes (hard, butt, round, square).

Add general dash pattern support (TERM_CAN_DASH) with five built-in patterns matching the cairo terminal, plus custom dash patterns. A dash walker tracks position across PNG_vector calls so dashes follow polyline curves faithfully.  Join discs fill the wedge gap at angled polyline junctions.  A deferred endcap mechanism delays the final line cap until the path actually ends.

Introduce coordinate oversampling (initially set to 20×), matching pngcairo's approach so that sub-pixel precision is available for the SDF rasterizer and gnuplot's core layout calculations.  All libgd drawing calls convert inflated coordinates to pixel space at the API boundary.

Semi-transparent lines are rendered onto an offscreen alpha layer at full opacity using MAX compositing (most-opaque-wins), then blended onto the main image at the target alpha.  This eliminates the overlap darkening artifacts that occur when sub-segments are alpha-blended individually.

The "square" terminal option is added alongside "butt" and "rounded".
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Regarding the datablock.c temp file changes:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The patch does  not revert the Windows/MINGW temp file fallback, it just fixes some bugs in it. The code in &lt;code&gt;command.c&lt;/code&gt; was already correct and did not need changes. The Windows fallback block in &lt;code&gt;datablock.c&lt;/code&gt; (&lt;code&gt;save_set_to_datablock&lt;/code&gt;) had copy-paste errors, probably from when it was copied from &lt;code&gt;command.c&lt;/code&gt;. The broken code was:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;GetTempPathA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tempname&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="c1"&gt;// 'buf' does not exist in this function&lt;/span&gt;
&lt;span class="n"&gt;strcat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;"gnuplot-save.tmp"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;           &lt;/span&gt;&lt;span class="c1"&gt;// same — should be 'tempname'&lt;/span&gt;
&lt;span class="n"&gt;fp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tempname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;"wt+, ccs=UTF-8"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="c1"&gt;// 'tempname' was never filled; also dubious mode string&lt;/span&gt;
&lt;span class="n"&gt;fp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;"w+"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;                     &lt;/span&gt;&lt;span class="c1"&gt;// second fopen silently overwrites the first&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The local variable in &lt;code&gt;datablock.c&lt;/code&gt; is called &lt;code&gt;tempname&lt;/code&gt;, but the code referenced &lt;code&gt;buf&lt;/code&gt; (which is the variable name used in the &lt;code&gt;command.c&lt;/code&gt; version). There were also two conflicting &lt;code&gt;fopen()&lt;/code&gt; calls.&lt;/p&gt;
&lt;p&gt;The patch just fixes this by:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fixing the variable name, making  all references now consistently use &lt;code&gt;tempname&lt;/code&gt;:&lt;/li&gt;
&lt;li&gt;Adding the missing  &lt;code&gt;#include &amp;lt;windows.h&amp;gt;&lt;/code&gt; (guarded by &lt;code&gt;#ifdef _WIN32&lt;/code&gt;), which is needed for &lt;code&gt;GetTempPathA&lt;/code&gt; and &lt;code&gt;PATH_MAX&lt;/code&gt; to resolve on Windows.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The corresponding code in &lt;code&gt;command.c&lt;/code&gt; already uses &lt;code&gt;buf&lt;/code&gt; consistently and includes the necessary headers. It compiles and works correctly as-is, so no changes were needed there.&lt;/p&gt;
&lt;p&gt;I did a little research whether the tempfile fallback on Windows is still needed, and yes, apparently. &lt;code&gt;tmpfile()&lt;/code&gt; on Windows has been broken since Vista/Windows 7. It attempts to create a file in the root of the system drive, which will fail without elevated privileges. Both fallback blocks (in &lt;code&gt;datablock.c&lt;/code&gt; and &lt;code&gt;command.c&lt;/code&gt;) are still needed.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#8456" rel="alternate"/><published>2026-03-19T18:07:17.273000Z</published><updated>2026-03-19T18:07:17.273000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net91e00a070e10e2870bf57678d1ae37d26dd387cf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am truly impressed by the quality of the output.&lt;br/&gt;
Let's go with this version.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Could you provide one more patch to apply on top of this to give yourself credit at the top of gd.trm for this major revision (a line or two to summary the work very briefly)?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Also it would be nice if you provide an overall description to use as a commit message when I add it to the git repository.  I could write something myself but you obviously know better than I do how to properly describe it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;What should the author credit of the commit read - "Sethur &lt;a href="mailto:sethris@users.sf.net"&gt;sethris@users.sf.net&lt;/a&gt;" or something else?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Tangential question: your patches contain a change to datablock.c that seems to revert a previous Windows/MINGW  specific chunk of code to open a temp file.  This chunk of code was originally copied from command.c.  I'm not a Windows guy, so I have no idea whether either of these special-case code spots is still relevant or needed.  Did you find this revesion necessary on your systems?  Did you have to change the code in command.c also?   &lt;/p&gt;
&lt;p&gt;I still think the gdlib library itself would benefit from this work.  I encourage you to think about contributing there eventually.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#5a18" rel="alternate"/><published>2026-03-18T21:20:03.664000Z</published><updated>2026-03-18T21:20:03.664000Z</updated><author><name>Sethur</name><uri>https://sourceforge.net/u/sethris/</uri></author><id>https://sourceforge.net508fb5a76b99981ff783d0f97d8caeee038eb4ed</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Update and patch:&lt;/p&gt;
&lt;p&gt;Looking at the graphs above it was clear that something was wrong with the disk/clipped-disk (depending on the endcaps) join rendering at positions with high curvature in the sinc curves (mainly at the bottom part of the valleys). This had nothing to do with the empty-canvas rendering patch I was testing but came down to a bug in the original patch where I used integer pixel coordinate instead of pixel centers in PNG_draw_join_disc. Also, there was another bug in PNG_draw_join_disc where the alpha value was passed with libgd range convention (0-127) to PNG_SetAAPixelColor, which was expecting 0-255. This compressed the AA gradient to half the width, making the problem worse.&lt;/p&gt;
&lt;p&gt;Both issues are fixed now. I have run the demo scripts again and found no further immediately obvious issues. I have included a new benchmark of the demo scripts (only for Linux this time, but I can do Windows as well if necessary).&lt;/p&gt;
&lt;p&gt;In the demo scripts whose output is shown below for pngcairo and png with the new patch, I deliberately used a low sample rate to create a situation where the issue was clearly visible before.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#1389" rel="alternate"/><published>2026-03-17T13:46:56.783000Z</published><updated>2026-03-17T13:46:56.783000Z</updated><author><name>Sethur</name><uri>https://sourceforge.net/u/sethris/</uri></author><id>https://sourceforge.net6acb0fb5932089ff5be831ccf9e50549cf293b3e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi &lt;a class="user-mention" href="/u/sfeam/profile/"&gt;@sfeam&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;just wanted to tell you that I have a working solution for the transparency issue that uses the approach of rendering each line to a blank canvas that you have proposed. I will benchmark this again and check all the demo scripts for any regressions. If all goes well, I should be able to post a patch here soon.&lt;/p&gt;
&lt;p&gt;Attached is a test script for transparent lines and it's output.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#61e4/513c" rel="alternate"/><published>2026-03-15T22:00:04.563000Z</published><updated>2026-03-15T22:00:04.563000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net2648e0127dcf42b9d7fed51410e9d0e55fd89aa0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes there have been problems with thick lines all along.  Left to itself, libgd does a really poor job with them.  So gnuplot draws a thick line by filling a circular area around each point along the line. This is done by drawing the line with gdImageSetBrush() and a brush constructed to be the width requested for the line.  And, as you say, this causes transparent thick lines to be way less transparent than requested because every single point leads to overlaps.   So yes there is extra darkening at points where the curve crosses over itself. But unlike your dashed line algorithm, the darkening due to overlap is uniform everywhere &lt;em&gt;else&lt;/em&gt; along the line since the overlap arises at each point along the line, not just near the segment endpoints.&lt;/p&gt;
&lt;p&gt;And hmm, this leads me to realize that the current code could be improved by modifying the alpha component of thick lines by making transparency proportional to the line thickness.  I will try that!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#61e4" rel="alternate"/><published>2026-03-15T20:10:05.317000Z</published><updated>2026-03-15T20:10:05.317000Z</updated><author><name>Sethur</name><uri>https://sourceforge.net/u/sethris/</uri></author><id>https://sourceforge.net4711ea1a2109fdd553ac4ee0b15c6e10416e7d15</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;My bad, I wasn't aware that one could even choose the alpha value for line colors in Gnuplot, but apparently, this was implemented quite some time ago.&lt;/p&gt;
&lt;p&gt;I will see if I can come up with a solution for that. Your suggestion of redering everything on a blank canvas sounds reasonable.&lt;/p&gt;
&lt;p&gt;As a side note: Didn't the old libgd terminal also have this issue, at least with thick lines where overlaps should have happened before when rendering the segments?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#46f2/ff26" rel="alternate"/><published>2026-03-15T03:41:41.526000Z</published><updated>2026-03-15T03:41:41.526000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.netd74f7efdf3ca9598ad2dbb4ca952c7e83c1b57af</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;No need to attach output.  It's actually easier for me to test with kittycairo vs kittygd. That way I can run a test in side-by-side windows to compare the png and gd output rather than collecting and pairing up separate output files for display.&lt;/p&gt;
&lt;p&gt;I'll probably apply this version after going over the code to see if there's anything that can be tightened up or abstracted.&lt;/p&gt;
&lt;p&gt;The quality of the output is very good, with one exception that is not a deal-breaker.   The algorithm used here has the imperfection that when drawing with a partially transparent line color (non-zero alpha channel),  the alpha-blending is done separately for each segment of the curve rather than once for the whole curve.  That means it is applied multiple times to some pixels wherever the curve crosses itself or where it is composed of overlapping shorter segments.  This results in a blotchy line rather than smooth transparency.  This fault exists in other terminals also (although not in cairo).&lt;br/&gt;
FWIW this could be avoided by first rendering with a solid-color line onto a blank canvas and then composing that entire canvas back onto the target image with the specified alpha blend parameter.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#833 Full dashtype support for libgd terminals and improved antialiasing quality</title><link href="https://sourceforge.net/p/gnuplot/patches/833/?limit=25#46f2" rel="alternate"/><published>2026-03-14T18:54:08.048000Z</published><updated>2026-03-14T18:54:08.048000Z</updated><author><name>Sethur</name><uri>https://sourceforge.net/u/sethris/</uri></author><id>https://sourceforge.net1f72940f9b87f3c06a15ca496866caa2f7661930</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If you are interested, I can upload the output of the demo scripts for the terminals: png (with patch), png (original) and pngcairo, but it would be quite large.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>