Struct pdf_writer::writers::ImageXObject
source · 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.
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.
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.
sourcepub fn s_mask_in_data(&mut self, mode: SMaskInData) -> &mut Self
pub fn s_mask_in_data(&mut self, mode: SMaskInData) -> &mut Self
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.
Methods from Deref<Target = Stream<'a>>§
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.