# 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.

Since:
  3.13
See Also:
  - `CompositeImageDescriptor.createCachedImageDataProvider(Image)`
  - `CompositeImageDescriptor.createCachedImageDataProvider(ImageDescriptor)`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`CachedImageDataProvider()`

## Method Summary

Modifier and Type
Method
Description
`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 Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface ImageDataProvider

`getImageData`

## Constructor Details

### CachedImageDataProvider

protected CachedImageDataProvider()

## Method Details

### 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