/src/wrappers/gdk/library/gdk_color.e
Specman e | 157 lines | 112 code | 27 blank | 18 comment | 0 complexity | 4a1f102c62d2fb25149428e90585ba1e MD5 | raw file
1indexing 2 description: "The GdkColor structure is used to describe an allocated or unallocated color." 3 copyright: "(C) 2006 Paolo Redaelli " 4 license: "LGPL v2 or later" 5 date: "$Date:$" 6 revision: "$Revision:$" 7 8class GDK_COLOR 9 10inherit 11 C_STRUCT 12 redefine 13 copy 14 end 15creation 16 from_external_pointer, make 17 18feature 19 20 struct_size: INTEGER is 21 external "C inline use <gdk/gdk.h>" 22 alias "sizeof(GdkColor)" 23 end 24 25 make is 26 do 27 allocate 28 end 29 30 dispose is 31 do 32 gdk_color_free (handle) 33 end 34 35 copy (another: like Current) is 36 do 37 from_external_pointer(gdk_color_copy(handle)) 38 end 39 40feature -- Getters and setters 41 42 is_allocated: BOOLEAN 43 -- Not implemented, we still need GdkColormaps for this. 44 -- Shall be set to True after a call to gdk_color_alloc() 45 -- or gdk_colors_alloc() 46 47 pixel: INTEGER is 48 -- For allocated colors, the value used to draw this color on the 49 -- screen. 50 require 51 is_allocated 52 do 53 Result := get_pixel_external (handle) 54 ensure 55 Result > 0 56 end 57 58 red: INTEGER is 59 -- The red component of the color. This is a value between 0 and 60 -- 65535, with 65535 indicating full intensitiy. 61 do 62 Result := get_red_external (handle) 63 ensure 64 Result.in_range (0, 65535) 65 end 66 67 green: INTEGER is 68 -- The green component of the color. 69 do 70 Result := get_green_external (handle) 71 ensure 72 Result.in_range (0, 65535) 73 end 74 75 blue: INTEGER is 76 -- The blue component of the color. 77 do 78 Result := get_blue_external (handle) 79 ensure 80 Result.in_range (0, 65535) 81 end 82 83 set_red (a_red: INTEGER) is 84 require 85 a_red.in_range (0, 65535) 86 do 87 set_red_external (handle, a_red) 88 ensure 89 red = a_red 90 end 91 92 set_green (a_green: INTEGER) is 93 require 94 a_green.in_range (0, 65535) 95 do 96 set_green_external (handle, a_green) 97 ensure 98 green = a_green 99 end 100 101 set_blue (a_blue: INTEGER) is 102 require 103 a_blue.in_range (0, 65535) 104 do 105 set_blue_external (handle, a_blue) 106 ensure 107 blue = a_blue 108 end 109 110feature {} -- Low level access 111 112 gdk_color_copy (a_color: POINTER): POINTER is 113 -- GdkColor* gdk_color_copy (const GdkColor *color); 114 external "C use <gdk/gdk.h>" 115 end 116 117 gdk_color_free (a_color: POINTER) is 118 -- void gdk_color_free (GdkColor *color); 119 external "C use <gdk/gdk.h>" 120 end 121 122 get_pixel_external (ptr: POINTER): INTEGER is 123 -- Note: Result shall be NATURAL_32 since itr's a guint32 124 external "C struct GdkColor get pixel use <gdk/gdk.h>" 125 end 126 127 get_red_external (ptr: POINTER): INTEGER is 128 -- Note: Result shall be NATURAL_16 since itr's a guint16 129 external "C struct GdkColor get red use <gdk/gdk.h>" 130 end 131 132 set_red_external (ptr: POINTER; a_red: INTEGER) is 133 -- NOTE: a_red shall be a NATURAL_16 since it's a guint16 134 external "C struct GdkColor set red use <gdk/gdk.h>" 135 end 136 137 get_green_external (ptr: POINTER): INTEGER is 138 -- Note: Result shall be NATURAL_16 since itr's a guint16 139 external "C struct GdkColor get green use <gdk/gdk.h>" 140 end 141 142 set_green_external (ptr: POINTER; a_green: INTEGER) is 143 -- NOTE: a_ shall be a NATURAL_16 since it's a guint16 144 external "C struct GdkColor set green use <gdk/gdk.h>" 145 end 146 147 get_blue_external (ptr: POINTER): INTEGER is 148 -- Note: Result shall be NATURAL_16 since itr's a guint16 149 external "C struct GdkColor get blue use <gdk/gdk.h>" 150 end 151 152 set_blue_external (ptr: POINTER; a_blue: INTEGER) is 153 -- NOTE: a_blue shall be a NATURAL_16 since it's a guint16 154 external "C struct GdkColor set blue use <gdk/gdk.h>" 155 end 156 157end