Skip to content

Commit

Permalink
fix: fix brightness and saturation export on ocp screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelesaux committed Dec 23, 2024
1 parent a4a601d commit 440ce35
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

cd /root/martine
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -o ./build/martine.exe ./cli
GOOS=linux GOARCH=amd64 go build -o ./build/martine.linux ./cli
#CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -o ./build/martine.exe ./cli
GOOS=linux GOARCH=amd64 go build -o ./build/martine.linux ./ui/


4 changes: 2 additions & 2 deletions export/ocpartstudio/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,8 +1467,8 @@ func BasicLoader(filePath string, p color.Palette, cfg *config.MartineConfig) er
v, err := constants.FirmwareNumber(p[i])
if err == nil {
out += fmt.Sprintf("%0.2d", v)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
if i+1 < len(p) {
out += ","
Expand Down
5 changes: 5 additions & 0 deletions gfx/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ func ApplyOneImage(in image.Image,
}
if cfg.ScrCfg.Process.Saturation > 0 || cfg.ScrCfg.Process.Brightness > 0 {
palette = ci.EnhanceBrightness(newPalette, cfg.ScrCfg.Process.Brightness, cfg.ScrCfg.Process.Saturation)
refPal := constants.CpcOldPalette
if cfg.ScrCfg.IsPlus {
refPal = constants.CpcPlusPalette
}
palette = ci.ConvertPalette(palette, refPal)
newPalette, out = ci.DowngradingWithPalette(out, palette)
var paletteToSort color.Palette
switch mode {
Expand Down
13 changes: 13 additions & 0 deletions ui/martine-ui/image_tab.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,26 @@ func (m *MartineUI) newImageTransfertTab(me *menu.ImageMenu) *fyne.Container {
brightness.Step = .01
brightness.OnChanged = func(f float64) {
me.Cfg.ScrCfg.Process.Brightness = f
if f == 1.0 {
me.Edited = false
me.UsePalette = false
} else {
me.Edited = true
}
}
saturationLabel := widget.NewLabel("Saturation")
saturation := widget.NewSlider(0.0, 1.0)
saturation.SetValue(1.)
saturation.Step = .01
saturation.OnChanged = func(f float64) {
me.Cfg.ScrCfg.Process.Saturation = f
if f == 1.0 {
me.Edited = false
me.UsePalette = false
} else {
me.Edited = true
}

}
brightnessLabel := widget.NewLabel("Brightness")

Expand Down
6 changes: 6 additions & 0 deletions ui/martine-ui/menu/image_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,15 @@ func (me *ImageMenu) NewConfig(checkOriginalImage bool) *config.MartineConfig {
if me.Cfg.ScrCfg.Process.Brightness > 0 && me.Cfg.ScrCfg.Process.Saturation == 0 {
me.Cfg.ScrCfg.Process.Saturation = me.Cfg.ScrCfg.Process.Brightness
}
if me.Cfg.ScrCfg.Process.Brightness > 0 {
me.Edited = true
}
if me.Cfg.ScrCfg.Process.Brightness == 0 && me.Cfg.ScrCfg.Process.Saturation > 0 {
me.Cfg.ScrCfg.Process.Brightness = me.Cfg.ScrCfg.Process.Saturation
}
if me.Cfg.ScrCfg.Process.Saturation > 0 {
me.Edited = true
}
me.Cfg.ScrCfg.Size = constants.NewSizeMode(me.Cfg.ScrCfg.Mode, me.Cfg.ScrCfg.Type.IsFullScreen())
if me.Cfg.ScrCfg.Type.IsSprite() {
width, _, err := me.GetWidth()
Expand Down

0 comments on commit 440ce35

Please sign in to comment.