Skip to main content

ContentShading

Struct ContentShading 

Source
pub struct ContentShading {
    pub name: String,
    pub shading_dict: Option<Dict>,
    pub ctm: Transform2D,
    pub clip: Option<Path>,
    pub mesh: Option<MeshShading>,
    pub gradient: Option<ShadingGradient>,
}
Expand description

One name sh shading-paint event surfaced by parse_content_stream_full_with_shading. ISO 32000-1 §8.7.4.5 defines sh as “paint the shape and colour shading described by a shading dictionary, subject to the current clipping path”. This surface captures every input that determines the painted region and colour:

  • name — the shading-resource key the operator named (leading / stripped).
  • shading_dict — the resolved shading dictionary from /Resources /Shading /<name>, or None when the caller didn’t plumb in shading_resources (or when the name wasn’t a key in the supplied resources).
  • ctm — the composed current transformation matrix at the moment of the paint (every cm in every enclosing q frame, composed root-to-leaf). All coordinates inside shading_dict are interpreted relative to this transform per §8.7.4.5 (“interpreted relative to the current user space”).
  • clip — the most recent W/W*-committed clip path in the active q frame, or None when no clip is in force. The shading is subject to this region (§8.7.4.5 “subject to the current clipping path”).

Fields§

§name: String

Shading-resource key the sh operator named, with the leading / stripped (e.g. "Sh1"). Empty when the operator was issued without a /Name operand (malformed but tolerated, mirroring the round-128 Tj-without-Tf stance).

§shading_dict: Option<Dict>

Resolved shading dictionary from /Resources /Shading /<name>, or None when the caller didn’t plumb in shading_resources (the legacy entry points) or when the name wasn’t a key in the supplied resources.

§ctm: Transform2D

Effective CTM at the moment of the paint — composed of every cm operator in every enclosing q frame, root-to-leaf.

§clip: Option<Path>

Active clip path from the current q frame’s most recent W/W*. None when no clip is in force.

§mesh: Option<MeshShading>

Evaluated mesh geometry for a Type 4–7 shading (free-form / lattice-form Gouraud triangle mesh, Coons patch mesh, or tensor-product patch mesh, §8.7.4.5.5–8.7.4.5.8). None for an axial / radial / function-based shading (Types 1–3, which carry their colour in the Function entry rather than a mesh stream), for a shading the caller didn’t plumb resources for, or for a mesh whose stream / colour space / function couldn’t be reduced to evaluated RGB vertices. Coordinates are in the shading’s target coordinate space (pre-ctm); apply ctm to map them to device space.

§gradient: Option<ShadingGradient>

Evaluated gradient geometry + sampled colour stops for a Type 1–3 shading (function-based / axial / radial, §8.7.4.5.2–4). None for a Type 4–7 mesh shading (use mesh instead), for a shading the caller didn’t plumb resources for, or for a shading whose colour space / function couldn’t be evaluated. Coordinates are in the shading’s target coordinate space (pre-ctm).

Trait Implementations§

Source§

impl Clone for ContentShading

Source§

fn clone(&self) -> ContentShading

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContentShading

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V