1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gsk.ColorMatrixNode; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import graphene.Matrix; 30 private import graphene.Vec4; 31 private import gsk.RenderNode; 32 private import gsk.c.functions; 33 public import gsk.c.types; 34 35 36 /** 37 * A render node controlling the color matrix of its single child node. 38 */ 39 public class ColorMatrixNode : RenderNode 40 { 41 /** the main Gtk struct */ 42 protected GskColorMatrixNode* gskColorMatrixNode; 43 44 /** Get the main Gtk struct */ 45 public GskColorMatrixNode* getColorMatrixNodeStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gskColorMatrixNode; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gskColorMatrixNode; 56 } 57 58 /** 59 * Sets our main struct and passes it to the parent class. 60 */ 61 public this (GskColorMatrixNode* gskColorMatrixNode, bool ownedRef = false) 62 { 63 this.gskColorMatrixNode = gskColorMatrixNode; 64 super(cast(GskRenderNode*)gskColorMatrixNode, ownedRef); 65 } 66 67 68 /** */ 69 public static GType getType() 70 { 71 return gsk_color_matrix_node_get_type(); 72 } 73 74 /** 75 * Creates a `GskRenderNode` that will drawn the @child with 76 * @color_matrix. 77 * 78 * In particular, the node will transform the operation 79 * 80 * pixel = color_matrix * pixel + color_offset 81 * 82 * for every pixel. 83 * 84 * Params: 85 * child = The node to draw 86 * colorMatrix = The matrix to apply 87 * colorOffset = Values to add to the color 88 * 89 * Returns: A new `GskRenderNode` 90 * 91 * Throws: ConstructionException GTK+ fails to create the object. 92 */ 93 public this(RenderNode child, Matrix colorMatrix, Vec4 colorOffset) 94 { 95 auto __p = gsk_color_matrix_node_new((child is null) ? null : child.getRenderNodeStruct(), (colorMatrix is null) ? null : colorMatrix.getMatrixStruct(), (colorOffset is null) ? null : colorOffset.getVec4Struct()); 96 97 if(__p is null) 98 { 99 throw new ConstructionException("null returned by new"); 100 } 101 102 this(cast(GskColorMatrixNode*) __p); 103 } 104 105 /** 106 * Gets the child node that is getting its colors modified by the given @node. 107 * 108 * Returns: The child that is getting its colors modified 109 */ 110 public RenderNode getChild() 111 { 112 auto __p = gsk_color_matrix_node_get_child(cast(GskRenderNode*)gskColorMatrixNode); 113 114 if(__p is null) 115 { 116 return null; 117 } 118 119 return ObjectG.getDObject!(RenderNode)(cast(GskRenderNode*) __p); 120 } 121 122 /** 123 * Retrieves the color matrix used by the @node. 124 * 125 * Returns: a 4x4 color matrix 126 */ 127 public Matrix getColorMatrix() 128 { 129 auto __p = gsk_color_matrix_node_get_color_matrix(cast(GskRenderNode*)gskColorMatrixNode); 130 131 if(__p is null) 132 { 133 return null; 134 } 135 136 return ObjectG.getDObject!(Matrix)(cast(graphene_matrix_t*) __p); 137 } 138 139 /** 140 * Retrieves the color offset used by the @node. 141 * 142 * Returns: a color vector 143 */ 144 public Vec4 getColorOffset() 145 { 146 auto __p = gsk_color_matrix_node_get_color_offset(cast(GskRenderNode*)gskColorMatrixNode); 147 148 if(__p is null) 149 { 150 return null; 151 } 152 153 return ObjectG.getDObject!(Vec4)(cast(graphene_vec4_t*) __p); 154 } 155 }