Skip to content

Commit

Permalink
oprava ukládání obrázku a nastavení světlého stylu
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-vl committed Nov 20, 2023
1 parent 26bc439 commit 4ba793d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion hans.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"image"
"image/color"
"strings"

imgui "github.com/gabstv/cimgui-go"
ebimgui "github.com/gabstv/ebiten-imgui/v3"
Expand Down Expand Up @@ -49,6 +50,14 @@ func init() {
white.Fill(color.White)
}

func appendFileExtension(filepath string, extension string) string {
if strings.HasSuffix(strings.ToLower(filepath), strings.ToLower(extension)) {
return filepath
} else {
return filepath + extension
}
}

func (g *G) Draw(screen *ebiten.Image) {
// bílé pozadí
g.cam.Surface.Clear()
Expand Down Expand Up @@ -116,6 +125,7 @@ func (g *G) Update() error {
if err != nil {
fmt.Println("Chyba: Nebylo zvoleno, kam uložit soubor!")
}
output_filepath = appendFileExtension(output_filepath, ".png")

sav_input_pic := OpenImage(g.filepath)
sav_bounds := sav_input_pic.Bounds()
Expand Down Expand Up @@ -245,9 +255,11 @@ func main() {

// font1 = imgui.CurrentIO().Fonts().AddFontFromFileTTFV("font/NotoSans/NotoSans-Regular.ttf", 16, cfg0, glyphs.Data())

font1 = imgui.CurrentIO().Fonts().AddFontFromFileTTF("font/NotoSans/NotoSans-Regular.ttf", 16.0)
font1 = imgui.CurrentIO().Fonts().AddFontFromFileTTF("font/NotoSans/NotoSans-Medium.ttf", 16.0)
imgui.CurrentIO().Fonts().Build()

imgui.StyleColorsLight()

gg := &G{
drawing_type: false,
duration: "",
Expand Down

0 comments on commit 4ba793d

Please sign in to comment.