diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-08-18 12:33:55 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-08-18 12:33:55 +0200 |
commit | 3f31751d69ee114076e055468fc42cba3e420a85 (patch) | |
tree | 6d27993a5605820153f4cb69f89e985d6e25ad84 /emptyPixmap.go | |
parent | 3fadcc33f7d2593a0c7630152d29bb327d7d66bb (diff) | |
download | biomed-3f31751d69ee114076e055468fc42cba3e420a85.tar.gz biomed-3f31751d69ee114076e055468fc42cba3e420a85.tar.bz2 biomed-3f31751d69ee114076e055468fc42cba3e420a85.zip |
Restructured code.
Most non-GUI code was moved out of mapwidget.go
Diffstat (limited to 'emptyPixmap.go')
-rw-r--r-- | emptyPixmap.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/emptyPixmap.go b/emptyPixmap.go new file mode 100644 index 0000000..7635225 --- /dev/null +++ b/emptyPixmap.go @@ -0,0 +1,13 @@ +package main + +import ( + "github.com/mattn/go-gtk/gdk" +) + +// emptyPixmap creates an empty pixmap. +func emptyPixmap(w, h, depth int) *gdk.Pixmap { + // The underlying C function would create an empty, unbound pixmap, if the drawable paramater was a NULL pointer. + // Since simply passing a nil value would result in a panic (dereferencing a nil pointer), we use a new gdk.Drawable. + // gdk.Drawable contains a C pointer which is NULL by default. So passing a new(gdk.Drawable) does the trick. + return gdk.NewPixmap(new(gdk.Drawable), w, h, depth) +} |