Method
CoglPipelineset_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:
<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 fragmentDST_COLOR
: The color of the framebufferCONSTANT
: The constant set viacogl_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) wheref = 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 aNULL
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.