Skip to main content

Pic

Struct Pic 

Source
pub struct Pic {
Show 13 fields pub id: u32, pub name: String, pub rid: String, pub is_placeholder: bool, pub ph_idx: Option<u32>, pub ph_type: Option<String>, pub properties: ShapeProperties, pub src_rect: Option<(i32, i32, i32, i32)>, pub fill_mode: BlipFillMode, pub alpha: Option<i32>, pub style: Option<ShapeStyle>, pub ext_lst: Option<ExtensionList>, pub media: Option<MediaKind>,
}
Expand description

<p:pic> 图片。

Fields§

§id: u32§name: String§rid: String§is_placeholder: bool

是否为占位符(TODO-007)。

truewrite_xml 会在 <p:nvPicPr>/<p:nvPr> 内写出 <p:ph .../>。 图片占位符对应版式中的 <p:ph type="pic"/>,用户点击后弹出“插入图片“对话框。

§ph_idx: Option<u32>

占位符 idx(<p:ph idx="..."/>,仅当 is_placeholder 为 true 时有效)。

§ph_type: Option<String>

占位符类型(<p:ph type="..."/>)。

图片占位符通常为 "pic"Nonewrite_xml 不写出 type 属性。

§properties: ShapeProperties§src_rect: Option<(i32, i32, i32, i32)>

图片裁剪。

§fill_mode: BlipFillMode

填充模式(拉伸/平铺/无)。

§alpha: Option<i32>

图片透明度(0-100000,30000 = 30% 不透明 / 70% 透明)。

对应 <a:blip> 内的 <a:alphaModFix amt="..."/> 元素。 常用于图片水印场景:alpha = Some(30_000) 表示 30% 不透明。

§style: Option<ShapeStyle>

主题样式引用(p:style,可选)。

§ext_lst: Option<ExtensionList>

扩展列表。

§media: Option<MediaKind>

媒体引用(TODO-033 音视频嵌入)。

None 表示普通图片;Some(MediaKind::Video { rid }) / Some(MediaKind::Audio { rid }) 表示该 <p:pic> 实际是视频/音频形状,write_xml 会在 <p:nvPr> 内写出 <a:videoFile r:link="..."/><a:audioFile r:link="..."/>rid 指向媒体 part 的关系 id(与 self.rid 指向海报帧图片不同)。

Implementations§

Source§

impl Pic

Source

pub fn write_xml(&self, w: &mut XmlWriter)

写 XML。

按 OOXML CT_Picture 的子元素顺序:

<p:pic>
  <p:nvPicPr>...</p:nvPicPr>
  <p:blipFill>...</p:blipFill>
  <p:spPr>...</p:spPr>
  <p:style>...</p:style>          ← 可选
  <p:extLst>...</p:extLst>        ← 可选
</p:pic>

Trait Implementations§

Source§

impl Clone for Pic

Source§

fn clone(&self) -> Pic

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 Pic

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Pic

Source§

fn default() -> Pic

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Pic

§

impl RefUnwindSafe for Pic

§

impl Send for Pic

§

impl Sync for Pic

§

impl Unpin for Pic

§

impl UnsafeUnpin for Pic

§

impl UnwindSafe for Pic

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