NativeImage Type
⚠ Process Availability: Main ✔ | Renderer ✔ | Utility ❌ | Exported ❌
Instance members
| Instance member |
Description
|
Full Usage:
this.addRepresentation (?scaleFactor, ?width, ?height, ?buffer, ?dataURL)
Parameters:
float
?width : int
?height : int
?buffer : Buffer
?dataURL : string
Modifiers: inline |
Add an image representation for a specific scale factor. This can be used to programmatically add different scale factor representations to an image. This can be called on empty images.
|
|
|
Full Usage:
this.getAspectRatio ?scaleFactor
Parameters:
float
Returns: float
Modifiers: inline |
The image's aspect ratio (width divided by height).If scaleFactor is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
|
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ A Buffer that stores C pointer to underlying native handle of the image. On macOS, a pointer to NSImage instance is returned.Notice that the returned pointer is a weak pointer to the underlying native image instead of a copy, so you must ensure that the associated nativeImage instance is kept around.
|
Full Usage:
this.getScaleFactors ()
Returns: float[]
Modifiers: inline |
An array of all scale factors corresponding to representations for a given NativeImage.
|
Full Usage:
this.getSize ?scaleFactor
Parameters:
float
Returns: Size
Modifiers: inline |
If scaleFactor is passed, this will return the size corresponding to the image representation most closely matching the passed value.
|
Full Usage:
this.isEmpty ()
Returns: bool
Modifiers: inline |
Whether the image is empty.
|
Full Usage:
this.isMacTemplateImage
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ A boolean property that determines whether the image is considered a template image.Please note that this property only has an effect on macOS. |
Full Usage:
this.isTemplateImage ()
Returns: bool
Modifiers: inline |
Whether the image is a macOS template image.
|
Full Usage:
this.resize (?width, ?height, ?quality)
Parameters:
int
?height : int
?quality : Quality
Returns: NativeImage
Modifiers: inline |
The resized image.If only the height or the width are specified then the current aspect ratio will be preserved in the resized image.
|
Full Usage:
this.setTemplateImage option
Parameters:
bool
Modifiers: inline |
Marks the image as a macOS template image.
|
Full Usage:
this.toBitmap ?scaleFactor
Parameters:
float
Returns: Buffer
Modifiers: inline |
A Buffer that contains a copy of the image's raw bitmap pixel data.
|
Full Usage:
this.toDataURL ?scaleFactor
Parameters:
float
Returns: string
Modifiers: inline |
The Data URL of the image.
|
|
|
Full Usage:
this.toPNG ?scaleFactor
Parameters:
float
Returns: Buffer
Modifiers: inline |
fable-electron-docs-api