|
|
@ -1,32 +1,32 @@
|
|
|
|
// Already exported by bindgen: 3
|
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// NOTE: These functions now can't fail and dont't have to return an error:
|
|
|
|
|
|
|
|
// - `palette256_set_rgb()`
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
// functions already exported by bindgen : 3
|
|
|
|
|
|
|
|
// -----------------------------------------
|
|
|
|
// palette256_free
|
|
|
|
// palette256_free
|
|
|
|
// palette256_new
|
|
|
|
// palette256_new
|
|
|
|
// palette256_use
|
|
|
|
// palette256_use
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// FUNCTIONS TO REIMPLEMENT:
|
|
|
|
// static inline functions to reimplement: 3
|
|
|
|
// - from notcurses.h: 3
|
|
|
|
// -----------------------------------------
|
|
|
|
// - done: 0
|
|
|
|
// - finished : 1
|
|
|
|
// - remaining: 3
|
|
|
|
// - remaining: 2
|
|
|
|
//
|
|
|
|
// --------------- (+) implemented (#) + unit test (x) wont implement
|
|
|
|
// ---------------
|
|
|
|
//+palette256_get_rgb
|
|
|
|
// + reimplemented
|
|
|
|
|
|
|
|
// # and unit test
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
// palette256_get_rgb
|
|
|
|
|
|
|
|
// palette256_set
|
|
|
|
// palette256_set
|
|
|
|
// palette256_set_rgb
|
|
|
|
// palette256_set_rgb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crate as ffi;
|
|
|
|
|
|
|
|
use crate::types::Color;
|
|
|
|
|
|
|
|
|
|
|
|
// // Manipulate entries in the palette store 'p'. These are *not* locked.
|
|
|
|
/// Manipulate entries in the palette store 'p'. These are *not* locked.
|
|
|
|
// static inline int
|
|
|
|
pub fn palette256_set_rgb(palette: &mut ffi::palette256, idx: usize, r: Color, g: Color, b: Color) {
|
|
|
|
// palette256_set_rgb(palette256* p, int idx, int r, int g, int b){
|
|
|
|
ffi::channel_set_rgb(&mut palette.chans[idx], r, g, b)
|
|
|
|
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
|
|
|
|
}
|
|
|
|
// return -1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
// XXX: what is the return type?
|
|
|
|
// return channel_set_rgb(&p->chans[idx], r, g, b);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// static inline int
|
|
|
|
// static inline int
|
|
|
|
// palette256_set(palette256* p, int idx, unsigned rgb){
|
|
|
|
// palette256_set(palette256* p, int idx, unsigned rgb){
|
|
|
|
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
|
|
|
|
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
|
|
|
@ -34,7 +34,7 @@
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return channel_set(&p->chans[idx], rgb);
|
|
|
|
// return channel_set(&p->chans[idx], rgb);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
// static inline int
|
|
|
|
// static inline int
|
|
|
|
// palette256_get_rgb(const palette256* p, int idx, unsigned* RESTRICT r, unsigned* RESTRICT g, unsigned* RESTRICT b){
|
|
|
|
// palette256_get_rgb(const palette256* p, int idx, unsigned* RESTRICT r, unsigned* RESTRICT g, unsigned* RESTRICT b){
|
|
|
|
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
|
|
|
|
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
|
|
|
|