summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-08-14 23:09:16 +0200
committerKevin Chabowski <kevin@kch42.de>2013-08-14 23:09:16 +0200
commit8841e007475aaf415cca68047f0fa0d2b3cf7f73 (patch)
tree6c2ccdca911bce52e17544dc33e625c079073745
parente8e1f6b51b1ecafff7f6f348d240161d20ab0db6 (diff)
downloadbiomed-8841e007475aaf415cca68047f0fa0d2b3cf7f73.tar.gz
biomed-8841e007475aaf415cca68047f0fa0d2b3cf7f73.tar.bz2
biomed-8841e007475aaf415cca68047f0fa0d2b3cf7f73.zip
Using gdk.Color instead of image/color for colorbox
-rw-r--r--biome_infos.go52
-rw-r--r--colorbox.go9
2 files changed, 28 insertions, 33 deletions
diff --git a/biome_infos.go b/biome_infos.go
index 2d50c67..7ee1d3c 100644
--- a/biome_infos.go
+++ b/biome_infos.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/kch42/gomcmap/mcmap"
- "github.com/kch42/kagus"
+ "github.com/mattn/go-gtk/gdk"
)
var bioList = []mcmap.Biome{
@@ -32,29 +32,29 @@ var bioList = []mcmap.Biome{
mcmap.BioUncalculated,
}
-var bioColors = map[mcmap.Biome]kagus.RGB0x{
- mcmap.BioOcean: 0x0000ff,
- mcmap.BioPlains: 0x9fe804,
- mcmap.BioDesert: 0xf5ff58,
- mcmap.BioExtremeHills: 0xa75300,
- mcmap.BioForest: 0x006f2a,
- mcmap.BioTaiga: 0x05795a,
- mcmap.BioSwampland: 0x6a7905,
- mcmap.BioRiver: 0x196eff,
- mcmap.BioHell: 0xd71900,
- mcmap.BioSky: 0x871eb3,
- mcmap.BioFrozenOcean: 0xd6f0ff,
- mcmap.BioFrozenRiver: 0x8fb6cd,
- mcmap.BioIcePlains: 0xfbfbfb,
- mcmap.BioIceMountains: 0xc6bfb1,
- mcmap.BioMushroomIsland: 0x9776a4,
- mcmap.BioMushroomIslandShore: 0x9e8ebc,
- mcmap.BioBeach: 0xfffdc9,
- mcmap.BioDesertHills: 0xadb354,
- mcmap.BioForestHills: 0x40694f,
- mcmap.BioTaigaHills: 0x5b8578,
- mcmap.BioExtremeHillsEdge: 0xa77748,
- mcmap.BioJungle: 0x22db04,
- mcmap.BioJungleHills: 0x63bf54,
- mcmap.BioUncalculated: 0x333333,
+var bioColors = map[mcmap.Biome]*gdk.Color{
+ mcmap.BioOcean: gdk.NewColor("#0000ff"),
+ mcmap.BioPlains: gdk.NewColor("#9fe804"),
+ mcmap.BioDesert: gdk.NewColor("#f5ff58"),
+ mcmap.BioExtremeHills: gdk.NewColor("#a75300"),
+ mcmap.BioForest: gdk.NewColor("#006f2a"),
+ mcmap.BioTaiga: gdk.NewColor("#05795a"),
+ mcmap.BioSwampland: gdk.NewColor("#6a7905"),
+ mcmap.BioRiver: gdk.NewColor("#196eff"),
+ mcmap.BioHell: gdk.NewColor("#d71900"),
+ mcmap.BioSky: gdk.NewColor("#871eb3"),
+ mcmap.BioFrozenOcean: gdk.NewColor("#d6f0ff"),
+ mcmap.BioFrozenRiver: gdk.NewColor("#8fb6cd"),
+ mcmap.BioIcePlains: gdk.NewColor("#fbfbfb"),
+ mcmap.BioIceMountains: gdk.NewColor("#c6bfb1"),
+ mcmap.BioMushroomIsland: gdk.NewColor("#9776a4"),
+ mcmap.BioMushroomIslandShore: gdk.NewColor("#9e8ebc"),
+ mcmap.BioBeach: gdk.NewColor("#fffdc9"),
+ mcmap.BioDesertHills: gdk.NewColor("#adb354"),
+ mcmap.BioForestHills: gdk.NewColor("#40694f"),
+ mcmap.BioTaigaHills: gdk.NewColor("#5b8578"),
+ mcmap.BioExtremeHillsEdge: gdk.NewColor("#a77748"),
+ mcmap.BioJungle: gdk.NewColor("#22db04"),
+ mcmap.BioJungleHills: gdk.NewColor("#63bf54"),
+ mcmap.BioUncalculated: gdk.NewColor("#333333"),
}
diff --git a/colorbox.go b/colorbox.go
index a9d1583..24b0941 100644
--- a/colorbox.go
+++ b/colorbox.go
@@ -1,16 +1,11 @@
package main
import (
- "fmt"
"github.com/mattn/go-gtk/gdk"
"github.com/mattn/go-gtk/gtk"
- "image/color"
)
-func colorBox(c color.Color) *gtk.DrawingArea {
- r, g, b, _ := c.RGBA()
- colstring := fmt.Sprintf("#%02x%02x%02x", (r>>8)&0xff, (g>>8)&0xff, (b>>8)&0xff)
-
+func colorBox(c *gdk.Color) *gtk.DrawingArea {
dArea := gtk.NewDrawingArea()
var pixmap *gdk.Pixmap
var gc *gdk.GC
@@ -22,7 +17,7 @@ func colorBox(c color.Color) *gtk.DrawingArea {
alloc := dArea.GetAllocation()
pixmap = gdk.NewPixmap(dArea.GetWindow().GetDrawable(), alloc.Width, alloc.Height, 24)
gc = gdk.NewGC(pixmap.GetDrawable())
- gc.SetRgbFgColor(gdk.NewColor(colstring))
+ gc.SetRgbFgColor(c)
pixmap.GetDrawable().DrawRectangle(gc, true, 0, 0, -1, -1)
})