feat(编辑功能): 修复颜色与媒体资源引用

This commit is contained in:
xiaoqidun committed 2026-10-10 16:31:56 +08:00
1 parent 52fc88f2b8
commit 996f8f9518
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -233,7 +233,7 @@ func (e *Editor) Color(value *FillColor) (color.NRGBA, error) {
found, _ = resourceValue(e.source.reader.colorSpaceCache, id) found, _ = resourceValue(e.source.reader.colorSpaceCache, id)
} }
for _, resource := range e.resources { for _, resource := range e.resources {
if resource.space != nil && resource.space.ID == id { if resource.space != nil && sameResourceID(resource.space.ID, id) {
found = resource.space found = resource.space
break break
} }
+1 -1
View File
@@ -55,7 +55,7 @@ func (e *Editor) AddMedia(kind, format string, data []byte) (string, error) {
func (e *Editor) CopyMedia(id string) (string, error) { func (e *Editor) CopyMedia(id string) (string, error) {
var copy editorResource var copy editorResource
for _, resource := range e.resources { for _, resource := range e.resources {
if resource.image != nil && resource.image.ID == id { if resource.image != nil && sameResourceID(resource.image.ID, id) {
copy = resource copy = resource
break break
} }
+1 -1
View File
@@ -349,7 +349,7 @@ func (e *Editor) sourceRGB() bool {
if e.source == nil || e.source.document.CommonData.DefaultCS == 0 { if e.source == nil || e.source.document.CommonData.DefaultCS == 0 {
return true return true
} }
space := e.source.reader.colorSpaceCache[strconv.Itoa(e.source.document.CommonData.DefaultCS)] space, _ := resourceValue(e.source.reader.colorSpaceCache, strconv.Itoa(e.source.document.CommonData.DefaultCS))
return space != nil && space.Type == "RGB" && space.Profile == "" && (space.BitsPerComponent == 0 || space.BitsPerComponent == 8) && len(space.Palette) == 0 return space != nil && space.Type == "RGB" && space.Profile == "" && (space.BitsPerComponent == 0 || space.BitsPerComponent == 8) && len(space.Palette) == 0
} }