Package org.eclipse.jface.resource
Class CompositeImageDescriptor.CachedImageDataProvider
java.lang.Object
org.eclipse.jface.resource.CompositeImageDescriptor.CachedImageDataProvider
- All Implemented Interfaces:
ImageDataProvider
- Enclosing class:
- CompositeImageDescriptor
@NoExtend
protected abstract class CompositeImageDescriptor.CachedImageDataProvider
extends Object
implements ImageDataProvider
An
ImageDataProvider
that caches the most recently returned
ImageData
object. I.e. consecutive calls to
ImageDataProvider.getImageData(int)
with the same zoom level are cheap.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
computeInPoints
(ToIntFunction<ImageData> function) Returns a computed value in SWT logical points.int
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
-
Constructor Details
-
CachedImageDataProvider
protected CachedImageDataProvider()
-
-
Method Details
-
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
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
-