#include "KSurface.hpp" ➔ class KSurface
A class that holds a pixel surface (RGBA image).
KSurface(int width, int height); KSurface(int width, int height, KColor color); KSurface(std::string fileName);
Create a surface of pixel with specified dimension and color.
Or loads an image from a file.
int x, y; int w, h;
Inherited from KRect.
void fill(KColor color); void fill(KRect rect, KColor color); void print(KSurface src, int x, int y);
Draw on the surface.
void save(std::string fileName); void clear();
Save the surface to a file as a BMP image.
Delete the surface.
void darker(unsigned char factor); void blur(int radius); void blur_quick(int factor);
Filters. Note that
blur_quick() is way more efficient than
bool unlock_write(bool force = false);
If the KSurface has been printed to a KWindow, an optimized copy exists in VRAM, thereby, any modification will cause a deletion of the optimized copy. To prevent bad uses of KSurface in this case (which could cause performance issues), the KSurface is "locked" (no modification can take place) when a VRAM copie is created until
unlock_write(true) is called (it is important to set the
force argument to
true, otherwise the function is just testing is writing operations are allowed).