@@ -116,37 +116,6 @@ public static Optional<AutoScaleMethod> forString(String s) {
116116 autoScaleMethod = AUTO_SCALE_METHOD_SETTING != AutoScaleMethod .AUTO ? AUTO_SCALE_METHOD_SETTING : AutoScaleMethod .NEAREST ;
117117 }
118118
119- /**
120- * Auto-scale down ImageData
121- */
122- public static ImageData autoScaleDown (Device device , final ImageData imageData ) {
123- if (deviceZoom == 100 || imageData == null || (device != null && !device .isAutoScalable ())) return imageData ;
124- float scaleFactor = 1.0f / getScalingFactor (deviceZoom );
125- return autoScaleImageData (device , imageData , scaleFactor );
126- }
127-
128- public static int [] autoScaleDown (int [] pointArray ) {
129- if (deviceZoom == 100 || pointArray == null ) return pointArray ;
130- float scaleFactor = getScalingFactor (deviceZoom );
131- int [] returnArray = new int [pointArray .length ];
132- for (int i = 0 ; i < pointArray .length ; i ++) {
133- returnArray [i ] = Math .round (pointArray [i ] / scaleFactor );
134- }
135- return returnArray ;
136- }
137-
138- public static int [] autoScaleDown (Drawable drawable , int [] pointArray ) {
139- if (drawable != null && !drawable .isAutoScalable ()) return pointArray ;
140- return autoScaleDown (pointArray );
141- }
142-
143- /**
144- * Auto-scale down float array dimensions.
145- */
146- public static float [] autoScaleDown (float size []) {
147- return scaleDown (size , deviceZoom );
148- }
149-
150119public static float [] scaleDown (float size [], int zoom ) {
151120 if (zoom == 100 || size == null ) return size ;
152121 float scaleFactor = getScalingFactor (zoom );
@@ -157,75 +126,33 @@ public static float[] scaleDown(float size[], int zoom) {
157126 return scaledSize ;
158127}
159128
160- /**
161- * Auto-scale down float array dimensions if enabled for Drawable class.
162- */
163- public static float [] autoScaleDown (Drawable drawable , float size []) {
164- return scaleDown (drawable , size , deviceZoom );
165- }
166-
167129public static float [] scaleDown (Drawable drawable , float size [], int zoom ) {
168130 if (drawable != null && !drawable .isAutoScalable ()) return size ;
169131 return scaleDown (size , zoom );
170132}
171133
172- /**
173- * Auto-scale down int dimensions.
174- */
175- public static int autoScaleDown (int size ) {
176- return scaleDown (size , deviceZoom );
177- }
178-
179134public static int scaleDown (int size , int zoom ) {
180135 if (zoom == 100 || size == SWT .DEFAULT ) return size ;
181136 float scaleFactor = getScalingFactor (zoom );
182137 return Math .round (size / scaleFactor );
183138}
184139
185- /**
186- * Auto-scale down int dimensions if enabled for Drawable class.
187- */
188- public static int autoScaleDown (Drawable drawable , int size ) {
189- return scaleDown (drawable , size , deviceZoom );
190- }
191-
192140public static int scaleDown (Drawable drawable , int size , int zoom ) {
193141 if (drawable != null && !drawable .isAutoScalable ()) return size ;
194142 return scaleDown (size , zoom );
195143}
196144
197- /**
198- * Auto-scale down float dimensions.
199- */
200- public static float autoScaleDown (float size ) {
201- return scaleDown (size , deviceZoom );
202- }
203-
204145public static float scaleDown (float size , int zoom ) {
205146 if (zoom == 100 || size == SWT .DEFAULT ) return size ;
206147 float scaleFactor = getScalingFactor (zoom );
207148 return (size / scaleFactor );
208149}
209150
210- /**
211- * Auto-scale down float dimensions if enabled for Drawable class.
212- */
213- public static float autoScaleDown (Drawable drawable , float size ) {
214- return scaleDown (drawable , size , deviceZoom );
215- }
216-
217151public static float scaleDown (Drawable drawable , float size , int zoom ) {
218152 if (drawable != null && !drawable .isAutoScalable ()) return size ;
219153 return scaleDown (size , zoom );
220154}
221155
222- /**
223- * Returns a new scaled down Point.
224- */
225- public static Point autoScaleDown (Point point ) {
226- return scaleDown (point , deviceZoom );
227- }
228-
229156public static Point scaleDown (Point point , int zoom ) {
230157 if (zoom == 100 || point == null ) return point ;
231158 Point .OfFloat fPoint = FloatAwareGeometryFactory .createFrom (point );
@@ -235,35 +162,14 @@ public static Point scaleDown(Point point, int zoom) {
235162 return new Point .OfFloat (scaledX , scaledY );
236163}
237164
238- /**
239- * Returns a new scaled down Point if enabled for Drawable class.
240- */
241- public static Point autoScaleDown (Drawable drawable , Point point ) {
242- return scaleDown (drawable , point , deviceZoom );
243- }
244-
245165public static Point scaleDown (Drawable drawable , Point point , int zoom ) {
246166 if (drawable != null && !drawable .isAutoScalable ()) return point ;
247167 return scaleDown (point , zoom );
248168}
249169
250- /**
251- * Returns a new scaled down Rectangle.
252- */
253- public static Rectangle autoScaleDown (Rectangle rect ) {
254- return scaleDown (rect , deviceZoom );
255- }
256-
257170public static Rectangle scaleDown (Rectangle rect , int zoom ) {
258171 return scaleBounds (rect , 100 , zoom );
259172}
260- /**
261- * Returns a new scaled down Rectangle if enabled for Drawable class.
262- */
263- public static Rectangle autoScaleDown (Drawable drawable , Rectangle rect ) {
264- if (drawable != null && !drawable .isAutoScalable ()) return rect ;
265- return scaleDown (rect , deviceZoom );
266- }
267173
268174public static Rectangle scaleDown (Drawable drawable , Rectangle rect , int zoom ) {
269175 if (drawable != null && !drawable .isAutoScalable ()) return rect ;
@@ -342,17 +248,6 @@ public static ImageData autoScaleImageData (Device device, final ImageData image
342248 return autoScaleImageData (device , imageData , scaleFactor );
343249}
344250
345- /**
346- * Auto-scale up ImageData to device zoom that is at 100%.
347- */
348- public static ImageData autoScaleUp (Device device , final ImageData imageData ) {
349- return autoScaleImageData (device , imageData , 100 );
350- }
351-
352- public static int [] autoScaleUp (int [] pointArray ) {
353- return scaleUp (pointArray , deviceZoom );
354- }
355-
356251public static int [] scaleUp (int [] pointArray , int zoom ) {
357252 if (zoom == 100 || pointArray == null ) return pointArray ;
358253 float scaleFactor = getScalingFactor (zoom );
@@ -363,20 +258,10 @@ public static int[] scaleUp(int[] pointArray, int zoom) {
363258 return returnArray ;
364259}
365260
366- public static int [] autoScaleUp (Drawable drawable , int [] pointArray ) {
367- return scaleUp (drawable , pointArray , deviceZoom );
368- }
369-
370261public static int [] scaleUp (Drawable drawable , int [] pointArray , int zoom ) {
371262 if (drawable != null && !drawable .isAutoScalable ()) return pointArray ;
372263 return scaleUp (pointArray , zoom );
373264}
374- /**
375- * Auto-scale up int dimensions.
376- */
377- public static int autoScaleUp (int size ) {
378- return scaleUp (size , deviceZoom );
379- }
380265
381266/**
382267 * Auto-scale up int dimensions to match the given zoom level
@@ -387,44 +272,22 @@ public static int scaleUp(int size, int zoom) {
387272 return Math .round (size * scaleFactor );
388273}
389274
390- /**
391- * Auto-scale up int dimensions if enabled for Drawable class.
392- */
393- public static int autoScaleUp (Drawable drawable , int size ) {
394- return scaleUp (drawable , size , deviceZoom );
395- }
396-
397275public static int scaleUp (Drawable drawable , int size , int zoom ) {
398276 if (drawable != null && !drawable .isAutoScalable ()) return size ;
399277 return scaleUp (size , zoom );
400278}
401279
402- public static float autoScaleUp (float size ) {
403- return scaleUp (size , deviceZoom );
404- }
405-
406280public static float scaleUp (float size , int zoom ) {
407281 if (zoom == 100 || size == SWT .DEFAULT ) return size ;
408282 float scaleFactor = getScalingFactor (zoom );
409283 return (size * scaleFactor );
410284}
411285
412- public static float autoScaleUp (Drawable drawable , float size ) {
413- return scaleUp (drawable , size , deviceZoom );
414- }
415-
416286public static float scaleUp (Drawable drawable , float size , int zoom ) {
417287 if (drawable != null && !drawable .isAutoScalable ()) return size ;
418288 return scaleUp (size , zoom );
419289}
420290
421- /**
422- * Returns a new scaled up Point.
423- */
424- public static Point autoScaleUp (Point point ) {
425- return scaleUp (point , deviceZoom );
426- }
427-
428291public static Point scaleUp (Point point , int zoom ) {
429292 if (zoom == 100 || point == null ) return point ;
430293 Point .OfFloat fPoint = FloatAwareGeometryFactory .createFrom (point );
@@ -434,36 +297,15 @@ public static Point scaleUp(Point point, int zoom) {
434297 return new Point .OfFloat (scaledX , scaledY );
435298}
436299
437- /**
438- * Returns a new scaled up Point if enabled for Drawable class.
439- */
440- public static Point autoScaleUp (Drawable drawable , Point point ) {
441- return scaleUp (drawable , point , deviceZoom );
442- }
443-
444300public static Point scaleUp (Drawable drawable , Point point , int zoom ) {
445301 if (drawable != null && !drawable .isAutoScalable ()) return point ;
446302 return scaleUp (point , zoom );
447303}
448304
449- /**
450- * Returns a new scaled up Rectangle.
451- */
452- public static Rectangle autoScaleUp (Rectangle rect ) {
453- return scaleUp (rect , deviceZoom );
454- }
455-
456305public static Rectangle scaleUp (Rectangle rect , int zoom ) {
457306 return scaleBounds (rect , zoom , 100 );
458307}
459308
460- /**
461- * Returns a new scaled up Rectangle if enabled for Drawable class.
462- */
463- public static Rectangle autoScaleUp (Drawable drawable , Rectangle rect ) {
464- return scaleUp (drawable , rect , deviceZoom );
465- }
466-
467309public static Rectangle scaleUp (Drawable drawable , Rectangle rect , int zoom ) {
468310 if (drawable != null && !drawable .isAutoScalable ()) return rect ;
469311 return scaleUp (rect , zoom );
0 commit comments