Remove convert_channel
method
This commit is contained in:
parent
2efb96de16
commit
bdb8605bd5
1 changed files with 0 additions and 8 deletions
|
@ -4,7 +4,6 @@ pub trait Channel: Number {
|
|||
static pure fn max() -> self;
|
||||
|
||||
static pure fn from<T:Channel>(val: T) -> self;
|
||||
pure fn convert_channel<T:Channel>(&self) -> T;
|
||||
|
||||
pure fn to_channel_u8(&self) -> u8;
|
||||
pure fn to_channel_u16(&self) -> u16;
|
||||
|
@ -21,7 +20,6 @@ pub impl u8: Channel {
|
|||
#[inline(always)] static pure fn max() -> u8 { 0xFF } // 2^8
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> u8 { val.to_channel_u8() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self) }
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self as u16 << 8) | (*self) as u16 }
|
||||
|
@ -38,7 +36,6 @@ pub impl u16: Channel {
|
|||
#[inline(always)] static pure fn max() -> u16 { 0xFFFF } // 2^16
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> u16 { val.to_channel_u16() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self >> 8) as u8 } // this is the equivalent of `self/256`. Some folks prefer to do `self/257`
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self) }
|
||||
|
@ -55,7 +52,6 @@ pub impl u32: Channel {
|
|||
#[inline(always)] static pure fn max() -> u32 { 0xFFFF_FFFF } // 2^32
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> u32 { val.to_channel_u32() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self >> 24) as u8 }
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self >> 16) as u16 }
|
||||
|
@ -72,7 +68,6 @@ pub impl u64: Channel {
|
|||
#[inline(always)] static pure fn max() -> u64 { 0xFFFF_FFFF_FFFF_FFFF_u64 } // 2^64
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> u64 { val.to_channel_u64() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self >> 56) as u8 }
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self >> 48) as u16 }
|
||||
|
@ -89,7 +84,6 @@ pub impl f32: Channel {
|
|||
#[inline(always)] static pure fn max() -> f32 { 1f32 }
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> f32 { val.to_channel_f32() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self) * (0xFF_u8 as f32) as u8 }
|
||||
|
@ -107,7 +101,6 @@ pub impl f64: Channel {
|
|||
#[inline(always)] static pure fn max() -> f64 { 1f64 }
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> f64 { val.to_channel_f64() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self) * (0xFF_u8 as f64) as u8 }
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self) * (0xFFFF_u16 as f64) as u16 }
|
||||
|
@ -124,7 +117,6 @@ pub impl float: Channel {
|
|||
#[inline(always)] static pure fn max() -> float { 1f }
|
||||
|
||||
#[inline(always)] static pure fn from<T:Channel>(val: T) -> float { val.to_channel_float() }
|
||||
#[inline(always)] pure fn convert_channel<T:Channel>(&self) -> T { Channel::from(*self) }
|
||||
|
||||
#[inline(always)] pure fn to_channel_u8(&self) -> u8 { (*self) * (0xFF_u8 as float) as u8 }
|
||||
#[inline(always)] pure fn to_channel_u16(&self) -> u16 { (*self) * (0xFFFF_u16 as float) as u16 }
|
||||
|
|
Loading…
Reference in a new issue