.. role:: ts-api-decorator

#######
Texture
#######

.. js:module:: cee
   :noindex:

.. container:: ts-api-section

   .. js:class:: Texture

      Factory for creating texture objects



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.Texture.fromHTMLImageElement`
   * :js:meth:`~cee.Texture.fromImageData`





------------

Methods
=======

.. rst-class:: ts-api-section

:ts-api-decorator:`static` fromHTMLImageElement
-----------------------------------------------

.. js:method:: Texture.fromHTMLImageElement( htmlImageElement[, textureOptions])

   :param htmlImageElement: None
   :type htmlImageElement: HTMLImageElement
   :param textureOptions: :ts-api-decorator:`optional` None
   :type textureOptions: TextureOptions


   Creates a texture image object from an HTMLImageElement

   **Note:** A general rule is that both dimensions must be a power of two. 

   To avoid this limitation, pass in texture options with 
   generateMipmaps set to false, wrapMode set to TextureWrapMode.CLAMP_TO_EDGE and minFilter set to LINEAR or NEAREST. E.g.:

   .. code-block:: javascript

      const texture = cee.Texture.fromImageData(imageData, 
          { generateMipmaps: false, 
            wrapMode: cee.TextureWrapMode.CLAMP_TO_EDGE, 
            minFilter: cee.TextureMinFilter.LINEAR 
          });  



   :rtype: Texture

.. rst-class:: ts-api-section

:ts-api-decorator:`static` fromImageData
----------------------------------------

.. js:method:: Texture.fromImageData( imageData[, textureOptions])

   :param imageData: None
   :type imageData: ImageData
   :param textureOptions: :ts-api-decorator:`optional` None
   :type textureOptions: TextureOptions


   Creates a texture image object from ImageData

   **Note:** A general rule is that both dimensions must be a power of two. 

   To avoid this limitation, pass in texture options with 
   generateMipmaps set to false, wrapMode set to TextureWrapMode.CLAMP_TO_EDGE and minFilter set to LINEAR or NEAREST. E.g.:

   .. code-block:: javascript

      const texture = cee.Texture.fromImageData(imageData, 
          { generateMipmaps: false, 
            wrapMode: cee.TextureWrapMode.CLAMP_TO_EDGE, 
            minFilter: cee.TextureMinFilter.LINEAR 
          });  



   :rtype: Texture

