
###################
A3DGraphPictureData
###################

.. c:struct:: A3DGraphPictureData

   A description of a two-dimensional picture.
   
   
      2.0
   
   
   A picture is a set of color information organised according to a specific memory layout known as format. HOOPS supports various layouts such as RGB or grayscale.
   
   Pictures are mainly used within textures descriptions. To known how to read or define texture information within Exchange, see ``A3DGraphTextureDefinitionData``\ .
   
   The pixel array is describes row-major, where the origin is at the topleft corner of the image.
   
   The following code describes an RGB 255x100 image with a color fading from red to green:
   
   
   ::
   
      A3DGraphPictureDatapicture=A3D_MAKE_DATA(A3DGraphPictureData);
      picture.m_eFormat=kA3DPictureBitmapRgbByte;
      picture.m_uiPixelWidth=255;
      picture.m_uiPixelHeight=100;
      picture.m_uiSize=picture.m_uiPixelWidth*picture.m_uiPixelHeight*3;
      picture.m_pucBinaryData=malloc(picture.m_uiSize);
      for(A3DUns32row=0;row<picture.m_uiPixelHeight;++row){
      for(A3DUns32column=0;column<picture.m_uiPixelHeight;++column){
      A3DUns32red_i=(picture.m_uiPixelWidth*row+column)*3;
      A3DUns32green_i=red_i+1;
      A3DUns32blue_i=green_i+1;
      picture.m_pucBinaryData[red_i]=255-row;
      picture.m_pucBinaryData[green_i]=row;
      picture.m_pucBinaryData[blue]=0;
      }
      }
   
   The following function is an example on how to use [OpenGL 4 ``glTexImage2D``\ ] with HOOPS picture data:
   
   
   ::
   
      A3DStatuspicture_data_to_gl_texture(constA3DGraphPictureData*picture)
      {
      assert(picture);
      
      GLenumtarget=GL_TEXTURE_2D;
      GLenumlevel=0;
      GLsizeiwidth=picture->m_uiPixelWidth;
      GLsizeiheight=picture->m_uiPixelHeight;
      GLintborder=0;
      GLenumtype=GL_UNSIGNED_BYTE;
      GLintinternalformat;
      GLenumformat;
      
      switch(picture->m_eFormat){
      casekA3DPictureBitmapGreyByte:internalformat=GL_RED;format=GL_RED_INTEGER;break;
      casekA3DPictureBitmapGreyaByte:internalformat=GL_RG;format=GL_RG_INTEGER;break;
      casekA3DPictureBitmapRgbByte:internalformat=GL_RGB;format=GL_RGB_INTEGER;break;
      casekA3DPictureBitmapRgbaByte:internalformat=GL_RGBA;format=GL_RGBA_INTEGER;break;
      default:returnA3D_ERROR;
      }
      
      glTexImage2D(target,level,internalformat,
      width,height,border,
      format,type,picture->m_pucBinaryData
      );
      
      returnA3D_SUCCESS;
      }
   
   
      :c:func:`~A3DGlobalGetGraphPictureData`
   
   
   
      :c:func:`~A3DGlobalInsertGraphPicture`
   
   
   
      :c:struct:`~A3DGraphTextureDefinitionData`
   
   
   
      :c:func:`~A3DGlobalInsertGraphTextureDefinition`
   
   
   
   Index
   =====
   
   .. rubric:: Variables
   
   
   .. rst-class:: api-xref-list
   
   
   * :c:member:`~A3DGraphPictureData.m_eFormat`
   * :c:member:`~A3DGraphPictureData.m_uiSize`
   * :c:member:`~A3DGraphPictureData.m_pucBinaryData`
   * :c:member:`~A3DGraphPictureData.m_uiPixelWidth`
   * :c:member:`~A3DGraphPictureData.m_uiPixelHeight`
   
   



.. rst-class:: kind-group kind-variable

.. rubric:: Variables
   :class: kind-group-title


.. c:member:: A3DEPictureDataFormat A3DGraphPictureData.m_eFormat

      .. rst-class:: sig-pretty-signature
      
         | :c:enum:`~A3DEPictureDataFormat`
      
      Image format specifier.
      



.. c:member:: A3DUns32 A3DGraphPictureData.m_uiSize

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      The size of ``m_pucBinaryData``\ in bytes.
      



.. c:member:: A3DUns8* A3DGraphPictureData.m_pucBinaryData

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns8`\ \*
      
      Image binary data.
      



.. c:member:: A3DUns32 A3DGraphPictureData.m_uiPixelWidth

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      Image width in pixels. If picture dimension is part of ``m_pucBinaryData``\ , this field is *0*\ .
      



.. c:member:: A3DUns32 A3DGraphPictureData.m_uiPixelHeight

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      Image height in pixels. If picture dimension is part of ``m_pucBinaryData``\ , this field is *0*\ .
      




