mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 13:56:32 +08:00
This commit is contained in:
1 parent
2cc6c121f8
commit
7f79d1e70a
18 files changed
+757
-129
No files matched your search
+13
-3
@@ -16,6 +16,7 @@ package ofdgo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
"strings"
|
||||
|
||||
"github.com/go-text/typesetting/segmenter"
|
||||
@@ -125,10 +126,19 @@ func (e *Editor) styleTextObjects(objects []GraphicObject, style TextStyle) ([]G
|
||||
}
|
||||
}
|
||||
if style.Color != "" {
|
||||
if text.FillColor == nil {
|
||||
text.FillColor = &FillColor{}
|
||||
if err := creationColor(&FillColor{Value: style.Color}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
text.FillColor.Value = style.Color
|
||||
var r, g, b float64
|
||||
fmt.Sscan(style.Color, &r, &g, &b)
|
||||
value, err := e.RGBColor(color.NRGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if text.FillColor != nil {
|
||||
value.Alpha = text.FillColor.Alpha
|
||||
}
|
||||
text.FillColor = value
|
||||
}
|
||||
}
|
||||
return updates, nil
|
||||
|
||||
Reference in new issue
Block a user