pub struct Share {
pub image: DynamicImage,
pub share_type: ShareType,
pub index: usize,
pub total_shares: usize,
pub original_width: u32,
pub original_height: u32,
pub block_size: usize,
pub is_meaningful: bool,
}
Expand description
Represents a single share in a visual cryptography scheme
Fields§
§image: DynamicImage
The share image data
Type of the share
index: usize
Index of this share (e.g., share 1 of n)
Total number of shares in the scheme
original_width: u32
Original image dimensions (before any expansion)
original_height: u32
§block_size: usize
Block size used for pixel expansion
is_meaningful: bool
Whether this is a meaningful share (with cover image)
Implementations§
Sourcepub fn new(
image: DynamicImage,
index: usize,
total_shares: usize,
original_width: u32,
original_height: u32,
block_size: usize,
is_meaningful: bool,
) -> Self
pub fn new( image: DynamicImage, index: usize, total_shares: usize, original_width: u32, original_height: u32, block_size: usize, is_meaningful: bool, ) -> Self
Create a new share
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Get the dimensions of the share image
Sourcepub fn to_binary(&self) -> ImageBuffer<Luma<u8>, Vec<u8>>
pub fn to_binary(&self) -> ImageBuffer<Luma<u8>, Vec<u8>>
Convert share to binary (black and white)
Sourcepub fn is_compatible(&self, other: &Share) -> bool
pub fn is_compatible(&self, other: &Share) -> bool
Check if this share is compatible with another share for stacking
Sourcepub fn stack_binary(&self, other: &Share) -> ImageBuffer<Luma<u8>, Vec<u8>>
pub fn stack_binary(&self, other: &Share) -> ImageBuffer<Luma<u8>, Vec<u8>>
Stack this share with another using OR operation (for binary shares)
Trait Implementations§
Auto Trait Implementations§
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.