From 5eb9dc37d4e4e22743ef319e4188aff0114376ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Tue, 18 Aug 2020 15:31:08 +0200 Subject: [PATCH] rust: finish channel functions remove channels_blend() --- rust/src/channel.rs | 44 +++----------------------------------------- rust/src/types.rs | 2 -- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/rust/src/channel.rs b/rust/src/channel.rs index 49145f039..020016f03 100644 --- a/rust/src/channel.rs +++ b/rust/src/channel.rs @@ -14,10 +14,10 @@ // functions already exported by bindgen : 0 // ------------------------------------------ // -// static inline functions to reimplement: 38 +// static inline functions to reimplement: 33 // ------------------------------------------ (done / (x) wont / remaining) -// (+) implement : 34 / 3 / 1 -// (#) unit tests: 14 / 0 / 21 +// (+) implement : 34 / 3 / 0 +// (#) unit tests: 14 / 0 / 20 // ------------------------------------------ //#channel_alpha //#channel_b @@ -32,7 +32,6 @@ //+channels_bg_default_p //+channels_bg_palindex_p //+channels_bg_rgb -// channels_blend // TODO //#channels_combine //+channel_set //#channel_set_alpha @@ -343,43 +342,6 @@ pub fn channels_set_bg_default(channels: &mut ChannelPair) -> ChannelPair { *channels } -/// Returns the result of blending two channels. 'blends' indicates how heavily -/// 'c1' ought be weighed. If 'blends' is 0, 'c1' will be entirely replaced by -/// 'c2'. If 'c1' is otherwise the default color, 'c1' will not be touched, -/// since we can't blend default colors. Likewise, if 'c2' is a default color, -/// it will not be used (unless 'blends' is 0). -/// -/// Palette-indexed colors do not blend, and since we need the attrword to store -/// them, we just don't fuck wit' 'em here. Do not pass me palette-indexed -/// channels! I will eat them. -// TODO -// static inline unsigned -// channels_blend(unsigned c1, unsigned c2, unsigned* blends){ -// if(channel_alpha(c2) == CELL_ALPHA_TRANSPARENT){ -// return c1; // do *not* increment *blends -// } -// unsigned rsum, gsum, bsum; -// channel_rgb(c2, &rsum, &gsum, &bsum); -// bool c2default = channel_default_p(c2); -// if(*blends == 0){ -// // don't just return c2, or you set wide status and all kinds of crap -// if(channel_default_p(c2)){ -// channel_set_default(&c1); -// }else{ -// channel_set_rgb(&c1, rsum, gsum, bsum); -// } -// channel_set_alpha(&c1, channel_alpha(c2)); -// }else if(!c2default && !channel_default_p(c1)){ -// rsum = (channel_r(c1) * *blends + rsum) / (*blends + 1); -// gsum = (channel_g(c1) * *blends + gsum) / (*blends + 1); -// bsum = (channel_b(c1) * *blends + bsum) / (*blends + 1); -// channel_set_rgb(&c1, rsum, gsum, bsum); -// channel_set_alpha(&c1, channel_alpha(c2)); -// } -// ++*blends; -// return c1; -// } - #[cfg(test)] mod test { use super::{ffi, Channel, ChannelPair}; diff --git a/rust/src/types.rs b/rust/src/types.rs index d1c8a4e9e..a97b39392 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -186,8 +186,6 @@ pub type GraphemeClusterBackStop = u8; pub type StyleMask = u16; - - // Plane: fundamental drawing surface. unites a: // // - CellMatrix