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

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.

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
`protected` `CachedImageDataProvider()`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `computeInPoints(ToIntFunction<ImageData> function)` Returns a computed value in SWT logical points.
`int` `getHeight()` Returns the `ImageData.height` in points.
`int` `getWidth()` Returns the `ImageData.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 Detail

#### CachedImageDataProvider

    protected CachedImageDataProvider()

### Method Detail

#### getWidth

    public int getWidth()

Returns the `ImageData.width` in points. This method must only be called within the dynamic scope of a call to `CompositeImageDescriptor.drawCompositeImage(int, int)`.

Returns:
  the width in points

#### getHeight

    public int getHeight()

Returns the `ImageData.height` in points. This method must only be called within the dynamic scope of a call to `CompositeImageDescriptor.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 to `CompositeImageDescriptor.drawCompositeImage(int, int)`.

Parameters:
  `function` - a function that takes an `ImageData` and computes a value in pixels
Returns:
  the computed value in points