summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-02-17 23:26:46 -0500
committerPietro Gagliardi <[email protected]>2015-02-17 23:26:46 -0500
commit2e4c2783012cb386b29b04237e2a198fbcfe5e4d (patch)
tree27950a5a98b038ce39f124b321ea8de0ec6b3063
parent1fd265135d17d682b3e0f884502ffa2037a379ae (diff)
Started migrating the GTK+ Table to the new ImageList-less design. Migrated the ImageList code itself.
-rw-r--r--image_unix.go (renamed from imagelist_unix.go)25
1 files changed, 2 insertions, 23 deletions
diff --git a/imagelist_unix.go b/image_unix.go
index 1729705..3f13d2a 100644
--- a/imagelist_unix.go
+++ b/image_unix.go
@@ -13,19 +13,11 @@ import (
// #include "gtk_unix.h"
import "C"
-type imagelist struct {
- list []*C.GdkPixbuf
-}
-
-func newImageList() ImageList {
- return new(imagelist)
-}
-
// this is what GtkFileChooserWidget uses
// technically it uses max(width from that, height from that) if the call below fails and 16x16 otherwise, but we won't worry about that here (yet?)
const scaleTo = C.GTK_ICON_SIZE_MENU
-func (i *imagelist) Append(img *image.RGBA) {
+func toIconSizedGdkPixbuf(img *image.RGBA) *C.GdkPixbuf {
var width, height C.gint
surface := C.cairo_image_surface_create(C.CAIRO_FORMAT_ARGB32,
@@ -59,20 +51,7 @@ func (i *imagelist) Append(img *image.RGBA) {
panic(fmt.Errorf("gdk_pixbuf_scale_simple() failed in ImageList.Append() (no reason available)"))
}
- i.list = append(i.list, pixbuf)
C.g_object_unref(C.gpointer(unsafe.Pointer(basepixbuf)))
C.cairo_surface_destroy(surface)
-}
-
-func (i *imagelist) Len() ImageIndex {
- return ImageIndex(len(i.list))
-}
-
-type imageListApply interface {
- apply(*[]*C.GdkPixbuf)
-}
-
-func (i *imagelist) apply(out *[]*C.GdkPixbuf) {
- *out = make([]*C.GdkPixbuf, len(i.list))
- copy(*out, i.list)
+ return pixbuf
}