1 Star 0 Fork 1

窦雪峰/unioffice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lineproperties.go 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
Todd 提交于 2017-09-29 20:56 . gooxml: clean up some old TODOs
// 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 (
"baliance.com/gooxml"
"baliance.com/gooxml/color"
"baliance.com/gooxml/measurement"
"baliance.com/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()
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/douxuefeng/unioffice.git
git@gitee.com:douxuefeng/unioffice.git
douxuefeng
unioffice
unioffice
v0.7.1

搜索帮助