if @pixbuf
window.draw_pixbuf(nil, @pixbuf, 0, 0, @xpos, @ypos, -1, -1, Gdk::RGB::DITHER_NONE, -1, -1)
if @entry && @entry.type == 'video'
- y = @ypos
- while y < @ypos + @pixbuf.height
- render_height = [ @pixbuf.height, @ypos + @pixbuf.height - y ].min
- window.draw_pixbuf(nil, $videoborder_pixbuf, 0, 0, @xpos - $videoborder_pixbuf.width, y, -1, render_height, Gdk::RGB::DITHER_NONE, -1, -1)
- window.draw_pixbuf(nil, $videoborder_pixbuf, 0, 0, @xpos + @pixbuf.width, y, -1, render_height, Gdk::RGB::DITHER_NONE, -1, -1)
- y += $videoborder_pixbuf.height
- end
+ window.draw_borders($videoborder_pixbuf, @xpos - $videoborder_pixbuf.width, @xpos + @pixbuf.width, @ypos, @ypos + @pixbuf.height)
end
end
end
#include <math.h>
#define GDK_PIXBUF_ENABLE_BACKEND
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gdk-pixdata.h>
+#include <gtk/gtk.h>
#include "rbgobject.h"
#define _SELF(s) GDK_PIXBUF(RVAL2GOBJ(s))
return Qnil;
}
+static VALUE draw_borders(VALUE self, VALUE pixbuf, VALUE x1, VALUE x2, VALUE ystart, VALUE yend) {
+ GdkDrawable* drawable = GDK_DRAWABLE(RVAL2GOBJ(self));
+ int y = NUM2INT(ystart);
+ int yend_ = NUM2INT(yend);
+ GdkPixbuf* pb = GDK_PIXBUF(RVAL2GOBJ(pixbuf));
+ int height = gdk_pixbuf_get_height(pb);
+ while (y < yend_) {
+ int render_height = MIN(height, yend_ - y);
+ gdk_draw_pixbuf(drawable, NULL, pb, 0, 0, NUM2INT(x1), y, -1, render_height, GDK_RGB_DITHER_NONE, -1, -1);
+ gdk_draw_pixbuf(drawable, NULL, pb, 0, 0, NUM2INT(x2), y, -1, render_height, GDK_RGB_DITHER_NONE, -1, -1);
+ y += height;
+ }
+ return self;
+}
void
rb_define_method(cinfo->klass, "whitebalance!", whitebalance, 1);
rb_define_method(cinfo->klass, "gammacorrect!", gammacorrect, 1);
+ cinfo = (RGObjClassInfo*)rbgobj_lookup_class_by_gtype(GDK_TYPE_DRAWABLE, Qnil);
+ rb_define_method(cinfo->klass, "draw_borders", draw_borders, 5);
+
VALUE exif = rb_define_module("Exif");
rb_define_module_function(exif, "orientation", exif_orientation, 1);
rb_define_module_function(exif, "datetimeoriginal", exif_datetimeoriginal, 1);