Add example for `FT_Get_Color_Glyph_Layer'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 1dbcf17..2daf529 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -4256,6 +4256,43 @@ FT_BEGIN_HEADER
*
* @FT_Render_Glyph, however, handles colored glyph layers
* automatically if the @FT_LOAD_COLOR flag is passed to it.
+ *
+ * @example:
+ * {
+ * FT_Color* palette;
+ * FT_LayerIterator iterator;
+ *
+ * FT_UInt layer_glyph_index;
+ * FT_UInt layer_color_index;
+ *
+ *
+ * error = FT_Palette_Select( face, palette_index, &palette );
+ * if ( error )
+ * palette = NULL;
+ *
+ * iterator.p = NULL;
+ * layer_glyph_index = FT_Get_Color_Glyph_Layer( face,
+ * glyph_index,
+ * &layer_color_index,
+ * &iterator );
+ *
+ * if ( palette && layer_glyph_index )
+ * {
+ * do
+ * {
+ * FT_Color layer_color = palette[layer_color_index];
+ *
+ *
+ * // Load and render glyph `layer_glyph_index', then
+ * // blend resulting pixmap with previously created pixmaps.
+ *
+ * } while ( ( layer_glyph_index =
+ * FT_Get_Color_Glyph_Layer( face,
+ * glyph_index,
+ * &layer_color_index,
+ * &iterator ) ) != 0 );
+ * }
+ * }
*/
FT_EXPORT( FT_UInt )
FT_Get_Color_Glyph_Layer( FT_Face face,