SavvyUI C++ UI Library
|
Provides static methods for GDI+ initialization and image rendering. More...
#include <GraphicsContext.h>
Static Public Member Functions | |
static void | initGdiPlus () |
Initializes the GDI+ library. | |
static void | terminateGdiPlus () |
Terminates the GDI+ library and frees resources. | |
static Gdiplus::Image * | imageFileToImage (const wstring &filePath) |
Loads an image from a file path into a GDI+ Image object. | |
static Gdiplus::Image * | imageBytesToImage (const BYTE *imageBytes, size_t size) |
Loads an image from a byte array into a GDI+ Image object. | |
static Gdiplus::Image * | imageResourceToImage (HINSTANCE hInst, int resourceID, const ImageType &imageType) |
Loads a PNG, GIF, or JPG image using its resource ID from .rc file as a GDI+ Image object. | |
static void | drawImageFile (Graphics *g, Bounds rect, const wstring &filePath, const ImageAlignment &alignment=ImageAlignment::TOPCENTER, BOOL showBorder=FALSE) |
Draws an image loaded from a file onto a device context. | |
static void | drawImage (Graphics *g, Bounds rect, Gdiplus::Image *image, const ImageAlignment &alignment=ImageAlignment::TOPCENTER, BOOL showBorder=FALSE) |
Draws a GDI+ Image onto a device context. | |
static void | drawImageBytes (Graphics *g, Bounds rect, const BYTE *imageBytes, size_t size, const ImageAlignment &alignment=ImageAlignment::TOPCENTER, BOOL showBorder=FALSE) |
Draws an image represented by a byte array onto a device context. | |
static void | drawImageResource (Graphics *g, Bounds rect, int resourceID, const ImageType &imageType, const ImageAlignment &alignment=ImageAlignment::TOPCENTER, BOOL showBorder=FALSE) |
Draws a GDI+ Image onto a device context. | |
static void | linearGradient (Graphics *g, Bounds rect, int startR, int startG, int startB, int endR, int endG, int endB, int startAlpha=0, int endAlpha=0, BOOL directionVertical=TRUE, const wstring &text=L"", int textR=0, int textG=0, int textB=0) |
Fills a rect with a linear gradient colors. |
Provides static methods for GDI+ initialization and image rendering.
This class offers utility functions to initialize and terminate GDI+, load images from files, and draw images onto device contexts with alignment and optional borders.
|
static |
Draws a GDI+ Image onto a device context.
hDC | Handle to the device context where the image will be drawn. |
rect | The target rectangle in which to draw the image. |
image | Pointer to the Gdiplus::Image to draw. |
alignment | Specifies the image alignment within the rectangle. Default is "topCenter". |
showBorder | If TRUE, draws a border around the image. Default is FALSE. |
|
static |
Draws an image represented by a byte array onto a device context.
hDC | Handle to the device context where the image will be drawn. |
rect | The target rectangle in which to draw the image. |
imageBytes | Pointer to the image bytes. |
size | the size of the imageBytes array. |
alignment | Specifies the image alignment within the rectangle. Default is "topCenter". |
showBorder | If TRUE, draws a border around the image. Default is FALSE. |
|
static |
Draws an image loaded from a file onto a device context.
hDC | Handle to the device context where the image will be drawn. |
rect | The target rectangle in which to draw the image. |
filePath | The path to the image file. |
alignment | Specifies the image alignment within the rectangle. Default is "topCenter". |
showBorder | If TRUE, draws a border around the image. Default is FALSE. |
|
static |
Draws a GDI+ Image onto a device context.
hDC | Handle to the device context where the image will be drawn. |
rect | The target rectangle in which to draw the image. |
resourceID | ID from the .rc resource |
alignment | Specifies the image alignment within the rectangle. Default is "topCenter". |
showBorder | If TRUE, draws a border around the image. Default is FALSE. |
|
static |
Loads an image from a byte array into a GDI+ Image object.
|
static |
Loads an image from a file path into a GDI+ Image object.
filePath | The path to the image file. |
|
static |
Loads a PNG, GIF, or JPG image using its resource ID from .rc file as a GDI+ Image object.
|
static |
Initializes the GDI+ library.
Must be called before using any GDI+ functionality.
|
static |
Fills a rect with a linear gradient colors.
|
static |
Terminates the GDI+ library and frees resources.
Should be called when GDI+ is no longer needed.