pub struct ImageXObject<'a> { /* private fields */ }
Expand description
Writer for an image XObject stream.
This struct is created by Chunk::image_xobject
.
Implementations§
source§impl<'a> ImageXObject<'a>
impl<'a> ImageXObject<'a>
sourcepub fn color_space(&mut self) -> ColorSpace<'_>
pub fn color_space(&mut self) -> ColorSpace<'_>
Start writing the /ColorSpace
attribute.
Required for all images except if using the JPXDecode
filter.
If this is an image soft mask, the color space must be DeviceGray
.
Must not be Pattern
.
sourcepub fn color_space_name(&mut self, name: Name<'_>) -> &mut Self
pub fn color_space_name(&mut self, name: Name<'_>) -> &mut Self
Write the /ColorSpace
attribute as a name from the resource dictionary.
Required for all images except if using the JPXDecode
filter.
If this is an image soft mask, the color space must be DeviceGray
.
Must not be Pattern
.
sourcepub fn bits_per_component(&mut self, bits: i32) -> &mut Self
pub fn bits_per_component(&mut self, bits: i32) -> &mut Self
Write the /BitsPerComponent
attribute. Required.
Required for all images except if using the JPXDecode
filter.
sourcepub fn intent(&mut self, intent: RenderingIntent) -> &mut Self
pub fn intent(&mut self, intent: RenderingIntent) -> &mut Self
Write the /Intent
attribute. PDF 1.1+.
sourcepub fn image_mask(&mut self, mask: bool) -> &mut Self
pub fn image_mask(&mut self, mask: bool) -> &mut Self
Write the /ImageMask
attribute to set whether this image is a clipping
mask. If so, the /BitsPerComponent
must be 1
and /Mask
and
/ColorSpace
attributes shall be left undefined.
sourcepub fn color_mask(&mut self, colors: impl IntoIterator<Item = i32>) -> &mut Self
pub fn color_mask(&mut self, colors: impl IntoIterator<Item = i32>) -> &mut Self
Write the /Mask
attribute to set a color key mask. The iterable color
argument must contain a range of colors (minimum and maximum) for each
channel that shall be masked out. PDF 1.3+.
sourcepub fn stencil_mask(&mut self, mask: Ref) -> &mut Self
pub fn stencil_mask(&mut self, mask: Ref) -> &mut Self
Write the /Mask
attribute to set another image as the stencil mask of
this image.
sourcepub fn decode(&mut self, decode: impl IntoIterator<Item = f32>) -> &mut Self
pub fn decode(&mut self, decode: impl IntoIterator<Item = f32>) -> &mut Self
Write the /Decode
attribute to set the decoding of the image sample
colors to the specified color space. Must have twice the amount of
elements as the color space.
sourcepub fn interpolate(&mut self, interpolate: bool) -> &mut Self
pub fn interpolate(&mut self, interpolate: bool) -> &mut Self
Write the /Interpolate
attribute.
Must be false or unset for PDF/A files.
sourcepub fn alternates(
&mut self,
alternates: impl IntoIterator<Item = Ref>,
) -> &mut Self
pub fn alternates( &mut self, alternates: impl IntoIterator<Item = Ref>, ) -> &mut Self
Write the /Alternates
attribute. PDF 1.3+.
Images that may replace this image. The order is not relevant.
Note that this key is forbidden in PDF/A.
sourcepub fn s_mask(&mut self, x_object: Ref) -> &mut Self
pub fn s_mask(&mut self, x_object: Ref) -> &mut Self
Start writing the /SMask
attribute. PDF 1.4+.
Must not be used if this image already is an image soft mask.
Note that this key is forbidden in PDF/A-1.
sourcepub fn s_mask_in_data(&mut self, mode: SMaskInData) -> &mut Self
pub fn s_mask_in_data(&mut self, mode: SMaskInData) -> &mut Self
Note that this key is forbidden in PDF/A-1.
Write the /SMaskInData
attribute. PDF 1.5+.
May only be used for images that use the JPXDecode
filter. If set to
something other than Ignore
, the SMask
attribute must not be used.
sourcepub fn struct_parent(&mut self, key: i32) -> &mut Self
pub fn struct_parent(&mut self, key: i32) -> &mut Self
Write the /StructParent
attribute to indicate the structure tree
element this image belongs to. PDF 1.3+.
sourcepub fn matte(&mut self, color: impl IntoIterator<Item = f32>) -> &mut Self
pub fn matte(&mut self, color: impl IntoIterator<Item = f32>) -> &mut Self
Write the /Matte
attribute for image soft masks. PDF 1.4+.
This shall be the matte color of the parent image encoded in its color space.
sourcepub fn metadata(&mut self, id: Ref) -> &mut Self
pub fn metadata(&mut self, id: Ref) -> &mut Self
Write the /Metadata
attribute to specify the image’s metadata. PDF
1.4+.
The reference shall point to a metadata stream.
sourcepub fn associated_files(&mut self) -> TypedArray<'_, FileSpec<'_>>
pub fn associated_files(&mut self) -> TypedArray<'_, FileSpec<'_>>
Start writing the /AF
array to specify the associated files of the
image. PDF 2.0+ or PDF/A-3.
Methods from Deref<Target = Stream<'a>>§
sourcepub fn decode_parms(&mut self) -> DecodeParms<'_>
pub fn decode_parms(&mut self) -> DecodeParms<'_>
Start writing the /DecodeParms
attribute.
This is a dictionary that specifies parameters to be used in decoding
the stream data using the filter specified by the
/Filter
attribute.
Methods from Deref<Target = Dict<'a>>§
sourcepub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
Start writing a pair with an arbitrary value.
sourcepub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self
pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self
Write a pair with a primitive value.
This is a shorthand for dict.insert(key).primitive(value)
.
sourcepub fn pairs<'n, T: Primitive>(
&mut self,
pairs: impl IntoIterator<Item = (Name<'n>, T)>,
) -> &mut Self
pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)>, ) -> &mut Self
Write a sequence of pairs with primitive values.