Cogl.Pipeline.set_blend

### Method

# Cogl Pipelineset_blend

#### Declaration [src]

    gboolean
    cogl_pipeline_set_blend (
      CoglPipeline* pipeline,
      const char* blend_string,
      GError** error
    )

#### Description [src]

Blending occurs after the alpha test function, and combines fragments with the framebuffer.

Currently the only blend function Cogl exposes is ADD(). So any valid blend statements will be of the form:

      &lt;channel-mask&gt;=ADD(SRC_COLOR*(&lt;factor&gt;), DST_COLOR*(&lt;factor&gt;))

This is the list of source-names usable as blend factors:

- `SRC_COLOR`: The color of the incoming fragment
- `DST_COLOR`: The color of the framebuffer
- `CONSTANT`: The constant set via `cogl_pipeline_set_blend_constant()`

These can also be used as factors:

- `0`: (0, 0, 0, 0)
- `1`: (1, 1, 1, 1)
- `SRC_ALPHA_SATURATE_FACTOR`: (f,f,f,1) where `f = MIN(SRC_COLOR[A],1-DST_COLOR[A])`

Remember; all color components are normalized to the range [0, 1] before computing the result of blending.

- Blend Strings/1: Blend a non-premultiplied source over a destination with premultiplied alpha: `"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))" "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"`

Blend Strings/2: Blend a premultiplied source over a destination with premultiplied alpha `"RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"`

The default blend string is:

       RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))

That gives normal alpha-blending when the calculated color for the pipeline is in premultiplied form.

#### Parameters

`blend_string`

  Type: `const char*`

  A Cogl blend string describing the desired blend function.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if the blend string was successfully parsed, and the described blending is supported by the underlying driver/hardware. If there was an error, `FALSE` is returned and `error` is set accordingly (if present).