QPixmap
The QPixmap class helps hold an image in the form of off-screen image representation.
This class is a JS wrapper around Qt's QPixmap class
A QPixmap
provides ability to store an image in the memory.
Example
const { QPixmap } = require("@nodegui/nodegui");
const imageUrl = "path/to/png";
const pixMap = new QPixmap(imageUrl);
Hierarchy
-
↳ QPixmap
Index
Constructors
Properties
Methods
- convertFromImage
- height
- load
- loadFromData
- save
- scaled
- setDevicePixelRatio
- width
- fromImage
- fromQVariant
Constructors
constructor
+ new QPixmap(): QPixmap
Overrides Component.constructor
Returns: QPixmap
+ new QPixmap(native
: NativeElement): QPixmap
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
native | NativeElement |
Returns: QPixmap
+ new QPixmap(filePath
: string): QPixmap
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
filePath | string |
Returns: QPixmap
Properties
native
• native: NativeElement | null
Inherited from Component.native
Methods
convertFromImage
▸ convertFromImage(image
: QImage, flags
: ImageConversionFlag): boolean
Parameters:
Name | Type |
---|---|
image | QImage |
flags | ImageConversionFlag |
Returns: boolean
height
▸ height(): number
Returns: number
load
▸ load(imagePath
: string): boolean
Parameters:
Name | Type |
---|---|
imagePath | string |
Returns: boolean
loadFromData
▸ loadFromData(buffer
: Buffer, format?
: ImageFormats): boolean
Parameters:
Name | Type |
---|---|
buffer | Buffer |
format? | ImageFormats |
Returns: boolean
save
▸ save(fileName
: string, format?
: ImageFormats): boolean
Parameters:
Name | Type |
---|---|
fileName | string |
format? | ImageFormats |
Returns: boolean
scaled
▸ scaled(width
: number, height
: number, aspectRatioMode?
: AspectRatioMode, transformationMode?
: TransformationMode): QPixmap
Parameters:
Name | Type |
---|---|
width | number |
height | number |
aspectRatioMode? | AspectRatioMode |
transformationMode? | TransformationMode |
Returns: QPixmap
setDevicePixelRatio
▸ setDevicePixelRatio(ratio
: number): void
Sets the device pixel ratio for the image. This is the ratio between image pixels and device-independent pixels
Parameters:
Name | Type |
---|---|
ratio | number |
Returns: void
width
▸ width(): number
Returns: number
Static
fromImage
▸ fromImage(image
: QImage, flags
: ImageConversionFlag): QPixmap
Parameters:
Name | Type |
---|---|
image | QImage |
flags | ImageConversionFlag |
Returns: QPixmap
Static
fromQVariant
▸ fromQVariant(variant
: QVariant): QPixmap
Parameters:
Name | Type |
---|---|
variant | QVariant |
Returns: QPixmap