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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
use libc; use std; use std::mem; pub mod extend; pub mod filter; pub mod pattern_type; pub struct Pattern { pub opaque: *mut libc::c_void } impl Pattern { pub fn add_color_stop_rgb(&mut self, offset: f64, red: f64, green: f64, blue: f64) { unsafe { cairo_pattern_add_color_stop_rgb(self.opaque, offset, red, green, blue); } } pub fn add_color_stop_rgba(&mut self, offset: f64, red: f64, green: f64, blue: f64, alpha: f64) { unsafe { cairo_pattern_add_color_stop_rgba(self.opaque, offset, red, green, blue, alpha); } } pub fn get_color_stop_count(&mut self) -> (super::Status, libc::c_int) { unsafe { let mut stop_count:libc::c_int = mem::zeroed(); let foreign_result = cairo_pattern_get_color_stop_count(self.opaque, &mut stop_count); return (foreign_result, stop_count); } } pub fn get_color_stop_rgba(&mut self, stop_count: libc::c_int) -> (super::Status, f64, f64, f64, f64, f64) { unsafe { let mut offset:f64 = mem::zeroed(); let mut red:f64 = mem::zeroed(); let mut green:f64 = mem::zeroed(); let mut blue:f64 = mem::zeroed(); let mut alpha:f64 = mem::zeroed(); let foreign_result = cairo_pattern_get_color_stop_rgba(self.opaque, stop_count, &mut offset, &mut red, &mut green, &mut blue, &mut alpha); return (foreign_result, offset, red, green, blue, alpha); } } pub fn create_rgb(red: f64, green: f64, blue: f64) -> Pattern { unsafe { let foreign_result = cairo_pattern_create_rgb(red, green, blue); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn create_rgba(red: f64, green: f64, blue: f64, alpha: f64) -> Pattern { unsafe { let foreign_result = cairo_pattern_create_rgba(red, green, blue, alpha); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn get_rgba(&mut self) -> (super::Status, f64, f64, f64, f64) { unsafe { let mut red:f64 = mem::zeroed(); let mut green:f64 = mem::zeroed(); let mut blue:f64 = mem::zeroed(); let mut alpha:f64 = mem::zeroed(); let foreign_result = cairo_pattern_get_rgba(self.opaque, &mut red, &mut green, &mut blue, &mut alpha); return (foreign_result, red, green, blue, alpha); } } pub fn create_for_surface(surface: &mut super::surface::Surface) -> Pattern { unsafe { let foreign_result = cairo_pattern_create_for_surface(surface.opaque); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn get_surface(&mut self) -> (super::Status, super::surface::Surface) { unsafe { let mut surface: *mut libc::c_void = mem::zeroed(); let foreign_result = cairo_pattern_get_surface(self.opaque, &mut surface); return (foreign_result, super::surface::Surface { opaque: surface }); } } pub fn create_linear(x0: f64, y0: f64, x1: f64, y1: f64) -> Pattern { unsafe { let foreign_result = cairo_pattern_create_linear(x0, y0, x1, y1); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn get_linear_points(&mut self) -> (super::Status, f64, f64, f64, f64) { unsafe { let mut x0:f64 = mem::zeroed(); let mut y0:f64 = mem::zeroed(); let mut x1:f64 = mem::zeroed(); let mut y1:f64 = mem::zeroed(); let foreign_result = cairo_pattern_get_linear_points(self.opaque, &mut x0, &mut y0, &mut x1, &mut y1); return (foreign_result, x0, y0, x1, y1); } } pub fn create_radial(cx0: f64, cy0: f64, radius0: f64, cx1: f64, cy1: f64, radius1: f64) -> Pattern { unsafe { let foreign_result = cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn get_radial_circles(&mut self) -> (super::Status, f64, f64, f64, f64, f64, f64) { unsafe { let mut x0:f64 = mem::zeroed(); let mut y0:f64 = mem::zeroed(); let mut r0:f64 = mem::zeroed(); let mut x1:f64 = mem::zeroed(); let mut y1:f64 = mem::zeroed(); let mut r1:f64 = mem::zeroed(); let foreign_result = cairo_pattern_get_radial_circles(self.opaque, &mut x0, &mut y0, &mut r0, &mut x1, &mut y1, &mut r1); return (foreign_result, x0, y0, r0, x1, y1, r1); } } pub fn create_mesh() -> Pattern { unsafe { let foreign_result = cairo_pattern_create_mesh(); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } pub fn begin_patch(&mut self) { unsafe { cairo_mesh_pattern_begin_patch(self.opaque); } } pub fn end_patch(&mut self) { unsafe { cairo_mesh_pattern_end_patch(self.opaque); } } pub fn move_to(&mut self, x: f64, y: f64) { unsafe { cairo_mesh_pattern_move_to(self.opaque, x, y); } } pub fn line_to(&mut self, x: f64, y: f64) { unsafe { cairo_mesh_pattern_line_to(self.opaque, x, y); } } pub fn curve_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64) { unsafe { cairo_mesh_pattern_curve_to(self.opaque, x1, y1, x2, y2, x3, y3); } } pub fn set_control_point(&mut self, point_num: libc::c_uint, x: f64, y: f64) { unsafe { cairo_mesh_pattern_set_control_point(self.opaque, point_num, x, y); } } pub fn set_corner_color_rgb(&mut self, corner_num: libc::c_uint, red: f64, green: f64, blue: f64) { unsafe { cairo_mesh_pattern_set_corner_color_rgb(self.opaque, corner_num, red, green, blue); } } pub fn set_corner_color_rgba(&mut self, corner_num: libc::c_uint, red: f64, green: f64, blue: f64, alpha: f64) { unsafe { cairo_mesh_pattern_set_corner_color_rgba(self.opaque, corner_num, red, green, blue, alpha); } } pub fn get_patch_count(&mut self) -> (super::Status, libc::c_uint) { unsafe { let mut count:libc::c_uint = mem::zeroed(); let foreign_result = cairo_mesh_pattern_get_patch_count(self.opaque, &mut count); return (foreign_result, count); } } pub fn get_path(&mut self, patch_num: libc::c_uint) -> super::path::Path { unsafe { let foreign_result = cairo_mesh_pattern_get_path(self.opaque, patch_num); return super::path::Path { opaque: foreign_result as *mut libc::c_void }; } } pub fn get_control_point(&mut self, patch_num: libc::c_uint, pointer_num: libc::c_uint) -> (super::Status, f64, f64) { unsafe { let mut x:f64 = mem::zeroed(); let mut y:f64 = mem::zeroed(); let foreign_result = cairo_mesh_pattern_get_control_point(self.opaque, patch_num, pointer_num, &mut x, &mut y); return (foreign_result, x, y); } } pub fn get_corner_color_rgba(&mut self, patch_num: libc::c_uint, pointer_num: libc::c_uint) -> (super::Status, f64, f64, f64, f64) { unsafe { let mut red:f64 = mem::zeroed(); let mut green:f64 = mem::zeroed(); let mut blue:f64 = mem::zeroed(); let mut alpha:f64 = mem::zeroed(); let foreign_result = cairo_mesh_pattern_get_corner_color_rgba(self.opaque, patch_num, pointer_num, &mut red, &mut green, &mut blue, &mut alpha); return (foreign_result, red, green, blue, alpha); } } pub fn status(&mut self) -> super::Status { unsafe { let foreign_result = cairo_pattern_status(self.opaque); return foreign_result; } } pub fn set_extend(&mut self, extend: extend::Extend) { unsafe { cairo_pattern_set_extend(self.opaque, extend); } } pub fn get_extend(&mut self) -> extend::Extend { unsafe { let foreign_result = cairo_pattern_get_extend(self.opaque); return foreign_result; } } pub fn set_filter(&mut self, filter: filter::Filter) { unsafe { cairo_pattern_set_filter(self.opaque, filter); } } pub fn get_filter(&mut self) -> filter::Filter { unsafe { let foreign_result = cairo_pattern_get_filter(self.opaque); return foreign_result; } } pub fn set_matrix(&mut self, matrix: &mut super::matrix::Matrix) { unsafe { cairo_pattern_set_matrix(self.opaque, matrix); } } pub fn get_matrix(&mut self) -> super::matrix::Matrix { unsafe { let mut matrix:super::matrix::Matrix = mem::zeroed(); cairo_pattern_get_matrix(self.opaque, &mut matrix); return matrix; } } pub fn get_type(&mut self) -> pattern_type::PatternType { unsafe { let foreign_result = cairo_pattern_get_type(self.opaque); return foreign_result; } } pub fn get_reference_count(&mut self) -> libc::c_uint { unsafe { let foreign_result = cairo_pattern_get_reference_count(self.opaque); return foreign_result; } } } extern { fn cairo_pattern_add_color_stop_rgb(self_arg: *mut libc::c_void, offset: f64, red: f64, green: f64, blue: f64); fn cairo_pattern_add_color_stop_rgba(self_arg: *mut libc::c_void, offset: f64, red: f64, green: f64, blue: f64, alpha: f64); fn cairo_pattern_get_color_stop_count(self_arg: *mut libc::c_void, stop_count: *mut libc::c_int) -> super::Status; fn cairo_pattern_get_color_stop_rgba(self_arg: *mut libc::c_void, stop_count: libc::c_int, offset: *mut f64, red: *mut f64, green: *mut f64, blue: *mut f64, alpha: *mut f64) -> super::Status; fn cairo_pattern_create_rgb(red: f64, green: f64, blue: f64) -> *mut libc::c_void; fn cairo_pattern_create_rgba(red: f64, green: f64, blue: f64, alpha: f64) -> *mut libc::c_void; fn cairo_pattern_get_rgba(self_arg: *mut libc::c_void, red: *mut f64, green: *mut f64, blue: *mut f64, alpha: *mut f64) -> super::Status; fn cairo_pattern_create_for_surface(surface: *mut libc::c_void) -> *mut libc::c_void; fn cairo_pattern_get_surface(self_arg: *mut libc::c_void, surface: *mut *mut libc::c_void) -> super::Status; fn cairo_pattern_create_linear(x0: f64, y0: f64, x1: f64, y1: f64) -> *mut libc::c_void; fn cairo_pattern_get_linear_points(self_arg: *mut libc::c_void, x0: *mut f64, y0: *mut f64, x1: *mut f64, y1: *mut f64) -> super::Status; fn cairo_pattern_create_radial(cx0: f64, cy0: f64, radius0: f64, cx1: f64, cy1: f64, radius1: f64) -> *mut libc::c_void; fn cairo_pattern_get_radial_circles(self_arg: *mut libc::c_void, x0: *mut f64, y0: *mut f64, r0: *mut f64, x1: *mut f64, y1: *mut f64, r1: *mut f64) -> super::Status; fn cairo_pattern_create_mesh() -> *mut libc::c_void; fn cairo_mesh_pattern_begin_patch(self_arg: *mut libc::c_void); fn cairo_mesh_pattern_end_patch(self_arg: *mut libc::c_void); fn cairo_mesh_pattern_move_to(self_arg: *mut libc::c_void, x: f64, y: f64); fn cairo_mesh_pattern_line_to(self_arg: *mut libc::c_void, x: f64, y: f64); fn cairo_mesh_pattern_curve_to(self_arg: *mut libc::c_void, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64); fn cairo_mesh_pattern_set_control_point(self_arg: *mut libc::c_void, point_num: libc::c_uint, x: f64, y: f64); fn cairo_mesh_pattern_set_corner_color_rgb(self_arg: *mut libc::c_void, corner_num: libc::c_uint, red: f64, green: f64, blue: f64); fn cairo_mesh_pattern_set_corner_color_rgba(self_arg: *mut libc::c_void, corner_num: libc::c_uint, red: f64, green: f64, blue: f64, alpha: f64); fn cairo_mesh_pattern_get_patch_count(self_arg: *mut libc::c_void, count: *mut libc::c_uint) -> super::Status; fn cairo_mesh_pattern_get_path(self_arg: *mut libc::c_void, patch_num: libc::c_uint) -> *mut libc::c_void; fn cairo_mesh_pattern_get_control_point(self_arg: *mut libc::c_void, patch_num: libc::c_uint, pointer_num: libc::c_uint, x: *mut f64, y: *mut f64) -> super::Status; fn cairo_mesh_pattern_get_corner_color_rgba(self_arg: *mut libc::c_void, patch_num: libc::c_uint, pointer_num: libc::c_uint, red: *mut f64, green: *mut f64, blue: *mut f64, alpha: *mut f64) -> super::Status; fn cairo_pattern_status(self_arg: *mut libc::c_void) -> super::Status; fn cairo_pattern_set_extend(self_arg: *mut libc::c_void, extend: extend::Extend); fn cairo_pattern_get_extend(self_arg: *mut libc::c_void) -> extend::Extend; fn cairo_pattern_set_filter(self_arg: *mut libc::c_void, filter: filter::Filter); fn cairo_pattern_get_filter(self_arg: *mut libc::c_void) -> filter::Filter; fn cairo_pattern_set_matrix(self_arg: *mut libc::c_void, matrix: *mut super::matrix::Matrix); fn cairo_pattern_get_matrix(self_arg: *mut libc::c_void, matrix: *mut super::matrix::Matrix); fn cairo_pattern_get_type(self_arg: *mut libc::c_void) -> pattern_type::PatternType; fn cairo_pattern_get_reference_count(self_arg: *mut libc::c_void) -> libc::c_uint; } impl std::clone::Clone for Pattern { fn clone(&self) -> Pattern { unsafe { let foreign_result = cairo_pattern_reference(self.opaque); return Pattern { opaque: foreign_result as *mut libc::c_void }; } } } extern { fn cairo_pattern_reference(self_arg: *mut libc::c_void) -> *mut libc::c_void; } impl std::ops::Drop for Pattern { fn drop(&mut self) { unsafe { cairo_pattern_destroy(self.opaque); } } } extern { fn cairo_pattern_destroy(self_arg: *mut libc::c_void); }