InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IImageCacheMgr Class Referenceabstract

#include <IImageCacheMgr.h>

Inheritance diagram for IImageCacheMgr:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IIMAGECACHEMGR }
 
enum  {
  kWildCard = 0, kRasterImage = 1, kAlphaMask = 2, kLinkThumbnail = 4,
  kUncalibratedRasterImage = 5, kXP_DSH_PI = 10, kXP_DSH_ST = 11, kXP_DSH_FI = 12,
  kXP_DSH_CT = 13, kXP_ISH_PI = 14, kXP_ISH_ST = 15, kXP_ISH_FI = 16,
  kXP_ISH_CT = 17, kXP_OGL_PI = 18, kXP_OGL_ST = 19, kXP_OGL_FI = 20,
  kXP_OGL_CT = 21, kXP_IGL_PI = 22, kXP_IGL_ST = 23, kXP_IGL_FI = 24,
  kXP_IGL_CT = 25, kXP_BE1_PI = 26, kXP_BE1_ST = 27, kXP_BE1_FI = 28,
  kXP_BE1_CT = 29, kXP_BE2_PI = 30, kXP_BE2_ST = 31, kXP_BE2_FI = 32,
  kXP_BE2_CT = 33, kXP_BE3_PI = 34, kXP_BE3_ST = 35, kXP_BE3_FI = 36,
  kXP_BE3_CT = 37, kXP_BE4_PI = 38, kXP_BE4_ST = 39, kXP_BE4_FI = 40,
  kXP_BE4_CT = 41, kXP_SAT_PI = 42, kXP_SAT_ST = 43, kXP_SAT_FI = 44,
  kXP_SAT_CT = 45, kXP_FTH_PI = 46, kXP_FTH_ST = 47, kXP_FTH_FI = 48,
  kXP_FTH_CT = 49, kXP_DRF_PI = 50, kXP_DRF_ST = 51, kXP_DRF_FI = 52,
  kXP_DRF_CT = 53, kXP_GRF_PI = 54, kXP_GRF_ST = 55, kXP_GRF_FI = 56,
  kXP_GRF_CT = 57
}
 

Public Member Functions

virtual ErrorCode Add (const UIDRef &imageRef, IImageCache *cache, bool8 purgeFirst=kFalse, uint32 selector=kRasterImage)=0
 
virtual uint32 Purge (const UIDRef &imageRef, IImageCache *cache)=0
 
virtual uint32 Purge (const UIDRef &imageRef, const PMReal &resolution, uint32 selector=kWildCard)=0
 
virtual uint32 Purge (const UIDRef &imageRef, uint32 selector=kWildCard)=0
 
virtual uint32 Purge (const IDataBase *db, uint32 selector=kWildCard)=0
 
virtual uint32 GetSize (void) const =0
 
virtual bool16 GetClosestMatchResolution (const UIDRef &imageRef, PMReal &resolution, uint32 selector=kRasterImage, uint32 *selectorFound=nil) const =0
 
virtual IImageCacheQueryClosestResolution (const UIDRef &imageRef, const PMReal &resolution, uint32 selector=kRasterImage, uint32 *selectorFound=nil)=0
 
virtual IImageCacheQueryPreviousResolution (const UIDRef &imageRef, const IImageCache &currentCache, uint32 selector=kRasterImage, uint32 *selectorFound=nil)=0
 
virtual IImageCacheQueryNextResolution (const UIDRef &imageRef, const IImageCache &currentCache, uint32 selector=kRasterImage, uint32 *selectorFound=nil)=0
 
virtual IImageCacheResample (const UIDRef &imageRef, uint32 srcSelector, uint32 dstSelector, const PMReal &resToResampleFrom, const PMReal &resToResampleTo, IImageStreamManager::ResamplingType &sampleType, bool32 bForceNonVirtual=kFalse)=0
 
virtual void SetMaxSize (uint32 kiloBytes)=0
 
virtual void PurgeMemory (int32 level, bool16 inGrowZone)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

IImageCacheMgr Description: The IImageCacheMgr is used to store 1 or more in-memory raster images for a given page item. Image's are identified by a UIDRef, resolution and a 32-bit selector. The IImageCacheMgr makes it easy for the Draw method of an IShape implementation to store caches at various resolutions for its page item and easily retrieve them. One major benefit of the IImageCacheMgr is that it allows copies of page items to easily share caches. It also has the ability to serialize caches to temp files in low memory situations without forcing the client to reconstruct the cache from scratch.

Member Enumeration Documentation

anonymous enum

Selectors enumeration

Member Function Documentation

virtual ErrorCode IImageCacheMgr::Add (const UIDRefimageRef,
IImageCachecache,
bool8 purgeFirst = kFalse,
uint32 selector = kRasterImage 
)
pure virtual

Add Add a cache to the list along with information about the size of the cache and the amount of time needed to compute the cache. cache->AddRef() will be called. purgeFirst signals the IImageCacheMgr that it should remove this item first during a PurgeMemory() call.

Parameters
imageRef- IN: the UIDRef of the page item.
cache- IN: the cache to add.
purgeFirst- IN: A hint to the memory management system that it is okay to purge this cache first as it is being used for a short term purpose.
selector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item.
virtual bool16 IImageCacheMgr::GetClosestMatchResolution (const UIDRefimageRef,
PMRealresolution,
uint32 selector = kRasterImage,
uint32 * selectorFound = nil 
) const
pure virtual

Return the resolution of the IImageCache which would be returned via QueryClosestResolution(). This call avoids add-refing of the IImageCache and keeps it out of any LRU lists. Returns kTrue if an image is found.

Parameters
imageRef- IN: the UIDRef of the page item.
resolution- IN/OUT: On input, the desired resolution. On output, the actual resolution found.
selector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item.
selectorFound- OUT: Optional. If non-nil and a cache is found, the selector of the cache is returned.
Returns
kTrue if a cache is found, kFalse otherwise.
virtual uint32 IImageCacheMgr::GetSize (void ) const
pure virtual

Get the total size of the image caches tracked by the IImageCacheMgr

virtual uint32 IImageCacheMgr::Purge (const UIDRefimageRef,
IImageCachecache 
)
pure virtual

Purge an image cache and call cache->Release().

Returns
Return amount of memory purged.
virtual uint32 IImageCacheMgr::Purge (const UIDRefimageRef,
const PMRealresolution,
uint32 selector = kWildCard 
)
pure virtual

Purge all caches matching the given imageRef, resolution and selector.

Returns
Return amount of memory purged.
virtual uint32 IImageCacheMgr::Purge (const UIDRefimageRef,
uint32 selector = kWildCard 
)
pure virtual

Purge all image caches associated with the given imageRef.

Returns
Return amount of memory purged.
virtual uint32 IImageCacheMgr::Purge (const IDataBasedb,
uint32 selector = kWildCard 
)
pure virtual

Purge all image caches associated with the given db.

Returns
Return amount of memory purged.
virtual void IImageCacheMgr::PurgeMemory (int32 level,
bool16 inGrowZone 
)
pure virtual

Purge routine registered with the memory manager which uses heuristics to purge image caches.

virtual IImageCache* IImageCacheMgr::QueryClosestResolution (const UIDRefimageRef,
const PMRealresolution,
uint32 selector = kRasterImage,
uint32 * selectorFound = nil 
)
pure virtual

Find the closest resolution which is greater than or equal to the requested resolution. If one cannot be found, then find the first resolution which is less than the requested resolution. If a cache for the given imageRef cannot be found, then nil is returned.

Parameters
imageRef- IN: the UIDRef of the page item.
resolution- IN: the desired resolution.
selector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item.
selectorFound- OUT: Optional. If non-nil and a cache is found, the selector of the cache is returned.
Returns
The image cache matching the input parameters or nil if one is not found.
virtual IImageCache* IImageCacheMgr::QueryNextResolution (const UIDRefimageRef,
const IImageCachecurrentCache,
uint32 selector = kRasterImage,
uint32 * selectorFound = nil 
)
pure virtual

Given an imageRef and an image cache, find the next largest resolution cache for the same image

Parameters
imageRef- IN: the UIDRef of the page item.
currentCache- IN: tells the IImageCacheMgr to look relative to this cache.
selector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item.
selectorFound- OUT: Optional. If non-nil and a cache is found, the selector of the cache is returned.
Returns
The image cache matching the input parameters or nil if one is not found.
virtual IImageCache* IImageCacheMgr::QueryPreviousResolution (const UIDRefimageRef,
const IImageCachecurrentCache,
uint32 selector = kRasterImage,
uint32 * selectorFound = nil 
)
pure virtual

Given an imageRef and an image cache, find the next smallest resolution cache for the same image

Parameters
imageRef- IN: the UIDRef of the page item.
currentCache- IN: tells the IImageCacheMgr to look relative to this cache.
selector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item.
selectorFound- OUT: Optional. If non-nil and a cache is found, the selector of the cache is returned.
Returns
The image cache matching the input parameters or nil if one is not found.
virtual IImageCache* IImageCacheMgr::Resample (const UIDRefimageRef,
uint32 srcSelector,
uint32 dstSelector,
const PMRealresToResampleFrom,
const PMRealresToResampleTo,
IImageStreamManager::ResamplingTypesampleType,
bool32 bForceNonVirtual = kFalse 
)
pure virtual

Resample an existing cache to create a lower resolution cache.

Parameters
imageRef- IN: the UIDRef of the page item.
srcSelector- IN: Another key. This key allows the client to store different types of caches. For example, you may have a color managed version, an uncalibrated version, a drop shadow mask and an alpha mask all at the same resolution for a given page item. The srcSelector is used to help identify the source image from which we will resample.
dstSelector- IN: The resulting cache will be added to the ImageCacheMgr using dstSelector as a key. Typically, the dstSelector is the same as the srcSelector.
resToResampleFrom- IN: The source resolution. This parameter is used as another key for identifying the source image cache.
resToResampleTo- IN: The destination resolution.
sampleType- IN/OUT: On input, the desired resampling type. For non-virtual images, AGM does the resampling and they support 2 kinds: Bicubic and Dowsampling (averaging). Therefore, on if AGM is used to resample the image and Subsampling is chosen, Downsampling will be used instead (which is of higher quality than Subsampling but slower). On return, therefore, this parameter will be set to the actual sampling method used.
bForceNonVirtual- IN: If the source image is virtual, the typical result of downsampling is another virtual image which will downsample from the original EVERY time it is drawn. If this cache is going to be used to draw to the screen and will be drawn multiple times, then assuming you have enough memory, it is more optimal to convert the image to a non-virtual image. If after conversion the application gets low on memory, the ImageCacheMgr will serialize the image to disk.
Returns
The resampled image cache matching the input parameters. Note that the resulting cache will automatically be added to the ImageCacheMgr.
virtual void IImageCacheMgr::SetMaxSize (uint32 kiloBytes)
pure virtual

OBSOLETE Set a maximum amount of memory which can be used by IImageCaches in kilobytes.