Skip to content

Commit 3e2625a

Browse files
HeikoKlarefedejeanne
authored andcommitted
Add N&N for new image constructor
This contributes an N&N for the new image constructor for programmatically created, dynamically scaling images as required for enhanced UI scaling mechanisms, as contributed via eclipse-platform/eclipse.platform.swt#1734
1 parent 172013f commit 3e2625a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

news/4.35/platform_isv.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,38 @@ <h2>Platform and Equinox API</h2>
4343
<!-- *********************** SWT *********************** -->
4444
<tr>
4545
<td id="SWT" class="section" colspan="2"><h2>SWT Changes</h2></td>
46+
<tr id="imageConstructorGcDrawer"> <!-- https://github.com/eclipse-platform/eclipse.platform.swt/pull/1734 -->
47+
<td class="title">Constructor for Dynamically Scaled, Custom-Drawn Image</td>
48+
<td class="content">
49+
<p>
50+
The <code>Image</code> class provides a constructor for creating an empty image based on a concrete size,
51+
which is then usually filled programmatically via a <code>GC</code>. Such an image will be created according to a
52+
fixed zoom value. When the image is requested in a different zoom via <code>getImageData(zoom)</code>, the
53+
image will be raster-scaled, leading to blurry results.
54+
</p>
55+
<p>
56+
The API has been extended as follows to address this limitation:
57+
<ul>
58+
<li>
59+
A new constructor has been added to the <code>Image</code> class:<br>
60+
<code>Image(Device device, ImageGcDrawer imageGcDrawer, int width, int height)</code><br>
61+
<li>
62+
The constructor accepts implementations of <code>ImageGcDrawer</code> defining the method:<br>
63+
<code>drawOn(GC gc, int imageWidth, int imageHeight)</code>
64+
</li>
65+
</ul>
66+
</p>
67+
<p>
68+
Such an image will call <code>imageGcDrawer.drawOn(...)</code> whenever the image data for a different
69+
zoom is requested to generate that data in a size as required for the specified zoom.
70+
</p>
71+
<p>
72+
To be prepared for enhanced UI scaling mechanisms, such as the monitor-specific scaling feature on windows (see <a
73+
href="platform.php#rescaleOnRuntimePreference">this news</a>), this new constructor should be
74+
preferred for programmatic creation of images instead of the existing constructors using a fixed size.
75+
</p>
76+
</td>
77+
</tr>
4678
</tr>
4779
<!-- *********************** End of SWT *********************** -->
4880
<tr><td colspan="2"/></tr>

0 commit comments

Comments
 (0)