# A3DGraphPictureData

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

  Variables

  - `m_eFormat`
  - `m_uiSize`
  - `m_pucBinaryData`
  - `m_uiPixelWidth`
  - `m_uiPixelHeight`

Variables

A3DEPictureDataFormat `A3DGraphPictureData.``m_eFormat`
  `A3DEPictureDataFormat`

  Image format specifier.

A3DUns32 `A3DGraphPictureData.``m_uiSize`
  `A3DUns32`

  The size of `m_pucBinaryData`in bytes.

A3DUns8 *`A3DGraphPictureData.``m_pucBinaryData`
  `A3DUns8`*

  Image binary data.

A3DUns32 `A3DGraphPictureData.``m_uiPixelWidth`
  `A3DUns32`

  Image width in pixels. If picture dimension is part of `m_pucBinaryData`, this field is 0.

A3DUns32 `A3DGraphPictureData.``m_uiPixelHeight`
  `A3DUns32`

  Image height in pixels. If picture dimension is part of `m_pucBinaryData`, this field is 0.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Exchange in your own language, or choose a sample question below to start a conversation:

What is HOOPS Exchange?
What are the latest release notes for HOOPS Exchange?
How do I start evaluating HOOPS Exchange?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...