Skip to content

Commit 538a08a

Browse files
arunjose696HeikoKlare
authored andcommitted
Clarify linear scaling in ImageDataProvider contract
Clarify in the contract that ImageDataProvider implementations are expected to return linearly scaled ImageData based on the zoom level.
1 parent 9620d00 commit 538a08a

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageDataProvider.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,31 @@ public interface ImageDataProvider {
2828

2929
/**
3030
* Returns the image data for the given zoom level.
31-
* <p>
32-
* If no image is available for a particular zoom level, this method should
33-
* return <code>null</code>. For <code>zoom == 100</code>, returning
34-
* <code>null</code> is not allowed, and SWT will throw an exception.
31+
*
32+
* <ul>
33+
* <li>
34+
* If no image is available for a particular zoom level, this method should
35+
* return <code>null</code>. For <code>zoom == 100</code>, returning
36+
* <code>null</code> is not allowed, and SWT will throw an exception.
37+
* </li>
38+
* <li>
39+
* Implementations are expected to return {@link ImageData} that is
40+
* <b>linearly scaled</b> with respect to the zoom level.
41+
* For example, if <code>getImageData(100)</code> returns an image of
42+
* width <code>w</code> and height <code>h</code>, then
43+
* <code>getImageData(200)</code> must return an {@link ImageData}
44+
* of width <code>2 * w</code> and height <code>2 * h</code>,
45+
* if a non-{@code null} result is returned.
46+
* </li>
47+
* </ul>
48+
*
3549
*
3650
* @param zoom
3751
* The zoom level in % of the standard resolution (which is 1
3852
* physical monitor pixel == 1 SWT logical point). Typically 100,
3953
* 150, or 200.
40-
* @return the image data, or <code>null</code> if <code>zoom != 100</code>
54+
* @return the linearly scaled image data for the given zoom level,
55+
* or <code>null</code> if <code>zoom != 100</code>
4156
* and no image is available for the given zoom level.
4257
* @since 3.104
4358
*/

0 commit comments

Comments
 (0)