cupertino-files / ImageModel
Class: ImageModel
Defined in: src/tsd/images.ts:82
Extends
Constructors
Constructor
new ImageModel(
store,object):ImageModel
Defined in: src/tsd/images.ts:83
Parameters
store
object
Returns
ImageModel
Overrides
Properties
object
readonlyobject:IwaObject
Defined in: src/tsd/drawables.ts:75
Inherited from
store
readonlystore:ObjectStore
Defined in: src/tsd/drawables.ts:74
Inherited from
Accessors
accessibilityDescription
Get Signature
get accessibilityDescription():
string|undefined
Defined in: src/tsd/drawables.ts:148
Returns
string | undefined
Set Signature
set accessibilityDescription(
value):void
Defined in: src/tsd/drawables.ts:152
Parameters
value
string | undefined
Returns
void
Inherited from
DrawableModel.accessibilityDescription
dataId
Get Signature
get dataId():
bigint|undefined
Defined in: src/tsd/images.ts:91
Data-space identifier of the primary backing media, if any.
Returns
bigint | undefined
fileName
Get Signature
get fileName():
string|undefined
Defined in: src/tsd/images.ts:123
File name of the primary backing media within Data/.
Note this is TSP.DataInfo.file_name when set (the real on-disk name, which the apps disambiguate by appending the data identifier), falling back to preferred_file_name.
Returns
string | undefined
hasFilters
Get Signature
get hasFilters():
boolean
Defined in: src/tsd/images.ts:284
True when any image filter is applied.
Returns
boolean
hasMask
Get Signature
get hasMask():
boolean
Defined in: src/tsd/images.ts:176
True when the image is clipped by a mask (shape crop / instant alpha).
Returns
boolean
hyperlinkUrl
Get Signature
get hyperlinkUrl():
string|undefined
Defined in: src/tsd/drawables.ts:144
Returns
string | undefined
Inherited from
id
Get Signature
get id():
bigint
Defined in: src/tsd/drawables.ts:82
Returns
bigint
Inherited from
isMaterialized
Get Signature
get isMaterialized():
boolean
Defined in: src/tsd/images.ts:134
True when the primary media is actually present in the package. Apple documents can reference media that was never materialized (optimized storage, template assets); those images render in the app but have no bytes to extract here.
Returns
boolean
originalSize
Get Signature
get originalSize(): {
height:number;width:number; } |undefined
Defined in: src/tsd/images.ts:168
Intrinsic pixel size recorded by the app, if present.
Returns
{ height: number; width: number; } | undefined
type
Get Signature
get type():
number
Defined in: src/tsd/drawables.ts:86
Returns
number
Inherited from
typeName
Get Signature
get typeName():
string|undefined
Defined in: src/tsd/drawables.ts:90
Returns
string | undefined
Inherited from
Methods
clearFilters()
clearFilters():
void
Defined in: src/tsd/images.ts:327
Remove all image filters, restoring the unadjusted rendering.
Returns
void
crop()
crop():
ImageCrop|undefined
Defined in: src/tsd/images.ts:194
The crop, in both the spaces that matter.
window is the visible rectangle in the image's own coordinates — which part of the picture shows. visible is where that lands in the image's parent, which is image.position + mask.position (see docs/FORMAT.md §8.2). An uncropped image has no crop at all.
Returns
ImageCrop | undefined
data()
data():
Uint8Array<ArrayBufferLike> |undefined
Defined in: src/tsd/images.ts:151
Raw bytes of the backing media. Falls back to any other materialized variant (original/adjusted/enhanced/thumbnail) when the primary is not present in the package; dataSource() reports which one was used.
Returns
Uint8Array<ArrayBufferLike> | undefined
dataSource()
dataSource(): {
dataId:bigint;fileName:string|undefined;role:string; } |undefined
Defined in: src/tsd/images.ts:160
Which media variant data would return, if any.
Returns
{ dataId: bigint; fileName: string | undefined; role: string; } | undefined
dataVariants()
dataVariants():
object[]
Defined in: src/tsd/images.ts:100
Every media variant this image references, in preference order: the primary image, then the original, adjusted, enhanced and thumbnail variants the apps keep alongside it.
Returns
object[]
filters()
filters():
ImageFilters
Defined in: src/tsd/images.ts:289
Current image-filter settings ({} when none are applied).
Returns
geometry()
geometry():
GeometryInfo|undefined
Defined in: src/tsd/drawables.ts:98
Returns
GeometryInfo | undefined
Inherited from
mask()
mask():
MaskModel|undefined
Defined in: src/tsd/images.ts:181
The mask drawable defining the crop, if the image has one.
Returns
MaskModel | undefined
removeCrop()
removeCrop():
boolean
Defined in: src/tsd/images.ts:273
Show the whole picture again.
The mask object is left in the package — something else may reference it, and this library never collects the graph — but the image no longer points at it, so the full extent shows at the image's own frame. That frame is larger than the crop was, which is the point.
Returns
boolean
setCrop()
setCrop(
window):void
Defined in: src/tsd/images.ts:229
Choose which part of the picture shows, in image-local points.
The visible rectangle moves with the window: cropping to {x: 10, …} shifts what appears on the page 10pt right, because the window is positioned relative to the image. To keep the result where it was, call setVisibleFrame afterwards — or use it instead, which does both.
An image with no mask gets one, built as the rectangle Apple writes.
Parameters
window
Returns
void
setFilters()
setFilters(
filters):void
Defined in: src/tsd/images.ts:307
Apply image filters. Only the properties given are changed; pass undefined for a property to clear it. The apps re-render from the untouched original media, so this is non-destructive.
Parameters
filters
Returns
void
setGeometry()
setGeometry(
update):void
Defined in: src/tsd/drawables.ts:115
Move and/or resize. Only the provided components are changed.
Parameters
update
angle?
number
height?
number
width?
number
x?
number
y?
number
Returns
void
Inherited from
setVisibleFrame()
setVisibleFrame(
frame):void
Defined in: src/tsd/images.ts:255
Place the cropped result at a rectangle in the parent's space.
Keeps the same part of the picture visible: the image slides so that image.position + mask.position lands on frame, and the window is resized in place. This is the operation "move and resize the cropped image", as opposed to setCrop's "choose what shows".
Parameters
frame
Returns
void
style()
style():
DrawableStyleHandle|undefined
Defined in: src/tsd/drawables.ts:166
Visual style — fill, stroke, opacity, shadow, reflection.
This is where drawable shadows live. Cell and table styles have no shadow field at all, so a shadow on a table means a shadow on the shape or image, not on its cells.
Returns
DrawableStyleHandle | undefined