pub struct ScreenAnnotation {
pub rect: Rect,
pub rendition: MediaRendition,
pub title: Option<String>,
pub flags: AnnotationFlags,
pub contents: Option<String>,
pub appearance: Option<Vec<u8>>,
pub operation: RenditionOperation,
}Expand description
A screen annotation for modern multimedia.
Per PDF spec Section 12.5.6.18, a screen annotation represents a region on a page where media can be played.
Fields§
§rect: RectBounding rectangle for the media display area
rendition: MediaRenditionMedia rendition
title: Option<String>Annotation title
flags: AnnotationFlagsAnnotation flags
contents: Option<String>Contents/description
appearance: Option<Vec<u8>>Background appearance stream
operation: RenditionOperationRendition operation
Implementations§
Source§impl ScreenAnnotation
impl ScreenAnnotation
Sourcepub fn new(rect: Rect, rendition: MediaRendition) -> Self
pub fn new(rect: Rect, rendition: MediaRendition) -> Self
Create a new screen annotation.
§Arguments
rect- Display area for the mediarendition- Media rendition to play
Sourcepub fn from_clip(rect: Rect, clip: MediaClip) -> Self
pub fn from_clip(rect: Rect, clip: MediaClip) -> Self
Create a screen annotation from a media clip.
Sourcepub fn video(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self
pub fn video(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self
Create a video annotation.
Sourcepub fn audio(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self
pub fn audio(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self
Create an audio annotation.
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set the title.
Sourcepub fn with_rendition_name(self, name: impl Into<String>) -> Self
pub fn with_rendition_name(self, name: impl Into<String>) -> Self
Set rendition name.
Sourcepub fn with_volume(self, volume: f32) -> Self
pub fn with_volume(self, volume: f32) -> Self
Set volume.
Sourcepub fn with_repeat(self, count: u32) -> Self
pub fn with_repeat(self, count: u32) -> Self
Set repeat count (0 = infinite loop).
Sourcepub fn with_auto_play(self, auto: bool) -> Self
pub fn with_auto_play(self, auto: bool) -> Self
Set auto-play.
Sourcepub fn with_controls(self, show: bool) -> Self
pub fn with_controls(self, show: bool) -> Self
Set whether to show controls.
Sourcepub fn with_window_type(self, wtype: WindowType) -> Self
pub fn with_window_type(self, wtype: WindowType) -> Self
Set window type.
Sourcepub fn with_contents(self, contents: impl Into<String>) -> Self
pub fn with_contents(self, contents: impl Into<String>) -> Self
Set description/contents.
Sourcepub fn with_flags(self, flags: AnnotationFlags) -> Self
pub fn with_flags(self, flags: AnnotationFlags) -> Self
Set annotation flags.
Sourcepub fn with_operation(self, op: RenditionOperation) -> Self
pub fn with_operation(self, op: RenditionOperation) -> Self
Set rendition operation.
Sourcepub fn build(&self, _page_refs: &[ObjectRef]) -> HashMap<String, Object>
pub fn build(&self, _page_refs: &[ObjectRef]) -> HashMap<String, Object>
Build the annotation dictionary for PDF output.
Note: The Rendition and MediaClip must be written separately.
Sourcepub fn rendition(&self) -> &MediaRendition
pub fn rendition(&self) -> &MediaRendition
Get the rendition reference.
Trait Implementations§
Source§impl Clone for ScreenAnnotation
impl Clone for ScreenAnnotation
Source§fn clone(&self) -> ScreenAnnotation
fn clone(&self) -> ScreenAnnotation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScreenAnnotation
impl Debug for ScreenAnnotation
Source§impl From<ScreenAnnotation> for Annotation
impl From<ScreenAnnotation> for Annotation
Source§fn from(screen: ScreenAnnotation) -> Self
fn from(screen: ScreenAnnotation) -> Self
Auto Trait Implementations§
impl Freeze for ScreenAnnotation
impl RefUnwindSafe for ScreenAnnotation
impl Send for ScreenAnnotation
impl Sync for ScreenAnnotation
impl Unpin for ScreenAnnotation
impl UnsafeUnpin for ScreenAnnotation
impl UnwindSafe for ScreenAnnotation
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
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>
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>
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 more