dmlpic

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

These elements encompass the definition of pictures within the DrawingML framework. While pictures are in many ways very similar to shapes they have specific properties that are unique in order to optimize for picture-specific scenarios. Some of these properties include Fill behavior, Border behavior and Resize behavior.

Index

Constants

View Source
const (
	BlackWhiteModeClr        = "clr"
	BlackWhiteModeAuto       = "auto"
	BlackWhiteModeGray       = "gray"
	BlackWhiteModeLtGray     = "ltGray"
	BlackWhiteModeInvGray    = "invGray"
	BlackWhiteModeGrayWhite  = "grayWhite"
	BlackWhiteModeBlackGray  = "blackGray"
	BlackWhiteModeBlackWhite = "blackWhite"
	BlackWhiteModeBlack      = "black"
	BlackWhiteModeWhite      = "white"
	BlackWhiteModeHidden     = "hidden"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Blip

type Blip struct {
	EmbedID string `xml:"embed,attr,omitempty"`
}

Binary large image or picture

func (Blip) MarshalXML

func (b Blip) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type BlipFill

type BlipFill struct {
	// 1. Blip
	Blip *Blip `xml:"blip,omitempty"`

	//2.Source Rectangle
	SrcRect *dmlct.RelativeRect `xml:"srcRect,omitempty"`

	// 3. Choice of a:EG_FillModeProperties
	FillModeProps FillModeProps `xml:",any"`

	//Attributes:
	DPI          *uint32 `xml:"dpi,attr,omitempty"`          //DPI Setting
	RotWithShape *bool   `xml:"rotWithShape,attr,omitempty"` //Rotate With Shape
}

func NewBlipFill

func NewBlipFill(rID string) BlipFill

NewBlipFill creates a new BlipFill with the given relationship ID (rID) The rID is used to reference the image in the presentation.

func (BlipFill) MarshalXML

func (b BlipFill) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type CNvPicPr

type CNvPicPr struct {
	//Relative Resize Preferred	- Default value is "true"(i.e when attr not specified).
	PreferRelativeResize *bool `xml:"preferRelativeResize,attr,omitempty"`

	//1. Picture Locks
	PicLocks *dmlprops.PicLocks `xml:"picLocks,omitempty"`
}

Non-Visual Picture Drawing Properties

func NewCNvPicPr

func NewCNvPicPr() CNvPicPr

func (CNvPicPr) MarshalXML

func (c CNvPicPr) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FillModeProps

type FillModeProps struct {
	Stretch *shapes.Stretch `xml:"stretch,omitempty"`
	Tile    *shapes.Tile    `xml:"tile,omitempty"`
}

func (FillModeProps) MarshalXML

func (f FillModeProps) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type NonVisualPicProp

type NonVisualPicProp struct {
	// 1. Non-Visual Drawing Properties
	CNvPr dmlct.CNvPr `xml:"cNvPr,omitempty"`

	// 2.Non-Visual Picture Drawing Properties
	CNvPicPr CNvPicPr `xml:"cNvPicPr,omitempty"`
}

Non-Visual Picture Properties

func DefaultNVPicProp

func DefaultNVPicProp(id uint, name string) NonVisualPicProp

func NewNVPicProp

func NewNVPicProp(cNvPr dmlct.CNvPr, cNvPicPr CNvPicPr) NonVisualPicProp

func (NonVisualPicProp) MarshalXML

func (n NonVisualPicProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Offset

type Offset struct {
	X uint64 `xml:"x,attr,omitempty"`
	Y uint64 `xml:"y,attr,omitempty"`
}

func (Offset) MarshalXML

func (o Offset) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Pic

type Pic struct {
	// 1. Non-Visual Picture Properties
	NonVisualPicProp NonVisualPicProp `xml:"nvPicPr,omitempty"`

	// 2.Picture Fill
	BlipFill BlipFill `xml:"blipFill,omitempty"`

	// 3.Shape Properties
	PicShapeProp PicShapeProp `xml:"spPr,omitempty"`
}

func NewPic

func NewPic(rID string, imgCount uint, width units.Emu, height units.Emu) *Pic

func (Pic) MarshalXML

func (p Pic) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PicShapeProp

type PicShapeProp struct {
	// -- Attributes --
	//Black and White Mode
	BwMode *string `xml:"bwMode,attr,omitempty"`

	// -- Child Elements --
	//1.2D Transform for Individual Objects
	TransformGroup *TransformGroup `xml:"xfrm,omitempty"`

	// 2. Choice
	//TODO: Modify it as Geometry choice
	PresetGeometry *PresetGeometry `xml:"prstGeom,omitempty"`
}

func NewPicShapeProp

func NewPicShapeProp(options ...PicShapePropOption) *PicShapeProp

func (PicShapeProp) MarshalXML

func (p PicShapeProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PicShapePropOption

type PicShapePropOption func(*PicShapeProp)

func WithPrstGeom

func WithPrstGeom(preset string) PicShapePropOption

func WithTransformGroup

func WithTransformGroup(options ...TFGroupOption) PicShapePropOption

type PresetGeometry

type PresetGeometry struct {
	Preset       string             `xml:"prst,attr,omitempty"`
	AdjustValues *geom.AdjustValues `xml:"avLst,omitempty"`
}

func NewPresetGeom

func NewPresetGeom(preset string) *PresetGeometry

func (PresetGeometry) MarshalXML

func (p PresetGeometry) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TFGroupOption

type TFGroupOption func(*TransformGroup)

func WithTFExtent

func WithTFExtent(width units.Emu, height units.Emu) TFGroupOption

type TransformGroup

type TransformGroup struct {
	Extent *dmlct.PSize2D `xml:"ext,omitempty"`
	Offset *Offset        `xml:"off,omitempty"`
}

func NewTransformGroup

func NewTransformGroup(options ...TFGroupOption) *TransformGroup

func (TransformGroup) MarshalXML

func (t TransformGroup) MarshalXML(e *xml.Encoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL