.. index:: pair: class; EE::Graphics::Texture .. _doxid-class_e_e_1_1_graphics_1_1_texture: class EE::Graphics::Texture =========================== .. toctree:: :hidden: enum_EE_Graphics_Texture_ClampMode.rst enum_EE_Graphics_Texture_CoordinateType.rst enum_EE_Graphics_Texture_Filter.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Texture: public :ref:`EE::Graphics::DrawableResource`, public :ref:`EE::Graphics::Image`, private :ref:`EE::NonCopyable` { public: // enums enum :ref:`ClampMode`; enum :ref:`CoordinateType`; enum :ref:`Filter`; // construction virtual :target:`~Texture`(); // methods static :ref:`Uint32` :target:`getMaximumSize`(); void :ref:`setHandle`(const int& texture); int :ref:`getHandle`() const; const :ref:`String::HashType`& :ref:`getHashName`() const; void :ref:`setFilepath`(const std::string& filepath); std::string :ref:`getFilepath`() const; unsigned int :ref:`getImageWidth`() const; unsigned int :ref:`getImageHeight`() const; void :ref:`setMipmap`(const bool& UseMipmap); bool :ref:`getMipmap`() const; void :ref:`setClampMode`(const :ref:`Texture::ClampMode`& clampmode); :ref:`ClampMode` :ref:`getClampMode`() const; :ref:`Uint8`* :ref:`lock`(const bool& ForceRGBA = false); bool :ref:`unlock`(const bool& KeepData = false, const bool& Modified = false); virtual const :ref:`Uint8`* :ref:`getPixelsPtr`(); void :ref:`setFilter`(const :ref:`Filter`& filter); const :ref:`Filter`& :ref:`getFilter`() const; virtual bool :ref:`saveToFile`(const std::string& filepath, const :ref:`Image::SaveType`& Format); virtual void :ref:`replaceColor`(const :ref:`Color`& ColorKey, const :ref:`Color`& NewColor); virtual void :ref:`createMaskFromColor`(const :ref:`Color`& ColorKey, :ref:`Uint8` Alpha); virtual void :ref:`fillWithColor`(const :ref:`Color`& Color); virtual void :ref:`resize`(const :ref:`Uint32`& newWidth, const :ref:`Uint32`& newHeight, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4); virtual void :ref:`scale`(const :ref:`Float`& scale, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4); virtual void :ref:`copyImage`(:ref:`Image`* image, const :ref:`Uint32`& x, const :ref:`Uint32`& y); void :ref:`update`(const :ref:`Uint8`* pixels, :ref:`Uint32` width, :ref:`Uint32` height, :ref:`Uint32` x = 0, :ref:`Uint32` y = 0, :ref:`PixelFormat` pf = PixelFormat::PIXEL_FORMAT_RGBA); void :ref:`update`(const :ref:`Uint8`* pixels); void :ref:`update`(:ref:`Image`* image, :ref:`Uint32` x = 0, :ref:`Uint32` y = 0); void :ref:`replace`(:ref:`Image`* image); virtual void :ref:`flip`(); bool :ref:`hasLocalCopy`(); void :ref:`deleteTexture`(); void :ref:`setGrabed`(const bool& isGrabed); bool :ref:`isGrabed`() const; bool :ref:`isCompressed`() const; void :ref:`drawFast`( const :ref:`Float`& x, const :ref:`Float`& y, const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`Float`& width = 0, const :ref:`Float`& height = 0 ); void :ref:`draw`( const :ref:`Float`& x, const :ref:`Float`& y, const :ref:`Float`& Angle = 0, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`RenderMode`& Effect = :ref:`RENDER_NORMAL`, :ref:`OriginPoint` Center = :ref:`OriginPoint`(OriginPoint::OriginCenter), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ); void :ref:`drawEx`( :ref:`Float` x, :ref:`Float` y, :ref:`Float` width = 0.0f, :ref:`Float` height = 0.0f, const :ref:`Float`& Angle = 0, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& Color0 = Color::White, const :ref:`Color`& Color1 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color2 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color3 = :ref:`Color`(255, 255, 255, 255), const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`RenderMode`& Effect = :ref:`RENDER_NORMAL`, :ref:`OriginPoint` Center = :ref:`OriginPoint`(OriginPoint::OriginCenter), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ); void :ref:`drawQuad`( const :ref:`Quad2f`& Q, const :ref:`Vector2f`& Offset = :ref:`Vector2f`(), const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ); void :ref:`drawQuadEx`( :ref:`Quad2f` Q, const :ref:`Vector2f`& Offset = :ref:`Vector2f`(), const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& Color0 = Color::White, const :ref:`Color`& Color1 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color2 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color3 = :ref:`Color`(255, 255, 255, 255), const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), :ref:`Rect` texSector = :ref:`Rect`(0, 0, 0, 0) ); virtual :ref:`Sizef` :target:`getSize`(); virtual :ref:`Sizef` :target:`getPixelsSize`(); virtual void :target:`draw`(); virtual void :target:`draw`(const :ref:`Vector2f`& position); virtual void :target:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size); virtual bool :target:`isStateful`(); void :ref:`setTextureId`(const :ref:`Uint32`& id); const :ref:`Uint32`& :ref:`getTextureId`() const; void :ref:`reload`(); virtual void :ref:`setPixel`(const unsigned int& x, const unsigned int& y, const :ref:`Color`& Color); void :ref:`bind`(:ref:`CoordinateType` coordinateType, const :ref:`Uint32`& textureUnit = 0); void :ref:`bind`(const :ref:`Uint32`& textureUnit = 0); const :ref:`CoordinateType`& :ref:`getCoordinateType`() const; void :ref:`setCoordinateType`(const :ref:`CoordinateType`& coordinateType); }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // typedefs typedef std::function`, :ref:`Event`, :ref:`DrawableResource`*)> :ref:`OnResourceChangeCallback`; // enums enum :ref:`Type`; enum :ref:`Event`; enum :ref:`PixelFormat`; enum :ref:`ResamplerFilter`; enum :ref:`SaveType`; // classes class :ref:`FormatConfiguration`; // methods virtual :ref:`Sizef` :ref:`getSize`() = 0; virtual :ref:`Sizef` :ref:`getPixelsSize`() = 0; virtual void :ref:`draw`() = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position) = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size) = 0; virtual bool :ref:`isStateful`() = 0; void :ref:`setAlpha`(:ref:`Uint8` alpha); const :ref:`Uint8`& :ref:`getAlpha`(); void :ref:`setColor`(const :ref:`Color`& color); const :ref:`Color`& :ref:`getColor`() const; void :ref:`setColorFilter`(const :ref:`Color`& color); :ref:`RGB` :ref:`getColorFilter`(); void :ref:`clearColor`(); void :ref:`clearColorFilter`(); void :ref:`resetAlpha`(); :ref:`Type` :ref:`getDrawableType`() const; const :ref:`Vector2f`& :ref:`getPosition`() const; void :ref:`setPosition`(const :ref:`Vector2f`& position); virtual bool :ref:`isDrawableResource`() const; const :ref:`String::HashType`& :ref:`getId`() const; const std::string :ref:`getName`() const; void :ref:`setName`(const std::string& name); virtual bool :ref:`isDrawableResource`() const; :ref:`Uint32` :ref:`pushResourceChangeCallback`(const :ref:`OnResourceChangeCallback`& cb); bool :ref:`popResourceChangeCallback`(const :ref:`Uint32`& callbackId); static std::string :ref:`saveTypeToExtension`(const :ref:`Int32`& Format); static :ref:`SaveType` :ref:`extensionToSaveType`(const std::string& Extension); static :ref:`PixelFormat` :ref:`channelsToPixelFormat`(const :ref:`Uint32`& channels); static bool :ref:`getInfo`(const std::string& path, int* width, int* height, int* channels, const :ref:`FormatConfiguration`& imageFormatConfiguration = :ref:`FormatConfiguration`()); static bool :ref:`getInfoFromMemory`(const unsigned char* data, const size_t& dataSize, int* width, int* height, int* channels, const :ref:`FormatConfiguration`& imageFormatConfiguration = :ref:`FormatConfiguration`()); static bool :ref:`isImage`(const std::string& path); static bool :ref:`isImageExtension`(const std::string& path); static std::string :ref:`getLastFailureReason`(); static :ref:`Image`* :ref:`New`(); static :ref:`Image`* :ref:`New`(:ref:`Graphics::Image`* image); static :ref:`Image`* :ref:`New`(:ref:`Uint8`* data, const unsigned int& width, const unsigned int& height, const unsigned int& channels); static :ref:`Image`* :ref:`New`(const :ref:`Uint8`* data, const unsigned int& width, const unsigned int& height, const unsigned int& channels); static :ref:`Image`* :ref:`New`(const :ref:`Uint32`& width, const :ref:`Uint32`& height, const :ref:`Uint32`& channels, const :ref:`Color`& DefaultColor = :ref:`Color`(0, 0, 0, 0), const bool& initWithDefaultColor = true); static :ref:`Image`* :ref:`New`(std::string Path, const unsigned int& forceChannels = 0, const :ref:`FormatConfiguration`& formatConfiguration = :ref:`FormatConfiguration`()); static :ref:`Image`* :ref:`New`(const :ref:`Uint8`* imageData, const unsigned int& imageDataSize, const unsigned int& forceChannels = 0, const :ref:`FormatConfiguration`& formatConfiguration = :ref:`FormatConfiguration`()); static :ref:`Image`* :ref:`New`(:ref:`Pack`* Pack, std::string FilePackPath, const unsigned int& forceChannels = 0, const :ref:`FormatConfiguration`& formatConfiguration = :ref:`FormatConfiguration`()); static :ref:`Image`* :ref:`New`(:ref:`IOStream`& stream, const unsigned int& forceChannels = 0, const :ref:`FormatConfiguration`& formatConfiguration = :ref:`FormatConfiguration`()); void :ref:`create`(const :ref:`Uint32`& width, const :ref:`Uint32`& height, const :ref:`Uint32`& channels, const :ref:`Color`& DefaultColor = :ref:`Color`(0, 0, 0, 0), const bool& initWithDefaultColor = true); virtual :ref:`Color` :ref:`getPixel`(const unsigned int& x, const unsigned int& y); virtual void :ref:`setPixel`(const unsigned int& x, const unsigned int& y, const :ref:`Color`& Color); virtual void :ref:`setPixels`(const :ref:`Uint8`* data); virtual const :ref:`Uint8`* :ref:`getPixelsPtr`(); :ref:`Uint8`* :ref:`getPixels`() const; void :ref:`setWidth`(const unsigned int& width); unsigned int :ref:`getWidth`() const; void :ref:`setHeight`(const unsigned int& height); unsigned int :ref:`getHeight`() const; unsigned int :ref:`getChannels`() const; void :ref:`setChannels`(const unsigned int& setChannels); void :ref:`clearCache`(); unsigned int :ref:`getMemSize`() const; :ref:`Sizei` :ref:`getSize`(); virtual bool :ref:`saveToFile`(const std::string& filepath, const :ref:`SaveType`& Format); virtual void :ref:`createMaskFromColor`(const :ref:`Color`& ColorKey, :ref:`Uint8` Alpha); void :ref:`createMaskFromColor`(const :ref:`RGB`& ColorKey, :ref:`Uint8` Alpha); virtual void :ref:`replaceColor`(const :ref:`Color`& ColorKey, const :ref:`Color`& NewColor); virtual void :ref:`fillWithColor`(const :ref:`Color`& Color); virtual void :ref:`copyImage`(:ref:`Graphics::Image`* image, const :ref:`Uint32`& x = 0, const :ref:`Uint32`& y = 0); virtual void :ref:`scale`(const :ref:`Float`& scale, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4); virtual void :ref:`resize`(const :ref:`Uint32`& newWidth, const :ref:`Uint32`& newHeight, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4); virtual void :ref:`flip`(); :ref:`Graphics::Image`* :ref:`thumbnail`(const :ref:`Uint32`& maxWidth, const :ref:`Uint32`& maxHeight, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4); :ref:`Graphics::Image`* :ref:`crop`(:ref:`Rect` rect); void :ref:`avoidFreeImage`(const bool& AvoidFree); void :ref:`blit`(:ref:`Graphics::Image`* image, const :ref:`Uint32`& x = 0, const :ref:`Uint32`& y = 0); :ref:`Graphics::Image`* :ref:`copy`(); :ref:`Graphics::Image`& :ref:`operator=`(const :ref:`Image`& right); void :ref:`setImageFormatConfiguration`(const :ref:`FormatConfiguration`& imageFormatConfiguration); const :ref:`FormatConfiguration`& :ref:`getImageFormatConfiguration`() const; .. _details-class_e_e_1_1_graphics_1_1_texture: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; setHandle .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a9d49b6fd3ccb430584eb338f3f4ffc8e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setHandle(const int& texture) Set the OpenGL :ref:`Texture ` Id (texture handle) .. index:: pair: function; getHandle .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a1ab93c045fb76905b48b1eb461ac37c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block int getHandle() const .. rubric:: Returns: The OpenGL :ref:`Texture ` Id (texture handle) .. index:: pair: function; getHashName .. _doxid-class_e_e_1_1_graphics_1_1_texture_1afc31d0135fe782887d3b1ec04a5052e6: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`String::HashType`& getHashName() const .. rubric:: Returns: The hash of the filename .. index:: pair: function; setFilepath .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a6de598709419b90479cb7be444917f88: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFilepath(const std::string& filepath) Set the :ref:`Texture ` File Path .. index:: pair: function; getFilepath .. _doxid-class_e_e_1_1_graphics_1_1_texture_1abe9007c1a3957ee2ee8a3377eadb4950: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string getFilepath() const .. rubric:: Returns: The :ref:`Texture ` File Path .. index:: pair: function; getImageWidth .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a93e1d23f27575785eb60c972c07a178e: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int getImageWidth() const .. rubric:: Returns: The :ref:`Image ` Width .. index:: pair: function; getImageHeight .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ad51608626f703f097bed3b64d16e6b7e: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int getImageHeight() const .. rubric:: Returns: The :ref:`Image ` Height .. index:: pair: function; setMipmap .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ade4f50e73b48ce09d184b7c0959d1ae5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setMipmap(const bool& UseMipmap) Set if the :ref:`Texture ` use Mipmaps .. index:: pair: function; getMipmap .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a97ec0f62e002cb646705541db30ac966: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getMipmap() const .. rubric:: Returns: If the texture use Mipmaps .. index:: pair: function; setClampMode .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a9b96d66e581e5d25aaf648658014831e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setClampMode(const :ref:`Texture::ClampMode`& clampmode) Set the :ref:`Texture ` Clamp Mode .. index:: pair: function; getClampMode .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a923332b81e37dd29151c8658e10c3008: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ClampMode` getClampMode() const .. rubric:: Returns: The :ref:`Texture ` Clamp Mode .. index:: pair: function; lock .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ade6a0660c3a3a1ed65755a447c2ae552: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint8`* lock(const bool& ForceRGBA = false) Lock the :ref:`Texture ` for direct access. It is needed to have any read/write access to the texture. This feature is not supported in OpenGL ES. .. index:: pair: function; unlock .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ad8af07f54641f97ce02c5a07cb4817ce: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool unlock(const bool& KeepData = false, const bool& Modified = false) Unlock the previously locked :ref:`Texture `. Unlocking the texture will upload the local copy of the texture ( that could have been modified ) to the GPU. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - KeepData - If true keeps the local copy of the texture un memory, otherwise it will be released. * - Modified - The flag indicates of the texture was modified between the Lock and Unlock calls. This is to force reloading the texture from memory to VRAM. In the case that the texture in ram was modified using the :ref:`Texture ` methods to do this, it will already know that this is true, so it will upload the changes to the GPU. .. index:: pair: function; getPixelsPtr .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a9a06b2c8f0b63928a4ee43384a474c1e: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual const :ref:`Uint8`* getPixelsPtr() .. rubric:: Returns: A pointer to the first pixel of the texture ( keeped with a local copy ). You must have a copy of the texture on local memory. For that you need to Lock the texture first. .. index:: pair: function; setFilter .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a902ea9949c22fcd9e6df73f0ea040dcf: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFilter(const :ref:`Filter`& filter) Set the :ref:`Texture ` Filter Mode .. index:: pair: function; getFilter .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a942db524aa0aad8d9570f56559b7817e: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Filter`& getFilter() const .. rubric:: Returns: The texture filter used by the texture .. index:: pair: function; saveToFile .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a59987827cefbae2449c7e7d110ea8767: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool saveToFile(const std::string& filepath, const :ref:`Image::SaveType`& Format) Save the :ref:`Texture ` to a new File .. index:: pair: function; replaceColor .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ad43a874cea1bf10539b8213930949a05: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void replaceColor(const :ref:`Color`& ColorKey, const :ref:`Color`& NewColor) Replace a color on the texture .. index:: pair: function; createMaskFromColor .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a57edade8a34d628ff0af390aa6c773ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void createMaskFromColor(const :ref:`Color`& ColorKey, :ref:`Uint8` Alpha) Create an Alpha mask from a Color .. index:: pair: function; fillWithColor .. _doxid-class_e_e_1_1_graphics_1_1_texture_1aa9bb00909d8ddddd02308f4e4e9e9165: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void fillWithColor(const :ref:`Color`& Color) Fill a texture with a color .. index:: pair: function; resize .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a57be2d4234d76de17304a1c0b9f565dc: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void resize(const :ref:`Uint32`& newWidth, const :ref:`Uint32`& newHeight, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4) Resize the texture .. index:: pair: function; scale .. _doxid-class_e_e_1_1_graphics_1_1_texture_1aad609d0b771c9c106b8d6650e9c38c05: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void scale(const :ref:`Float`& scale, :ref:`ResamplerFilter` filter = ResamplerFilter::RESAMPLER_LANCZOS4) Scale the texture .. index:: pair: function; copyImage .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a6628c2f4df76722dbb619ae867b0e402: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void copyImage(:ref:`Image`* image, const :ref:`Uint32`& x, const :ref:`Uint32`& y) Copy an image inside the texture .. index:: pair: function; update .. _doxid-class_e_e_1_1_graphics_1_1_texture_1aac98b25670e7543ddf5ec0d457fbd43c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update(const :ref:`Uint8`* pixels, :ref:`Uint32` width, :ref:`Uint32` height, :ref:`Uint32` x = 0, :ref:`Uint32` y = 0, :ref:`PixelFormat` pf = PixelFormat::PIXEL_FORMAT_RGBA) Update a part of the texture from an array of pixels The size of the *pixel* array must match the *width* and *height* arguments. No additional check is performed on the size of the pixel array or the bounds of the area to update, passing invalid arguments will lead to an undefined behaviour. This function does nothing if *pixels* is null or if the texture was not previously created. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pixels - Array of pixels to copy to the texture * - width - Width of the pixel region contained in *pixels* * - height - Height of the pixel region contained in *pixels* * - x - X offset in the texture where to copy the source pixels * - y - Y offset in the texture where to copy the source pixels * - pf - The pixel format of the *pixel* .. index:: pair: function; update .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ad2c19f91ba2e0eb68ae0f94ae5d46c24: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update(const :ref:`Uint8`* pixels) Update the whole texture from an array of pixels The *pixel* array is assumed to have the same size as the *area* rectangle. No additional check is performed on the size of the pixel array, passing invalid arguments will lead to an undefined behaviour. This function does nothing if *pixels* is null or if the texture was not previously created. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pixels - Array of pixels to copy to the texture .. index:: pair: function; update .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a21a71a7421ed6b95abf0122bfa996989: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update(:ref:`Image`* image, :ref:`Uint32` x = 0, :ref:`Uint32` y = 0) Update a part of the texture from an image The pixel format is automatically detected No additional check is performed on the size of the image, passing an invalid combination of image size and offset will lead to an undefined behaviour. This function does nothing if the texture was not previously created. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - image - :ref:`Image ` to copy to the texture * - x - X offset in the texture where to copy the source image * - y - Y offset in the texture where to copy the source image .. index:: pair: function; replace .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a3b86f759cf13570359158fe4ba6cd43d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void replace(:ref:`Image`* image) Replaces the current texture with the image provided, reusing the current texture id. .. index:: pair: function; flip .. _doxid-class_e_e_1_1_graphics_1_1_texture_1af6ac7c71ff1e475669e0a354f0fccd9d: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void flip() Flip the texture ( rotate the texture 90ยบ ). Warning: This is flipped in memory, a real flipping. .. index:: pair: function; hasLocalCopy .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a542fb09fd6223399d278bcf72405dd0a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool hasLocalCopy() .. rubric:: Returns: If the :ref:`Texture ` has a copy on the local memory .. index:: pair: function; deleteTexture .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a7fc6f82132b75ad173134a582d260864: .. ref-code-block:: cpp :class: doxyrest-title-code-block void deleteTexture() Unload the :ref:`Texture ` from Memory .. index:: pair: function; setGrabed .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ab0d9317ba661dd4b7938e24c6539bd26: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setGrabed(const bool& isGrabed) Set if the :ref:`Texture ` is Grabed .. index:: pair: function; isGrabed .. _doxid-class_e_e_1_1_graphics_1_1_texture_1abc94aacede5d5a2a5e388da8a1ef9ee7: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isGrabed() const .. rubric:: Returns: If the texture is Grabed .. index:: pair: function; isCompressed .. _doxid-class_e_e_1_1_graphics_1_1_texture_1afdb6a338f84b734d6e67855422ef2f6c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isCompressed() const .. rubric:: Returns: If the texture was compressed on load (DXT compression) .. index:: pair: function; drawFast .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a002dc663f0762878193398876e64a157: .. ref-code-block:: cpp :class: doxyrest-title-code-block void drawFast( const :ref:`Float`& x, const :ref:`Float`& y, const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`Float`& width = 0, const :ref:`Float`& height = 0 ) Render the texture on screen ( with less internal mess, a little bit faster way ) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - The x position on screen * - y - The y position on screen * - Angle - The Angle of the texture rendered * - scale - The Scale factor of the rendered texture * - color - The texture color * - Blend - Set the Blend Mode ( default :ref:`BlendMode::Alpha() `) * - width - The width of the texture rendered * - height - The height of the texture rendered .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_texture_1aaaeb761f36e0b4780127f182ba16eba0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void draw( const :ref:`Float`& x, const :ref:`Float`& y, const :ref:`Float`& Angle = 0, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`RenderMode`& Effect = :ref:`RENDER_NORMAL`, :ref:`OriginPoint` Center = :ref:`OriginPoint`(OriginPoint::OriginCenter), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ) Render the texture on screen .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - The x position on screen * - y - The y position on screen * - Angle - The Angle of the texture rendered * - scale - The Scale factor of the rendered texture * - color - The texture color * - Blend - Set the Blend Mode ( default :ref:`BlendMode::Alpha() `) * - Effect - Set the Render Effect ( default RN_NORMAL, no effect ) * - Center - The rotation and scaling center. The center point is relative to the top-left corner of the object. * - texSector - The texture sector to render. You can render only a part of the texture. ( default render all the texture ) .. index:: pair: function; drawEx .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a532ae9fca5d2ed9af3655b2632132675: .. ref-code-block:: cpp :class: doxyrest-title-code-block void drawEx( :ref:`Float` x, :ref:`Float` y, :ref:`Float` width = 0.0f, :ref:`Float` height = 0.0f, const :ref:`Float`& Angle = 0, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& Color0 = Color::White, const :ref:`Color`& Color1 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color2 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color3 = :ref:`Color`(255, 255, 255, 255), const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`RenderMode`& Effect = :ref:`RENDER_NORMAL`, :ref:`OriginPoint` Center = :ref:`OriginPoint`(OriginPoint::OriginCenter), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ) Render the texture on screen. Extended because can set the vertex colors individually .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - The x position on screen * - y - The y position on screen * - width - The width of the texture rendered ( when Scale = 1, otherwise this width will be scaled like width \* Scale ) * - height - The height of the texture rendered ( when Scale = 1, otherwise this height will be scaled like height \* Scale ) * - Angle - The Angle of the texture rendered * - scale - The Scale factor of the rendered texture * - Color0 - The Left - Top vertex color * - Color1 - The Left - Bottom vertex color * - Color2 - The Right - Bottom vertex color * - Color3 - The Right - Top vertex color * - Blend - Set the Blend Mode ( default :ref:`BlendMode::Alpha() `) * - Effect - Set the Render Effect ( default RN_NORMAL, no effect ) * - Center - The rotation and scaling center. The center point is relative to the top-left corner of the object. * - texSector - The texture sector to render. You can render only a part of the texture. ( default render all the texture ) .. index:: pair: function; drawQuad .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a669b6ba6e1de1683326c622cd1b1aa54: .. ref-code-block:: cpp :class: doxyrest-title-code-block void drawQuad( const :ref:`Quad2f`& Q, const :ref:`Vector2f`& Offset = :ref:`Vector2f`(), const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), const :ref:`Rect`& texSector = :ref:`Rect`(0, 0, 0, 0) ) Render a quad on Screen .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Q - The Quad2f * - Offset - The Offset applied to all the coordinates on Quad2f * - Angle - The Angle of the Quad2f rendered * - scale - The Scale of the Quad2f rendered * - color - The Quad2f color * - Blend - Set the Blend Mode ( default :ref:`BlendMode::Alpha() `) * - texSector - The texture sector to render. You can render only a part of the texture. ( default render all the texture ) .. index:: pair: function; drawQuadEx .. _doxid-class_e_e_1_1_graphics_1_1_texture_1ab0b06654303e04dcfc04822b6a98e933: .. ref-code-block:: cpp :class: doxyrest-title-code-block void drawQuadEx( :ref:`Quad2f` Q, const :ref:`Vector2f`& Offset = :ref:`Vector2f`(), const :ref:`Float`& Angle = 0.0f, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Color`& Color0 = Color::White, const :ref:`Color`& Color1 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color2 = :ref:`Color`(255, 255, 255, 255), const :ref:`Color`& Color3 = :ref:`Color`(255, 255, 255, 255), const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`(), :ref:`Rect` texSector = :ref:`Rect`(0, 0, 0, 0) ) Render a quad on Screen .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Q - The Quad2f * - Offset - The Offset applied to all the coordinates on Quad2f * - Angle - The Angle of the Quad2f rendered * - scale - The Scale of the Quad2f rendered * - Color0 - The Left - Top vertex color * - Color1 - The Left - Bottom vertex color * - Color2 - The Right - Bottom vertex color * - Color3 - The Right - Top vertex color * - Blend - Set the Blend Mode ( default :ref:`BlendMode::Alpha() `) * - texSector - The texture sector to render. You can render only a part of the texture. ( default render all the texture ) .. index:: pair: function; setTextureId .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a303a455f65ea327157c4f25b88842aee: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTextureId(const :ref:`Uint32`& id) Set the texture factory internal id of the texture .. index:: pair: function; getTextureId .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a7138bffa61fe29623b2ee59818b06483: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getTextureId() const .. rubric:: Returns: The texture factory internal id of the texture .. index:: pair: function; reload .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a2701e2ae7b726414ac9292842851bed2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void reload() Reload the texture from the current local copy. .. index:: pair: function; setPixel .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a3986e7846010e614d54c09d82e178afa: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void setPixel(const unsigned int& x, const unsigned int& y, const :ref:`Color`& Color) Set a pixel to the locked texture. .. index:: pair: function; bind .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a5a7b909270deb17113413dd7b191f0dd: .. ref-code-block:: cpp :class: doxyrest-title-code-block void bind(:ref:`CoordinateType` coordinateType, const :ref:`Uint32`& textureUnit = 0) Bind the texture. Activate the texture for rendering. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - coordinateType - Type of texture coordinates to use * - textureUnit - The :ref:`Texture ` unit that want to be used to bind ( usually 0 ) .. index:: pair: function; bind .. _doxid-class_e_e_1_1_graphics_1_1_texture_1acc7a9b903f9b0d5d4b3da6e3ee4afdf0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void bind(const :ref:`Uint32`& textureUnit = 0) Bind the texture. Activate the texture for rendering. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - textureUnit - The :ref:`Texture ` unit that want to be used to bind ( usually 0 ) .. index:: pair: function; getCoordinateType .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a6e8e189c43c18295dd91b85fd10ea850: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`CoordinateType`& getCoordinateType() const return The reference coordinate type. .. index:: pair: function; setCoordinateType .. _doxid-class_e_e_1_1_graphics_1_1_texture_1a8bb195fa3c7d98b090d8655cbb4b7529: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setCoordinateType(const :ref:`CoordinateType`& coordinateType) Sets the default coordinate type. This value is not forced when binded, but used as a reference for binding in the case of textures with a reference coordinate type.