1 Star 0 Fork 1

青大叔 / gooxml

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
lineproperties.go 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
qwj 提交于 2021-09-03 14:09 . 修改包名
// Copyright 2017 Baliance. All rights reserved.
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting sales@baliance.com.
package drawing
import (
"gitee.com/jiewen/gooxml"
"gitee.com/jiewen/gooxml/color"
"gitee.com/jiewen/gooxml/measurement"
"gitee.com/jiewen/gooxml/schema/soo/dml"
)
type LineProperties struct {
x *dml.CT_LineProperties
}
// X returns the inner wrapped XML type.
func (l LineProperties) X() *dml.CT_LineProperties {
return l.x
}
// SetWidth sets the line width, MS products treat zero as the minimum width
// that can be displayed.
func (l LineProperties) SetWidth(w measurement.Distance) {
l.x.WAttr = gooxml.Int32(int32(w / measurement.EMU))
}
func (l LineProperties) clearFill() {
l.x.NoFill = nil
l.x.GradFill = nil
l.x.SolidFill = nil
l.x.PattFill = nil
}
func (l LineProperties) SetNoFill() {
l.clearFill()
l.x.NoFill = dml.NewCT_NoFillProperties()
}
func (l LineProperties) SetSolidFill(c color.Color) {
l.clearFill()
l.x.SolidFill = dml.NewCT_SolidColorFillProperties()
l.x.SolidFill.SrgbClr = dml.NewCT_SRgbColor()
l.x.SolidFill.SrgbClr.ValAttr = *c.AsRGBString()
}
// LineJoin is the type of line join
type LineJoin byte
// LineJoin types
const (
LineJoinRound LineJoin = iota
LineJoinBevel
LineJoinMiter
)
// SetJoin sets the line join style.
func (l LineProperties) SetJoin(e LineJoin) {
l.x.Round = nil
l.x.Miter = nil
l.x.Bevel = nil
switch e {
case LineJoinRound:
l.x.Round = dml.NewCT_LineJoinRound()
case LineJoinBevel:
l.x.Bevel = dml.NewCT_LineJoinBevel()
case LineJoinMiter:
l.x.Miter = dml.NewCT_LineJoinMiterProperties()
}
}
1
https://gitee.com/jiewen/gooxml.git
git@gitee.com:jiewen/gooxml.git
jiewen
gooxml
gooxml
c517a803bade

搜索帮助