Skip to content

Commit

Permalink
fix: fix palette convertion in tile tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jerome.lesaux committed Nov 12, 2024
1 parent 6ae2e7a commit 1ef7b37
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gfx/tilemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func TilemapClassical(mode uint8, isCpcPlus bool, filename, picturePath string,
mapSize := constants.Size{Width: in.Bounds().Max.X, Height: in.Bounds().Bounds().Max.Y, ColorsAvailable: 16}
m := ci.Resize(in, mapSize, cfg.ScrCfg.Process.ResizingAlgo)
var palette color.Palette
palette = ci.ExtractPalette(m, isCpcPlus, cfg.ScrCfg.Size.ColorsAvailable)
palette, _, _ = ci.DowngradingPalette(m, cfg.ScrCfg.Size, isCpcPlus)
refPalette := constants.CpcOldPalette
if cfg.ScrCfg.IsPlus {
refPalette = constants.CpcPlusPalette
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/go-text/typesetting v0.2.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/jeromelesaux/fyne-io v0.0.0-20241110220536-1bfc4382e7f7
github.com/jeromelesaux/fyne-io v0.0.0-20241112080444-354b23c6e4c0
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/muesli/clusters v0.0.0-20200529215643-2700303c1762 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ github.com/jeromelesaux/fyne-io v0.0.0-20241110200135-c8baa8a7fc0c h1:e9QzGbC8u2
github.com/jeromelesaux/fyne-io v0.0.0-20241110200135-c8baa8a7fc0c/go.mod h1:CfylT5HbwoZiniHx+zg+9fpOM4P8cE6XQuyUOTJHVOo=
github.com/jeromelesaux/fyne-io v0.0.0-20241110220536-1bfc4382e7f7 h1:pQqCMgELaD/+xm5XBiqgJUzgSsNes/hLNmDH3SsNkqo=
github.com/jeromelesaux/fyne-io v0.0.0-20241110220536-1bfc4382e7f7/go.mod h1:CfylT5HbwoZiniHx+zg+9fpOM4P8cE6XQuyUOTJHVOo=
github.com/jeromelesaux/fyne-io v0.0.0-20241112080444-354b23c6e4c0 h1:Yo25HaXORWETcDIWQgjiCn9JT6VnJ913MA+hmZm/D2c=
github.com/jeromelesaux/fyne-io v0.0.0-20241112080444-354b23c6e4c0/go.mod h1:CfylT5HbwoZiniHx+zg+9fpOM4P8cE6XQuyUOTJHVOo=
github.com/jeromelesaux/m4client v0.0.0-20200309212559-efb59c22369c/go.mod h1:JO0ijl8YXO6FxogJoC3yAFbBjSAnkwFquc8W6C7k94E=
github.com/jeromelesaux/m4client v0.0.0-20230327092026-4e80fd2b1474 h1:CWtkpA4Q63pkhHWRrd/e98JD4YVZhk3SZu58bUkQsuI=
github.com/jeromelesaux/m4client v0.0.0-20230327092026-4e80fd2b1474/go.mod h1:Xc0HzC2TZ7fbDWyB8LosvziBQ5QvvwVt3xxAIEavWRc=
Expand Down
1 change: 1 addition & 0 deletions ui/martine-ui/tilemap_tab.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (m *MartineUI) SetTileImage(newTile image.Image, p color.Palette) {

// nolint: funlen, gocognit
func (m *MartineUI) newTilemapTab(tm *menu.TilemapMenu) *fyne.Container {
tm.Cfg.ScrCfg.Size.ColorsAvailable = constants.Mode0.ColorsAvailable // default value
tm.ImageMenu.SetWindow(m.window)
tm.Cfg.ScrCfg.Type = config.SpriteFormat
importOpen := newImportButton(m, tm.ImageMenu)
Expand Down

0 comments on commit 1ef7b37

Please sign in to comment.