X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gdk%2Fgdk.drawing-primitives.lisp;h=b1b6db6f4175e7c31f62a00ad79e672a3aba57f5;hb=a088fbe624f085d53b356d77d15ef4aca0788ceb;hp=03e7324a333014a0ab4366cd0985c83a8de66ffb;hpb=4c47232d2e719aa51d655b744c99cfcd430a77c2;p=cl-gtk2.git diff --git a/gdk/gdk.drawing-primitives.lisp b/gdk/gdk.drawing-primitives.lisp index 03e7324..b1b6db6 100644 --- a/gdk/gdk.drawing-primitives.lisp +++ b/gdk/gdk.drawing-primitives.lisp @@ -28,18 +28,8 @@ (n :int)) (defun draw-points (drawable gc points) - (let ((n (length points))) - (with-foreign-object (points-ptr 'point-cstruct n) - (let ((i 0)) - (map nil - (lambda (pt) - (gobject::copy-slots-to-native - pt - (inc-pointer points-ptr (* i (foreign-type-size 'point-cstruct))) - (gobject::g-boxed-cstruct-wrapper-info-cstruct-description (gobject::get-g-boxed-foreign-info 'point))) - (incf i)) - points)) - (gdk-draw-points drawable gc points-ptr n)))) + (with-foreign-boxed-array (n points-ptr point points) + (gdk-draw-points drawable gc points-ptr n))) (export 'draw-points) @@ -60,18 +50,8 @@ (n :int)) (defun draw-lines (drawable gc points) - (let ((n (length points))) - (with-foreign-object (points-ptr 'point-cstruct n) - (let ((i 0)) - (map nil - (lambda (pt) - (gobject::copy-slots-to-native - pt - (inc-pointer points-ptr (* i (foreign-type-size 'point-cstruct))) - (gobject::g-boxed-cstruct-wrapper-info-cstruct-description (gobject::get-g-boxed-foreign-info 'point))) - (incf i)) - points)) - (gdk-draw-lines drawable gc points-ptr n)))) + (with-foreign-boxed-array (n points-ptr point points) + (gdk-draw-lines drawable gc points-ptr n))) (export 'draw-lines) @@ -98,18 +78,8 @@ (n-segments :int)) (defun draw-segments (drawable gc segments) - (let ((n (length segments))) - (with-foreign-object (segments-ptr 'segment-cstruct n) - (let ((i 0)) - (map nil - (lambda (segment) - (gobject::copy-slots-to-native - segment - (inc-pointer segments-ptr (* i (foreign-type-size 'segment-cstruct))) - (gobject::g-boxed-cstruct-wrapper-info-cstruct-description (gobject::get-g-boxed-foreign-info 'segment))) - (incf i)) - segments)) - (gdk-draw-segments drawable gc segments-ptr n)))) + (with-foreign-boxed-array (n segments-ptr segment segments) + (gdk-draw-segments drawable gc segments-ptr n))) (export 'draw-segments) @@ -122,6 +92,8 @@ (width :int) (height :int)) +(export 'draw-rectangle) + (defcfun (draw-arc "gdk_draw_arc") :void (drawable (g-object drawable)) (gc (g-object graphics-context)) @@ -143,18 +115,8 @@ (n-points :int)) (defun draw-polygon (drawable gc filled points) - (let ((n (length points))) - (with-foreign-object (points-ptr 'point-cstruct n) - (let ((i 0)) - (map nil - (lambda (point) - (gobject::copy-slots-to-native - point - (inc-pointer points-ptr (* i (foreign-type-size 'point-cstruct))) - (gobject::g-boxed-cstruct-wrapper-info-cstruct-description (gobject::get-g-boxed-foreign-info 'point))) - (incf i)) - points)) - (gdk-draw-polygon drawable gc filled points-ptr n)))) + (with-foreign-boxed-array (n points-ptr point points) + (gdk-draw-polygon drawable gc filled points-ptr n))) (export 'draw-polygon) @@ -165,47 +127,50 @@ (n :int)) (defun draw-trapezoids (drawable gc trapezoids) - (let ((n (length trapezoids))) - (with-foreign-object (trapezoids-ptr 'trapezoid-cstruct n) - (let ((i 0)) - (map nil - (lambda (trapezoid) - (gobject::copy-slots-to-native - trapezoid - (inc-pointer trapezoids-ptr (* i (foreign-type-size 'trapezoid-cstruct))) - (gobject::g-boxed-cstruct-wrapper-info-cstruct-description (gobject::get-g-boxed-foreign-info 'trapezoid))) - (incf i)) - trapezoids)) - (gdk-draw-trapezoids drawable gc trapezoids-ptr n)))) + (with-foreign-boxed-array (n trapezoids-ptr trapezoid trapezoids) + (gdk-draw-trapezoids drawable gc trapezoids-ptr n))) (export 'draw-trapezoids) -;; TODO -;; void gdk_draw_glyphs (GdkDrawable *drawable, -;; GdkGC *gc, -;; PangoFont *font, -;; gint x, -;; gint y, -;; PangoGlyphString *glyphs); -;; void gdk_draw_glyphs_transformed (GdkDrawable *drawable, -;; GdkGC *gc, -;; const PangoMatrix *matrix, -;; PangoFont *font, -;; gint x, -;; gint y, -;; PangoGlyphString *glyphs); -;; void gdk_draw_layout_line (GdkDrawable *drawable, -;; GdkGC *gc, -;; gint x, -;; gint y, -;; PangoLayoutLine *line); -;; void gdk_draw_layout_line_with_colors (GdkDrawable *drawable, -;; GdkGC *gc, -;; gint x, -;; gint y, -;; PangoLayoutLine *line, -;; const GdkColor *foreground, -;; const GdkColor *background); +(defcfun (draw-glyphs "gdk_draw_glyphs") :void + (drawable (g-object drawable)) + (gc (g-object graphics-context)) + (font (g-object pango-font)) + (x :int) + (y :int) + (glyphs (g-boxed-foreign pango-glyph-string))) + +(export 'draw-glyphs) + +(defcfun (draw-glyphs-transformed "gdk_draw_glyphs_transformed") :void + (drawable (g-object drawable)) + (gc (g-object graphics-context)) + (matrix (g-boxed-foreign pango-matrix)) + (font (g-object pango-font)) + (x :int) + (y :int)) + +(export 'draw-glyphs-transformed) + +(defcfun (draw-layout-line "gdk_draw_layout_line") :void + (drawable (g-object drawable)) + (gc (g-object graphics-context)) + (x :int) + (y :int) + (line (g-boxed-foreign pango-layout-line))) + +(export 'draw-layout-line) + +(defcfun (draw-layout-line-with-colors "gdk_draw_layout_line_with_colors") :void + (drawable (g-object drawable)) + (gc (g-object graphics-context)) + (x :int) + (y :int) + (line (g-boxed-foreign pango-layout-line)) + (foreground (g-boxed-foreign color)) + (background (g-boxed-foreign color))) + +(export 'draw-layout-line-with-colors) (defcfun (draw-layout "gdk_draw_layout") :void (drawable (g-object drawable))