Method

CoglPipelineset_blend

Declaration [src]

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

Description [src]

If not already familiar; please refer here for an overview of what blend strings are, and their syntax.

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:

  <channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))

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()

The source names can be used according to the color-source and factor syntax, so for example “(1-SRC_COLOR[A])” would be a valid factor, as would “(CONSTANT[RGB])”

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.

Stability:Unstable
Available since:2.0

Parameters

blend_string const char*
 

A Cogl blend string describing the desired blend function.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: 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).