unsigned char
in C (unsigned char*
)c $ NativeCByteArray :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
c :: NativeCArray :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: defaultinit
c :: NativeCByteArray :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).c :: NativeCArray
A native C array, as in a pointer to the first element of the array
# An array of `unsigned char` in C (`unsigned char*`)
extern class NativeCByteArray `{ unsigned char* `}
super NativeCArray
redef type E: Byte
# Allocate a new array of `size`
new(size: Int) `{ return calloc(size, sizeof(unsigned char)); `}
redef fun [](index) `{ return self[index]; `}
redef fun []=(index, val) `{ self[index] = val; `}
redef fun +(offset) `{ return self + offset; `}
# Move `n` bytes from `dst_offset` to `src_offset`
fun move(dst_offset, src_offset, n: Int) `{
memmove(self+dst_offset, self+src_offset, n);
`}
end
lib/c/c.nit:191,1--208,3
redef class NativeCByteArray
# Reverse Android multiplication of color values per the alpha channel
private fun unmultiply(w, h: Int) `{
int offset = 0;
int x, y;
for (x = 0; x < w; x ++)
for (y = 0; y < h; y ++) {
unsigned char a = self[offset+3];
if (a != 0 && a != 0xFF) {
self[offset] = self[offset] * 256 / a;
self[offset+1] = self[offset+1] * 256 / a;
self[offset+2] = self[offset+2] * 256 / a;
}
offset += 4;
}
`}
end
lib/android/load_image.nit:86,1--102,3
redef class NativeCByteArray
# The data was not premultiplied, don't unmultiply it
redef fun unmultiply(w, h) do end
end
lib/gamnit/android19.nit:42,1--46,3