Package org.eclipse.jface.resource
Class CompositeImageDescriptor.CachedImageDataProvider
- java.lang.Object
-
- org.eclipse.jface.resource.CompositeImageDescriptor.CachedImageDataProvider
-
- All Implemented Interfaces:
ImageDataProvider
- Enclosing class:
- CompositeImageDescriptor
protected abstract class CompositeImageDescriptor.CachedImageDataProvider extends Object implements ImageDataProvider
AnImageDataProvider
that caches the most recently returnedImageData
object. I.e. consecutive calls toImageDataProvider.getImageData(int)
with the same zoom level are cheap.- Since:
- 3.13
- See Also:
CompositeImageDescriptor.createCachedImageDataProvider(Image)
,CompositeImageDescriptor.createCachedImageDataProvider(ImageDescriptor)
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CachedImageDataProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeInPoints(ToIntFunction<ImageData> function)
Returns a computed value in SWT logical points.int
getHeight()
Returns theImageData.height
in points.int
getWidth()
Returns theImageData.width
in points.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.swt.graphics.ImageDataProvider
getImageData
-
-
-
-
Method Detail
-
getWidth
public int getWidth()
Returns theImageData.width
in points. This method must only be called within the dynamic scope of a call toCompositeImageDescriptor.drawCompositeImage(int, int)
.- Returns:
- the width in points
-
getHeight
public int getHeight()
Returns theImageData.height
in points. This method must only be called within the dynamic scope of a call toCompositeImageDescriptor.drawCompositeImage(int, int)
.- Returns:
- the height in points
-
computeInPoints
public int computeInPoints(ToIntFunction<ImageData> function)
Returns a computed value in SWT logical points. The given function computes a value in pixels, based on information from the given ImageData, which is also in pixels. This method must only be called within the dynamic scope of a call toCompositeImageDescriptor.drawCompositeImage(int, int)
.- Parameters:
function
- a function that takes anImageData
and computes a value in pixels- Returns:
- the computed value in points
-
-