15#include <ds_geometry.h>
16#include <ds_allocator.h>
46 DsSurface(int32_t width, int32_t height,
const DsRotation &rotation,
DsColorMode cmode,
bool palette_has_alpha,
size_t palette_size, ds_malloc_t fb_malloc, ds_free_t fb_free, uint32_t alignment = 32,
size_t extra_data = 0);
253 copy(x, y, sub_surface, alpha_mode, color);
286 blend(x, y, sub_surface, alpha_mode, color);
328 void replaceColor(
DsColor match_color,
bool match_mask_a,
bool match_mask_r,
bool match_mask_g,
bool match_mask_b,
329 DsColor new_color,
bool new_mask_a,
bool new_mask_r,
bool new_mask_g,
bool new_mask_b);
415 ds_malloc_t mFbMalloc;
427 size_t mBytesPerPixel;
432 bool mPaletteHasAlpha;
440 size_t computePitch(
size_t with);
447 void setClipRegion(
const DsRect ®ion);
455 DsRect getClipRegion(
void)
const;
461 void resetClipRegion(
void);
DsAlignment is a class representing both horizontal and vertical alignment type.
Definition ds_types.h:130
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsFRect is a class that represents a 2D rectangle (X, Y, W, H) using floating point coordiantes and s...
Definition ds_geometry.h:2059
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRect is a class that represents a 2D rectangle (X, Y, W, H)
Definition ds_geometry.h:1507
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsScreen is class of type DsView (inherits from DsView) that implements a physical screen.
Definition ds_screen.h:29
DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.
Definition ds_geometry.h:780
DsSurface is a class that represents a drawing surface.
Definition ds_surface.h:30
DsColorMode getColorMode(void) const
Gets the color mode of the surface.
uint8_t * getPixels(void)
Gets the address of the framebuffer.
uint32_t getPitch(void) const
Gets the pitch of the surface (number of bytes to add to a pixel to advance exactly one line).
void replaceColor(DsColor match_color, bool match_mask_a, bool match_mask_r, bool match_mask_g, bool match_mask_b, DsColor new_color, bool new_mask_a, bool new_mask_r, bool new_mask_g, bool new_mask_b)
Replaces a the color component of each pixel in the surface with a new value.
size_t saveStream(uint32_t *stream)
Saves the DsSurface object in the specified stream.
DsSurface(int32_t width, int32_t height, const DsRotation &rotation, DsColorMode cmode, bool palette_has_alpha, size_t palette_size, ds_malloc_t fb_malloc, ds_free_t fb_free, uint32_t alignment=32, size_t extra_data=0)
Creates a surface, allocates the framebuffer and the pallete table (if required)
void * getUser(void)
Gets the user pointer attached to the surface.
int32_t getPhysicalHeight(void) const
Gets the physical height of the framebuffer.
uint32_t getBpp(void) const
Gets the number of bytes per pixel of the surface. This value depends on the color mode of the frameb...
void putPixel(int32_t x, int32_t y, DsColor color)
Sets the color of a pixel within the surface.
size_t getFrameBufferSize(void) const
Gets the total size in bytes of the framebuffer (allocated size)
DsRect getRegion(void) const
Return the rectangular region of the surface (logical).
DsRotation getRotation(void) const
Gets the surface rotation.
bool doesPaletteHaveAlpha(void) const
Does the palette have the alpha channel?
int32_t getPhysicalWidth(void) const
Gets the physical width of the framebuffer.
void rotateFrameBuffer(DsRotation rotation)
Rotates the entire framebuffer counter-clockwise.
void copy(int32_t x, int32_t y, const DsSurface &src, DsAlphaMode alpha_mode, DsColor color)
Copies an entire surface to the current surface object respecting the clipping region.
void unrotateRect(DsFRect &rect) const
Rotates a rectangle to match the screen framebuffer rotation.
void copy(int32_t x, int32_t y, const DsSurface &src, const DsRect &src_area, DsAlphaMode alpha_mode, DsColor color)
Copies a region of a surface to the current surface object respecting the clipping region.
Definition ds_surface.h:250
void rotateRect(DsFRect &rect) const
Rotates a rectangle to match the screen framebuffer rotation.
uint8_t * getPalette(void)
Gets the address of the palette.
void rotateXY(float &x, float &y) const
Rotates the coordinate system to match the screen framebuffer rotation.
DsSurface getSubSurface(const DsRect &rect) const
Returns a subsurface of the existing surface. The same framebuffer is used.
void invert(void)
Inverts all the pixel values in a surface at a byte level.
void setUser(void *user)
Sets the user pointer attached to the surface.
~DsSurface()
Destructor - frees the frame buffer and the palette table.
void rotateXY(int32_t &x, int32_t &y) const
Rotates the coordinate system to match the screen framebuffer rotation.
DsSurface(uint32_t *stream, size_t size)
Creates a surface, allocates the framebuffer and the pallete table (if required) using a stream of by...
void replaceColor(const DsSurface &src, bool replace_a, bool replace_r, bool replace_g, bool replace_b)
Replaces the color components of each pixel in the surface with the components of the corresponding p...
void rotateWH(float &w, float &h) const
Rotates the size (W, H) to match the screen framebuffer rotation.
void unrotateRect(DsRect &rect) const
Rotates a rectangle to match the screen framebuffer rotation.
void replaceAlpha(const DsSurface &alpha_only_src)
Replaces the alpha channel of each pixel in the surface with the alpha of the corresponding pixel in ...
void rotateRect(DsRect &rect) const
Rotates a rectangle to match the screen framebuffer rotation.
void blend(int32_t x, int32_t y, const DsSurface &src, DsAlphaMode alpha_mode, DsColor color)
Blends an entire surface to the current surface object respecting the clipping region.
void blend(int32_t x, int32_t y, const DsSurface &src, const DsRect &src_area, DsAlphaMode alpha_mode, DsColor color)
Blends a region of a surface to the current surface object respecting the clipping region.
Definition ds_surface.h:283
DsSize getSize(void) const
Return the logical size of the surface in pixels.
uint16_t getPaletteSize(void) const
Gets the total size in bytes of the pallete (allocated size)
void blendAligned(const DsSurface &src, DsAlphaMode alpha_mode, DsColor color, const DsRect &boundary, const DsAlignment &alignment, const DsPoint &offset=DsPoint(0, 0))
Blends an entire surface to the current surface object respecting the clipping region.
void rotateWH(int32_t &w, int32_t &h) const
Rotates the size (W, H) to match the screen framebuffer rotation.
void clear(DsColor color)
Fills the surface with a specified color respecting the clip region.
DsSurface(const DsSurface &src)
Copy constructor - creates a copy of a surface. This will share the same framebuffer as the original ...
uint32_t getPitchPx(void) const
Gets the pitch of the surface (number of pixels to add to a pixel to advance exactly one line).
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
DsAlphaMode
AlphaMode is an enumeration of all possible alpha channel modes. These modes determine how the alpha ...
Definition ds_color.h:41
DsColorMode
DsColorMode is an enumeration of all possible color modes. These modes determine the color format use...
Definition ds_color.h:25
DsRotation
DsRotation is an enumeration of all possible values of the rotation used in drawing operations.
Definition ds_types.h:34