summaryrefslogtreecommitdiff
path: root/redo/imagelist_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'redo/imagelist_darwin.go')
-rw-r--r--redo/imagelist_darwin.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/redo/imagelist_darwin.go b/redo/imagelist_darwin.go
new file mode 100644
index 0000000..53fafa5
--- /dev/null
+++ b/redo/imagelist_darwin.go
@@ -0,0 +1,38 @@
+// 16 august 2014
+
+package ui
+
+import (
+ "image"
+ "unsafe"
+)
+
+// #include "objc_darwin.h"
+import "C"
+
+type imagelist struct {
+ list []C.id
+}
+
+func newImageList() ImageList {
+ return new(imagelist)
+}
+
+func (i *imagelist) Append(img *image.RGBA) {
+ id := C.toImageListImage(
+ unsafe.Pointer(pixelData(img)), C.intptr_t(img.Rect.Dx()), C.intptr_t(img.Rect.Dy()), C.intptr_t(img.Stride))
+ i.list = append(i.list, id)
+}
+
+func (i *imagelist) Len() ImageIndex {
+ return ImageIndex(len(i.list))
+}
+
+type imageListApply interface {
+ apply(*[]C.id)
+}
+
+func (i *imagelist) apply(out *[]C.id) {
+ *out = make([]C.id, len(i.list))
+ copy(*out, i.list)
+}