![]() |
Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
|
Interface for software image data. More...
#include <duckcpp/core/engine/IImage.hpp>
Public Member Functions | |
IImage (ECOLOR_FORMAT format, const dcpp::nub::dimension2du &size, bool deleteMemory) | |
constructor | |
virtual | ~IImage () |
destructor | |
ECOLOR_FORMAT | getColorFormat () const |
Returns the color format. | |
const dcpp::nub::dimension2du & | getDimension () const |
Returns width and height of image data. | |
dcpp::uint32_kt | getBitsPerPixel () const |
Returns bits per pixel. | |
dcpp::uint32_kt | getBytesPerPixel () const |
Returns bytes per pixel. | |
size_t | getImageDataSizeInBytes () const |
Returns image data size in bytes. | |
dcpp::uint32_kt | getImageDataSizeInPixels () const |
Returns image data size in pixels. | |
dcpp::uint32_kt | getPitch () const |
Returns pitch of image. | |
dcpp::uint32_kt | getRedMask () const |
Returns mask for red value of a pixel. | |
dcpp::uint32_kt | getGreenMask () const |
Returns mask for green value of a pixel. | |
dcpp::uint32_kt | getBlueMask () const |
Returns mask for blue value of a pixel. | |
dcpp::uint32_kt | getAlphaMask () const |
Returns mask for alpha value of a pixel. | |
void * | getData () const |
Use this to get a pointer to the image data. | |
DCPP_DEPRECATED void * | lock () |
Lock function. Use this to get a pointer to the image data. | |
DCPP_DEPRECATED void | unlock () |
Unlock function. | |
dcpp::nub::dimension2du | getMipMapsSize (dcpp::uint32_kt mipmapLevel) const |
Get the mipmap size for this image for a certain mipmap level. | |
void * | getMipMapsData (dcpp::uint32_kt mipLevel=1) const |
Get mipmaps data. | |
void | setMipMapsData (void *data, bool ownForeignMemory, bool deleteMemory) |
Set mipmaps data. | |
virtual SColor | getPixel (dcpp::uint32_kt x, dcpp::uint32_kt y) const =0 |
Returns a pixel. | |
virtual void | setPixel (dcpp::uint32_kt x, dcpp::uint32_kt y, const SColor &color, bool blend=false)=0 |
Sets a pixel. | |
virtual void | copyToScaling (void *target, dcpp::uint32_kt width, dcpp::uint32_kt height, ECOLOR_FORMAT format=ECF_A8R8G8B8, dcpp::uint32_kt pitch=0)=0 |
Copies the image into the target, scaling the image to fit. | |
virtual void | copyToScaling (IImage *target)=0 |
Copies the image into the target, scaling the image to fit. | |
virtual void | copyTo (IImage *target, const dcpp::nub::position2di &pos=dcpp::nub::position2di(0, 0))=0 |
copies this surface into another | |
virtual void | copyTo (IImage *target, const dcpp::nub::position2di &pos, const dcpp::nub::recti &sourceRect, const dcpp::nub::recti *clipRect=0)=0 |
copies this surface into another | |
virtual void | copyToWithAlpha (IImage *target, const dcpp::nub::position2di &pos, const dcpp::nub::recti &sourceRect, const SColor &color, const dcpp::nub::recti *clipRect=0, bool combineAlpha=false)=0 |
copies this surface into another, using the alpha mask and cliprect and a color to add with | |
virtual void | copyToScalingBoxFilter (IImage *target, dcpp::int32_kt bias=0, bool blend=false)=0 |
copies this surface into another, scaling it to fit, applying a box filter | |
virtual void | flip (bool topBottom, bool leftRight)=0 |
Flips (mirrors) the image in one or two directions. | |
virtual void | fill (const SColor &color)=0 |
fills the surface with given color | |
DCPP_DEPRECATED bool | isCompressed () const |
Inform whether the image is compressed. | |
DCPP_DEPRECATED bool | hasMipMaps () const |
Check whether the image has MipMaps. | |
![]() | |
IReferenceCounted () | |
Constructor. | |
virtual | ~IReferenceCounted () |
Destructor. | |
void | grab () const |
Grabs the object. Increments the reference counter by one. | |
bool | drop () const |
Drops the object. Decrements the reference counter by one. | |
dcpp::int32_kt | getReferenceCount () const |
Get the reference count. | |
const dcpp::char_kt * | getDebugName () const |
Returns the debug name of the object. | |
Static Public Member Functions | |
static dcpp::nub::dimension2du | getMipMapsSize (const dcpp::nub::dimension2du &sizeLevel0, dcpp::uint32_kt mipmapLevel) |
Calculate mipmap size for a certain level. | |
static dcpp::uint32_kt | getBitsPerPixelFromFormat (const ECOLOR_FORMAT format) |
get the amount of Bits per Pixel of the given color format | |
static bool | checkDataSizeLimit (size_t dataSize) |
You should not create images where the result of getDataSizeFromFormat doesn't pass this function. | |
static size_t | getDataSizeFromFormat (ECOLOR_FORMAT format, dcpp::uint32_kt width, dcpp::uint32_kt height) |
calculate image data size in bytes for selected format, width and height. | |
static bool | isCompressedFormat (const ECOLOR_FORMAT format) |
check if this is compressed color format | |
static bool | isDepthFormat (const ECOLOR_FORMAT format) |
check if the color format is only viable for depth/stencil textures | |
static bool | isFloatingPointFormat (const ECOLOR_FORMAT format) |
Check if the color format uses floating point values for pixels. | |
Protected Attributes | |
ECOLOR_FORMAT | Format |
dcpp::nub::dimension2du | Size |
dcpp::uint8_kt * | Data |
dcpp::uint8_kt * | MipMapsData |
dcpp::uint32_kt | BytesPerPixel |
dcpp::uint32_kt | Pitch |
bool | DeleteMemory |
bool | DeleteMipMapsMemory |
dcpp::nub::irrAllocator< dcpp::uint8_kt > | Allocator |
Additional Inherited Members | |
![]() | |
void | setDebugName (const dcpp::char_kt *newName) |
Sets the debug name of the object. | |
Interface for software image data.
Image loaders create these images from files. IVideoDrivers convert these images into their (hardware) textures. NOTE: Floating point formats are not well supported yet. Basically only getData() works for them.
|
inlinestatic |
You should not create images where the result of getDataSizeFromFormat doesn't pass this function.
Note that PImage does not yet check for this, but going beyond this limit is not supported well. Image loaders should check for this. If you don't have the format yet then checking width*height*bytes_per_pixel is mostly fine, but make sure to work with size_t so it doesn't clip the result to dcpp::uint32_kt too early.
|
pure virtual |
copies this surface into another
NOTE: mipmaps are ignored
|
pure virtual |
copies this surface into another
NOTE: mipmaps are ignored
|
pure virtual |
Copies the image into the target, scaling the image to fit.
NOTE: mipmaps are ignored
|
pure virtual |
Copies the image into the target, scaling the image to fit.
NOTE: mipmaps are ignored
|
pure virtual |
copies this surface into another, scaling it to fit, applying a box filter
NOTE: mipmaps are ignored
|
pure virtual |
copies this surface into another, using the alpha mask and cliprect and a color to add with
NOTE: mipmaps are ignored
combineAlpha | - When true then combine alpha channels. When false replace target image alpha with source image alpha. |
|
pure virtual |
Flips (mirrors) the image in one or two directions.
topBottom | Flip around central x-axis (vertical flipping) |
leftRight | Flip around central y-axis (typical mirror, horizontal flipping) |
|
inline |
Use this to get a pointer to the image data.
|
inline |
Get mipmaps data.
Note that different mip levels are just behind each other in memory block. So if you just get level 1 you also have the data for all other levels. There is no level 0 - use getData to get the original image data.
|
inlinestatic |
Calculate mipmap size for a certain level.
level 0 will be full image size. Every further level is half the size.
|
inline |
Get the mipmap size for this image for a certain mipmap level.
level 0 will be full image size. Every further level is half the size. Doesn't care if the image actually has mipmaps, just which size would be needed.
|
inline |
Check whether the image has MipMaps.
|
inline |
Lock function. Use this to get a pointer to the image data.
Use getData instead.
|
inline |
Set mipmaps data.
This method allows you to put custom mipmaps data for image.
data | A byte array with pixel color information |
ownForeignMemory | If true, the image will use the data pointer directly and own it afterward. If false, the memory will by copied internally. |
deleteMemory | Whether the memory is deallocated upon destruction. |
|
inline |
Unlock function.
Should be called after the pointer received by lock() is not needed anymore.