pub struct Transparency(/* private fields */);Expand description
Represents transparency in AutoCAD
Transparency is represented as an alpha value where:
- 0 = fully opaque (0% transparent)
- 255 = fully transparent (100% transparent)
Implementations§
Source§impl Transparency
impl Transparency
Sourcepub const OPAQUE: Transparency
pub const OPAQUE: Transparency
Fully opaque (0% transparent)
Sourcepub const TRANSPARENT: Transparency
pub const TRANSPARENT: Transparency
Fully transparent (100% transparent)
Sourcepub const BY_LAYER: Transparency
pub const BY_LAYER: Transparency
Transparency ByLayer - uses the layer’s transparency
Sourcepub const T_10: Transparency
pub const T_10: Transparency
Common transparency values
pub const T_20: Transparency
pub const T_30: Transparency
pub const T_40: Transparency
pub const T_50: Transparency
pub const T_60: Transparency
pub const T_70: Transparency
pub const T_80: Transparency
pub const T_90: Transparency
Sourcepub fn from_percent(percent: f64) -> Self
pub fn from_percent(percent: f64) -> Self
Create transparency from a percentage (0.0 = opaque, 1.0 = transparent)
Sourcepub fn from_alpha_value(value: u32) -> Self
pub fn from_alpha_value(value: u32) -> Self
Create transparency from DWG alpha value (32-bit format)
The first byte represents the transparency type:
- 0 = BYLAYER
- 1 = BYBLOCK
- 3 = the transparency value in the last byte
Sourcepub fn as_percent(&self) -> f64
pub fn as_percent(&self) -> f64
Get transparency as a percentage (0.0 = opaque, 1.0 = transparent)
Sourcepub const fn is_transparent(&self) -> bool
pub const fn is_transparent(&self) -> bool
Check if fully transparent
Sourcepub fn to_alpha_value(&self) -> i32
pub fn to_alpha_value(&self) -> i32
Convert to DWG alpha value (32-bit format)
The first byte represents the transparency type:
- 0 = BYLAYER
- 1 = BYBLOCK
- 3 = the transparency value in the last byte
Trait Implementations§
Source§impl Clone for Transparency
impl Clone for Transparency
Source§fn clone(&self) -> Transparency
fn clone(&self) -> Transparency
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transparency
impl Debug for Transparency
Source§impl Default for Transparency
impl Default for Transparency
Source§impl Display for Transparency
impl Display for Transparency
Source§impl From<Transparency> for u8
impl From<Transparency> for u8
Source§fn from(transparency: Transparency) -> Self
fn from(transparency: Transparency) -> Self
Converts to this type from the input type.
Source§impl From<u8> for Transparency
impl From<u8> for Transparency
Source§impl Ord for Transparency
impl Ord for Transparency
Source§fn cmp(&self, other: &Transparency) -> Ordering
fn cmp(&self, other: &Transparency) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Transparency
impl PartialEq for Transparency
Source§impl PartialOrd for Transparency
impl PartialOrd for Transparency
impl Copy for Transparency
impl Eq for Transparency
impl StructuralPartialEq for Transparency
Auto Trait Implementations§
impl Freeze for Transparency
impl RefUnwindSafe for Transparency
impl Send for Transparency
impl Sync for Transparency
impl Unpin for Transparency
impl UnwindSafe for Transparency
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.