Cogl.Texture.foreach_in_region

### Method

# Cogl Textureforeach_in_region

#### Declaration [src]

    void
    cogl_texture_foreach_in_region (
      CoglTexture* texture,
      float tx_1,
      float ty_1,
      float tx_2,
      float ty_2,
      CoglPipelineWrapMode wrap_s,
      CoglPipelineWrapMode wrap_t,
      CoglTextureForeachCallback callback,
      void* user_data
    )

#### Description [src]

Allows you to manually iterate the low-level textures that define a given region of a high-level `CoglTexture`.

For example `cogl_texture_2d_sliced_new_with_size()` can be used to create a meta texture that may slice a large image into multiple, smaller power-of-two sized textures. These high level textures are not directly understood by a GPU and so this API must be used to manually resolve the underlying textures for drawing.

All high level textures (`CoglAtlasTexture`, `CoglSubTexture`, `CoglTexturePixmapX11`, and `CoglTexture2DSliced`) can be handled consistently using this interface which greately simplifies implementing primitives that support all texture types.

For example if you use the `cogl_rectangle()` API then Cogl will internally use this API to resolve the low level textures of any meta textures you have associated with CoglPipeline layers.

The low level drawing APIs such as `cogl_primitive_draw()` don’t understand the `CoglTexture` interface and so it is your responsibility to use this API to resolve all CoglPipeline textures into low-level textures before drawing.

For each low-level texture that makes up part of the given region of the `meta_texture`, `callback` is called specifying how the low-level texture maps to the original region.

#### Parameters

`tx_1`

  Type: `float`

  The top-left x coordinate of the region to iterate.

`ty_1`

  Type: `float`

  The top-left y coordinate of the region to iterate.

`tx_2`

  Type: `float`

  The bottom-right x coordinate of the region to iterate.

`ty_2`

  Type: `float`

  The bottom-right y coordinate of the region to iterate.

`wrap_s`

  Type: `CoglPipelineWrapMode`

  The wrap mode for the x-axis.

`wrap_t`

  Type: `CoglPipelineWrapMode`

  The wrap mode for the y-axis.

`callback`

  Type: `CoglTextureForeachCallback`

  A `CoglTextureForeachCallback` pointer to be called for each low-level texture within the specified region.

`user_data`

  Type: `void*`

  A private pointer that is passed to `callback`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.