1[CCode (cheader_filename = "pixman.h")] 2namespace Pixman { 3 namespace Version { 4 public const int MAJOR; 5 public const int MINOR; 6 public const int MICRO; 7 public const string STRING; 8 [CCode (cname = "PIXMAN_VERSION")] 9 public const int INT; 10 11 [CCode (cname = "PIXMAN_VERSION_ENCODE")] 12 public static int encode (int major, int minor, int micro); 13 [CCode (cname = "pixman_version")] 14 public static int library_int (); 15 [CCode (cname = "pixman_version_string")] 16 public static unowned string library_string (); 17 } 18 19 [SimpleType, IntegerType (rank = 6), CCode (cname = "pixman_fixed_16_16_t", has_type_id = false)] 20 public struct Fixed1616 : int32 { 21 } 22 23 [SimpleType, IntegerType (rank = 6), CCode (cname = "pixman_fixed_t", has_type_id = false)] 24 public struct Fixed : Fixed1616 { 25 [CCode (cname = "pixman_double_to_fixed")] 26 public Fixed.double (double val); 27 [CCode (cname = "pixman_int_to_fixed")] 28 public Fixed.int (int val); 29 public int to_int (); 30 public double to_double (); 31 public Fixed frac (); 32 public Fixed floor (); 33 public Fixed ceil (); 34 public Fixed fraction (); 35 public Fixed mod_2 (); 36 [CCode (cname = "pixman_sample_ceil_y")] 37 public Fixed sample_ceil_y (int bpp); 38 [CCode (cname = "pixman_sample_floor_y")] 39 public Fixed sample_floor_y (int bpp); 40 } 41 42 [CCode (cname = "pixman_color_t", has_type_id = false)] 43 public struct Color { 44 public uint16 red; 45 public uint16 green; 46 public uint16 blue; 47 public uint16 alpha; 48 } 49 50 [CCode (cname = "pixman_point_fixed_t", has_type_id = false)] 51 public struct PointFixed { 52 public Pixman.Fixed x; 53 public Pixman.Fixed y; 54 } 55 56 [CCode (cname = "pixman_line_fixed_t", has_type_id = false)] 57 public struct LineFixed { 58 public Pixman.PointFixed p1; 59 public Pixman.PointFixed p2; 60 } 61 62 [CCode (cname = "pixman_vector_t", has_type_id = false)] 63 public struct Vector { 64 public Pixman.Fixed vector[3]; 65 } 66 67 [CCode (cname = "pixman_transform_t", has_type_id = false)] 68 public struct Transform { 69 public Pixman.Fixed matrix[9]; 70 71 [CCode (cname = "pixman_transform_init_identity")] 72 public Transform.identity (); 73 public bool point_3d (Pixman.Vector vector); 74 public bool point (Pixman.Vector vector); 75 public bool multiply (Pixman.Transform l, Pixman.Transform r); 76 [CCode (cname = "pixman_transform_init_scale")] 77 public Transform.init_scale (Pixman.Fixed sx, Pixman.Fixed sy); 78 public bool scale (Pixman.Transform reverse, Pixman.Fixed sx, Pixman.Fixed sy); 79 [CCode (cname = "pixman_transform_init_rotate")] 80 public Transform.init_rotate (Pixman.Fixed cos, Pixman.Fixed sin); 81 public bool rotate (Pixman.Transform reverse, Pixman.Fixed c, Pixman.Fixed s); 82 [CCode (cname = "pixman_transform_init_translate")] 83 public Transform.init_translate (Pixman.Fixed tx, Pixman.Fixed ty); 84 public bool translate (Pixman.Transform reverse, Pixman.Fixed tx, Pixman.Fixed ty); 85 public bool bounds (Pixman.Box16 b); 86 public bool is_identity (); 87 public bool is_scale (); 88 public bool is_int_translate (); 89 public bool is_inverse (Pixman.Transform b); 90 } 91 92 [CCode (cname = "pixman_region_overlap_t", cprefix = "PIXMAN_REGION_", has_type_id = false)] 93 public enum RegionOverlap { 94 OUT, 95 IN, 96 PART 97 } 98 99 [CCode (cname = "pixman_region16_t", has_type_id = false, cprefix = "pixman_region_", destroy_function = "pixman_region_fini")] 100 public struct Region16 { 101 Pixman.Box16 extents; 102 103 public Region16 (); 104 public Region16.rect (int x, int y, uint width, uint height); 105 public Region16.rects (Pixman.Box16[] boxes); 106 public Region16.with_extents (Pixman.Box16 extents); 107 108 public void translate (int x, int y); 109 public bool copy (out Pixman.Region16 region); 110 [CCode (instance_pos = 1.1)] 111 public bool intersect (out Pixman.Region16 new_reg, Pixman.Region16 reg2); 112 [CCode (instance_pos = 1.1)] 113 public bool union (out Pixman.Region16 new_reg, Pixman.Region16 reg2); 114 [CCode (instance_pos = 1.1)] 115 public bool union_rect (out Pixman.Region16 dest, int x, int y, uint width, uint height); 116 [CCode (instance_pos = 1.1)] 117 public bool subtract (out Pixman.Region16 reg_d, Pixman.Region16 reg_s); 118 [CCode (instance_pos = 1.1)] 119 public bool inverse (out Pixman.Region16 new_reg, Pixman.Box16 inv_rect); 120 public bool contains_point (int x, int y, Pixman.Box16 box); 121 public Pixman.RegionOverlap contains_rectangle (Pixman.Box16 prect); 122 public bool not_empty (); 123 [CCode (cname = "pixman_region_extents")] 124 public unowned Pixman.Box16? get_extents (); 125 public int n_rects (); 126 public unowned Pixman.Box16[] rectangles (); 127 public bool equal (Pixman.Region16 region2); 128 public bool selfcheck (); 129 public void reset (Pixman.Box16 box); 130 } 131 132 [CCode (cname = "pixman_box16_t", has_type_id = false)] 133 public struct Box16 { 134 public int16 x1; 135 public int16 y1; 136 public int16 x2; 137 public int16 y2; 138 } 139 140 [CCode (cname = "pixman_rectangle16_t", has_type_id = false)] 141 public struct Rectangle16 { 142 public int16 x; 143 public int16 y; 144 public uint16 width; 145 public uint16 height; 146 } 147 148 [CCode (cname = "pixman_region32_t", has_type_id = false, destroy_function = "pixman_region32_fini")] 149 public struct Region32 { 150 public Pixman.Box32 extents; 151 152 public Region32 (); 153 public Region32.rect (int x, int y, uint width, uint height); 154 public Region32.rects (Pixman.Box32[] boxes); 155 public Region32.with_extents (Pixman.Box32 extents); 156 157 public void translate (int x, int y); 158 public bool copy (out Pixman.Region32 region); 159 [CCode (instance_pos = 1.1)] 160 public bool intersect (out Pixman.Region32 new_reg, Pixman.Region32 reg2); 161 [CCode (instance_pos = 1.1)] 162 public bool union (out Pixman.Region32 new_reg, Pixman.Region32 reg2); 163 [CCode (instance_pos = 1.1)] 164 public bool union_rect (out Pixman.Region32 dest, int x, int y, uint width, uint height); 165 [CCode (instance_pos = 1.1)] 166 public bool subtract (out Pixman.Region32 reg_d, Pixman.Region32 reg_s); 167 [CCode (instance_pos = 1.1)] 168 public bool inverse (out Pixman.Region32 new_reg, Pixman.Box32 inv_rect); 169 public bool contains_point (int x, int y, Pixman.Box32 box); 170 public Pixman.RegionOverlap contains_rectangle (Pixman.Box32 prect); 171 public bool not_empty (); 172 [CCode (cname = "pixman_region32_extents")] 173 public unowned Pixman.Box32? get_extents (); 174 public int n_rects (); 175 public unowned Pixman.Box32[] rectangles (); 176 public bool equal (Pixman.Region32 region2); 177 public bool selfcheck (); 178 public void reset (Pixman.Box32 box); 179 public void clear (); 180 } 181 182 [CCode (cname = "pixman_box32_t", has_type_id = false)] 183 public struct Box32 { 184 public int32 x1; 185 public int32 y1; 186 public int32 x2; 187 public int32 y2; 188 } 189 190 [CCode (cname = "pixman_rectangle32_t", has_type_id = false)] 191 public struct Rectangle32 { 192 public int32 x; 193 public int32 y; 194 public uint32 width; 195 public uint32 height; 196 } 197 198 public static bool blt ([CCode (array_length = false, type = "uint32_t*")] uint8[] src_bits, [CCode (array_length = false, type = "uint32_t*")] uint8[] dst_bits, int src_stride, int dst_stride, int src_bpp, int dst_bpp, int src_x, int src_y, int dst_x, int dst_y, int width, int height); 199 public static bool fill ([CCode (array_length = false, type = "uint32_t*")] uint8[] bits, int stride, int bpp, int x, int y, int width, int height, uint32 _xor); 200 201 [CCode (cname = "pixman_read_memory_func_t", has_target = false)] 202 public delegate int32 ReadMemoryFunc ([CCode (type = "void*")] uint8[] src); 203 [CCode (cname = "pixman_write_memory_func_t", has_target = false)] 204 public delegate void WriteMemoryFunc ([CCode (type = "void*", array_length = false)] uint8[] dst, uint32 value, int size); 205 206 [CCode (cname = "struct pixman_gradient_stop", has_type_id = false)] 207 public struct GradientStop { 208 public Pixman.Fixed x; 209 public Pixman.Color color; 210 } 211 212 [CCode (cname = "struct pixman_indexed", has_type_id = false)] 213 public struct Indexed { 214 public bool color; 215 public uint32 rgba[256]; 216 public uint8 ent[32768]; 217 } 218 219 [CCode (cname = "enum pixman_repeat_t", has_type_id = false)] 220 public enum Repeat { 221 NONE, 222 NORMAL, 223 PAD, 224 REFLECT 225 } 226 227 [CCode (cname = "enum pixman_filter_t", has_type_id = false)] 228 public enum Filter { 229 FAST, 230 GOOD, 231 BEST, 232 NEAREST, 233 BILINEAR, 234 CONVOLUTION 235 } 236 237 [CCode (cname = "enum pixman_op_t", has_type_id = false, cprefix = "PIXMAN_OP_")] 238 public enum Operation { 239 CLEAR, 240 SRC, 241 DST, 242 OVER, 243 OVER_REVERSE, 244 IN, 245 IN_REVERSE, 246 OUT, 247 OUT_REVERSE, 248 ATOP, 249 ATOP_REVERSE, 250 XOR, 251 ADD, 252 SATURATE, 253 254 DISJOINT_CLEAR, 255 DISJOINT_SRC, 256 DISJOINT_DST, 257 DISJOINT_OVER, 258 DISJOINT_OVER_REVERSE, 259 DISJOINT_IN, 260 DISJOINT_IN_REVERSE, 261 DISJOINT_OUT, 262 DISJOINT_OUT_REVERSE, 263 DISJOINT_ATOP, 264 DISJOINT_ATOP_REVERSE, 265 DISJOINT_XOR, 266 267 CONJOINT_CLEAR, 268 CONJOINT_SRC, 269 CONJOINT_DST, 270 CONJOINT_OVER, 271 CONJOINT_OVER_REVERSE, 272 CONJOINT_IN, 273 CONJOINT_IN_REVERSE, 274 CONJOINT_OUT, 275 CONJOINT_OUT_REVERSE, 276 CONJOINT_ATOP, 277 CONJOINT_ATOP_REVERSE, 278 CONJOINT_XOR, 279 280 MULTIPLY, 281 SCREEN, 282 OVERLAY, 283 DARKEN, 284 LIGHTEN, 285 COLOR_DODGE, 286 COLOR_BURN, 287 HARD_LIGHT, 288 SOFT_LIGHT, 289 DIFFERENCE, 290 EXCLUSION, 291 HSL_HUE, 292 HSL_SATURATION, 293 HSL_COLOR, 294 HSL_LUMINOSITY 295 } 296 297 [CCode (cname = "int", cprefix = "PIXMAN_TYPE_", has_type_id = false)] 298 public enum FormatType { 299 OTHER, 300 A, 301 ARGB, 302 ABGR, 303 COLOR, 304 GRAY, 305 YUY2, 306 YV12, 307 BGRA; 308 309 [CCode (cname = "PIXMAN_FORMAT_COLOR")] 310 public bool is_color (); 311 } 312 313 [CCode (cname = "pixman_format_code_t", has_type_id = false, cprefix = "PIXMAN_")] 314 public enum Format { 315 [CCode (cname = "PIXMAN_a8r8g8b8")] 316 A8R8G8B8, 317 [CCode (cname = "PIXMAN_x8r8g8b8")] 318 X8R8G8B8, 319 [CCode (cname = "PIXMAN_a8b8g8r8")] 320 A8B8G8R8, 321 [CCode (cname = "PIXMAN_x8b8g8r8")] 322 X8B8G8R8, 323 [CCode (cname = "PIXMAN_b8g8r8a8")] 324 B8G8R8A8, 325 [CCode (cname = "PIXMAN_b8g8r8x8")] 326 B8G8R8X8, 327 [CCode (cname = "PIXMAN_x14r6g6b6")] 328 X14R6G6B6, 329 [CCode (cname = "PIXMAN_x2r10g10b10")] 330 X2R10G10B10, 331 [CCode (cname = "PIXMAN_a2r10g10b10")] 332 A2R10G10B10, 333 [CCode (cname = "PIXMAN_x2b10g10r10")] 334 X2B10G10R10, 335 [CCode (cname = "PIXMAN_a2b10g10r10")] 336 A2B10G10R10, 337 [CCode (cname = "PIXMAN_r8g8b8")] 338 R8G8B8, 339 [CCode (cname = "PIXMAN_b8g8r8")] 340 B8G8R8, 341 [CCode (cname = "PIXMAN_r5g6b5")] 342 R5G6B5, 343 [CCode (cname = "PIXMAN_b5g6r5")] 344 B5G6R5, 345 [CCode (cname = "PIXMAN_a1r5g5b5")] 346 A1R5G5B5, 347 [CCode (cname = "PIXMAN_x1r5g5b5")] 348 X1R5G5B5, 349 [CCode (cname = "PIXMAN_a1b5g5r5")] 350 A1B5G5R5, 351 [CCode (cname = "PIXMAN_x1b5g5r5")] 352 X1B5G5R5, 353 [CCode (cname = "PIXMAN_a4r4g4b4")] 354 A4R4G4B4, 355 [CCode (cname = "PIXMAN_x4r4g4b4")] 356 X4R4G4B4, 357 [CCode (cname = "PIXMAN_a4b4g4r4")] 358 A4B4G4R4, 359 [CCode (cname = "PIXMAN_x4b4g4r4")] 360 X4B4G4R4, 361 /* 8bpp formats */ 362 [CCode (cname = "PIXMAN_a8")] 363 A8, 364 [CCode (cname = "PIXMAN_r3g3b2")] 365 R3G3B2, 366 [CCode (cname = "PIXMAN_b2g3r3")] 367 B2G3R3, 368 [CCode (cname = "PIXMAN_a2r2g2b2")] 369 A2R2G2B2, 370 [CCode (cname = "PIXMAN_a2b2g2r2")] 371 A2B2G2R2, 372 [CCode (cname = "PIXMAN_c8")] 373 C8, 374 [CCode (cname = "PIXMAN_g8")] 375 G8, 376 [CCode (cname = "PIXMAN_x4a4")] 377 X4A4, 378 [CCode (cname = "PIXMAN_x4c4")] 379 X4C4, 380 [CCode (cname = "PIXMAN_x4g4")] 381 X4G4, 382 /* 4bpp formats */ 383 [CCode (cname = "PIXMAN_a4")] 384 A4, 385 [CCode (cname = "PIXMAN_r1g2b1")] 386 R1G2B1, 387 [CCode (cname = "PIXMAN_b1g2r1")] 388 B1G2R1, 389 [CCode (cname = "PIXMAN_a1r1g1b1")] 390 A1R1G1B1, 391 [CCode (cname = "PIXMAN_a1b1g1r1")] 392 A1B1G1R1, 393 [CCode (cname = "PIXMAN_c4")] 394 C4, 395 [CCode (cname = "PIXMAN_g4")] 396 G4, 397 /* 1bpp formats */ 398 [CCode (cname = "PIXMAN_a1")] 399 A1, 400 [CCode (cname = "PIXMAN_g1")] 401 G1, 402 /* YUV formats */ 403 [CCode (cname = "PIXMAN_yuy2")] 404 YUY2, 405 [CCode (cname = "PIXMAN_yv12")] 406 YV12; 407 408 [CCode (cname = "PIXMAN_FORMAT")] 409 public static Pixman.Format create (int bpp, Pixman.FormatType type, int a, int r, int g, int b); 410 [CCode (cname = "pixman_format_supported_destination")] 411 public bool supported_destination (); 412 [CCode (cname = "pixman_format_supported_source")] 413 public bool supported_source (); 414 } 415 416 [CCode (cname = "pixman_image_t", cprefix = "pixman_image_", ref_function = "pixman_image_ref", unref_function = "pixman_image_unref", has_type_id = false)] 417 public class Image { 418 [CCode (cname = "pixman_image_create_solid_fill")] 419 public Image.solid_fill (Pixman.Color color); 420 [CCode (cname = "pixman_image_create_linear_gradient")] 421 public Image.linear_gradient (Pixman.PointFixed p1, Pixman.PointFixed p2, Pixman.GradientStop[] stops); 422 [CCode (cname = "pixman_image_create_radial_gradient")] 423 public Image.radial_gradient (Pixman.PointFixed inner, Pixman.PointFixed outer, Pixman.Fixed inner_radius, Pixman.Fixed outer_radius, Pixman.GradientStop[] stops); 424 [CCode (cname = "pixman_image_create_conical_gradient")] 425 public Image.conical_gradient (Pixman.PointFixed center, Pixman.Fixed angle, Pixman.GradientStop[] stops); 426 [CCode (cname = "pixman_image_create_bits")] 427 public Image.bits (Pixman.Format format, int width, int height, [CCode (type = "uint32_t*", array_length = false)] uint8[]? bits, int rowstride_bytes); 428 429 public bool set_clip_region (Pixman.Region16 clip_region); 430 public Pixman.Region16 clip_region { set; } 431 public bool set_clip_region32 (Pixman.Region32 clip_region32); 432 public Pixman.Region32 clip_region32 { set; } 433 public void set_has_client_clip (bool client_clip); 434 public bool has_client_clip { set; } 435 public bool set_transform (Pixman.Transform transform); 436 public Pixman.Transform transform { set; } 437 public void set_repeat (Pixman.Repeat repeat); 438 public Pixman.Repeat repeat { set; } 439 public bool set_filter (Pixman.Filter filter, Pixman.Fixed[]? filter_params); 440 public void set_source_clipping (bool source_clipping); 441 public bool source_clipping { set; } 442 public void set_alpha_map (Pixman.Image alpha_map, int16 x, int16 y); 443 public void set_component_alpha (bool component_alpha); 444 public bool component_alpha { set; } 445 public bool set_accessors (Pixman.ReadMemoryFunc read_func, Pixman.WriteMemoryFunc write_func); 446 public bool set_indexed (Pixman.Indexed indexed); 447 public Pixman.Indexed indexed { set; } 448 [CCode (array_length = false)] 449 public unowned uint32[] get_data (); 450 public int get_width (); 451 public int width { get; } 452 public int get_height (); 453 public int height { get; } 454 public int get_stride (); 455 public int stride { get; } 456 public int get_depth (); 457 public int depth { get; } 458 [CCode (instance_pos = 1.1)] 459 public bool fill_rectangles (Pixman.Operation op, Pixman.Color color, [CCode (array_length_pos = 2.1)] Pixman.Rectangle16[] rects); 460 461 [CCode (cname = "pixman_compute_composite_region")] 462 public static bool compute_composite_region (Pixman.Region16 region, Pixman.Image src_image, Pixman.Image? mask_image, Pixman.Image dst_image, int src_x, int src_y, int mask_x, int mask_y, int dest_x, int dest_y, int width, int height); 463 public static void composite (Pixman.Operation op, Pixman.Image src, Pixman.Image? mask, Pixman.Image dest, int16 src_x, int16 src_y, int16 mask_x, int16 mask_y, int16 dest_x, int16 dest_y, uint16 width, uint16 height); 464 465 [CCode (cname = "pixman_rasterize_edges")] 466 public void rasterize_edges (Pixman.Edge l, Pixman.Edge r, Pixman.Fixed t, Pixman.Fixed b); 467 [CCode (cname = "pixman_add_traps")] 468 public void add_traps (int16 x_off, int16 y_off, [CCode (array_length_pos = 2.9)] Pixman.Trap[] traps); 469 [CCode (cname = "pixman_add_trapezoids")] 470 public void add_trapezoids (int16 x_off, int y_off, [CCode (array_length_pos = 2.9)] Pixman.Trapezoid[] traps); 471 [CCode (cname = "pixman_rasterize_trapezoid")] 472 public void rasterize_trapezoid (Pixman.Trapezoid trap, int x_off, int y_off); 473 [CCode (cname = "pixman_composite_trapezoids")] 474 public static bool composite_trapezoids (Pixman.Operation op, Pixman.Image src, Pixman.Image dst, Pixman.Format mask_format, int x_src, int y_src, int x_dst, int y_dst, [CCode (array_length_pos = 8.9)] Pixman.Trapezoid[] traps); 475 [CCode (cname = "pixman_composite_triangles")] 476 public static bool composite_triangles (Pixman.Operation op, Pixman.Image src, Pixman.Image dst, Pixman.Format mask_format, int x_src, int y_src, int x_dst, int y_dst, [CCode (array_length_pos = 8.9)] Pixman.Triangle[] tries); 477 [CCode (cname = "pixman_add_triangles")] 478 public void add_triangles (int32 x_off, int32 y_off, [CCode (array_length_pos = 2.9)] Pixman.Triangle[] tris); 479 } 480 481 [CCode (cname = "pixman_edge_t", has_type_id = false)] 482 public struct Edge { 483 public Pixman.Fixed x; 484 public Pixman.Fixed e; 485 public Pixman.Fixed stepx; 486 public Pixman.Fixed signdx; 487 public Pixman.Fixed dy; 488 public Pixman.Fixed dx; 489 490 public Pixman.Fixed stepx_small; 491 public Pixman.Fixed stepx_big; 492 public Pixman.Fixed dx_small; 493 public Pixman.Fixed dx_big; 494 495 public void step (int n); 496 public Edge (int bpp, Pixman.Fixed y_start, Pixman.Fixed x_top, Pixman.Fixed y_top, Pixman.Fixed x_bot, Pixman.Fixed y_bot); 497 [CCode (cname = "pixman_line_fixed_edge_init")] 498 public Edge.line_fixed (int bpp, Pixman.Fixed y, Pixman.LineFixed line, int x_off, int y_off); 499 } 500 501 [CCode (cname = "pixman_trapezoid_t", has_type_id = false)] 502 public struct Trapezoid { 503 public Pixman.Fixed top; 504 public Pixman.Fixed bottom; 505 public Pixman.LineFixed left; 506 public Pixman.LineFixed right; 507 508 public bool valid (); 509 } 510 511 [CCode (cname = "pixman_triangle_t", has_type_id = false)] 512 public struct Triangle { 513 public Pixman.PointFixed p1; 514 public Pixman.PointFixed p2; 515 public Pixman.PointFixed p3; 516 } 517 518 [CCode (cname = "pixman_span_fix_t", has_type_id = false)] 519 public struct SpanFix { 520 public Pixman.Fixed l; 521 public Pixman.Fixed r; 522 public Pixman.Fixed y; 523 } 524 525 [CCode (cname = "pixman_trap_t", has_type_id = false)] 526 public struct Trap { 527 public Pixman.SpanFix top; 528 public Pixman.SpanFix bot; 529 } 530} 531