3
enum @beta Ector.Buffer.Flag {
4
[[Buffer capabilities]]
5
none = 0x00, [[Buffer may not have any backing, indicates an invalid buffer.]]
6
cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]]
7
cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]]
8
renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine.]]
9
drawable = 0x08, [[Can be used as a source of pixels to draw on Evas.]]
10
cpu_readable_fast = 0x10, [[Can be read by the CPU at high speed, ie no need for glReadPixels.]]
11
cpu_writable_fast = 0x20, [[Can be written by the CPU at high speed, ie no need for GPU texture upload.]]
12
uncached = 0x40, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels.]]
13
/* non_coherent = 0x80, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
16
enum @beta Ector.Buffer.Access_Flag {
17
[[Buffer access permissions]]
18
none = 0x0, [[No access permission]]
19
read = 0x1, [[Read access permission]]
20
write = 0x2, [[Write access permission]]
21
cow = 0x4, [[Forces copy-on-write if already mapped as read-only. Requires write.]]
24
mixin @beta Ector.Buffer
26
[[2D pixel buffer interface for Ector
28
c_prefix: ector_buffer;
31
[[The (rectangular) size of the pixel buffer.]]
39
[[The colorspace of the pixel buffer.]]
42
cspace: Efl.Gfx.Colorspace; [[Colorspace]]
46
[[Map a region of this buffer for read or write access by the CPU,
47
fetch data from the GPU if needed. This operation may be slow if
48
cpu_readable_fast or cpu_writeable_fast are not true, or if the
49
required colorspace is different from the internal one.
52
@out length: uint; [[Accessible buffer size in bytes, should not be $null.]]
53
@in mode: Ector.Buffer.Access_Flag; [[Specifies whether to map for read-only,
54
write-only or read-write access (OR combination of flags).]]
55
@in x: uint; [[X position of the top-left pixel to map]]
56
@in y: uint; [[Y position of the top-left pixel to map]]
57
@in w: uint; [[If 0, defaults to the buffer width]]
58
@in h: uint; [[If 0, defaults to the buffer height]]
59
@in cspace: Efl.Gfx.Colorspace; [[Requested colorspace. If different from the internal cspace,
60
map should try to convert the data into a new buffer]]
61
@out stride: uint @optional; [[Returns the length in bytes of a mapped line]]
63
return: void_ptr @no_unused; [[Pointer to the top-left pixel data. Returns $null in case of failure]]
66
[[Unmap a region of this buffer, and upload data to the GPU (if needed).]]
68
@in data: void_ptr; [[Data pointer returned by a previous call to map]]
69
@in length: uint; [[Must be the same as returned by map.]]
72
pixels_set @pure_virtual {
73
[[Sets the source pixels for this buffer, or allocate a new memory region]]
75
@in pixels: void_ptr; [[If $null, allocates an empty buffer]]
76
@in width: int; [[Buffer width]]
77
@in height: int; [[Buffer height]]
78
@in stride: int; [[Buffer stride (in bytes). If 0 then calculated based on $cspace and $width]]
79
@in cspace: Efl.Gfx.Colorspace; [[Buffer colorspace]]
80
@in writable: bool; [[Buffer is writable]]
82
return: bool; [[True if pixels_set was successful]]
84
pixels_get @pure_virtual {
85
[[Gets the source pixels for the current buffer]]
87
@out pixels: void_ptr; [[Returns buffer pixel pointer]]
88
@out width: int; [[Returns buffer width]]
89
@out height: int; [[Returns buffer height]]
90
@out stride: int; [[Returns buffer stride size]]
92
return: bool; [[True if returned pixels is writable]]
95
[[The capabilities of this buffer]]
98
flag: Ector.Buffer.Flag; [[A bitmask of capability flags]]
103
detached: ptr(ubyte); [[Emitted whenever the previously attached pixels are detached during pixels_set]]