Changeset 29416 in project


Ignore:
Timestamp:
07/26/13 15:38:19 (6 years ago)
Author:
Moritz Heidkamp
Message:

imlib2: Add image-create-using-copied-data and expose some more procedures for working with raw image pointers (thanks to Andrei Barbu for the patch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/imlib2/trunk/imlib2.scm

    r28157 r29416  
    4040   image? image-format-set! image-format image-width image-height
    4141   image-filename image-get-data-for-reading-only image-alpha? image-alpha-set!
    42    image-track-changes-on-disk
     42   image-track-changes-on-disk image-create-using-copied-data
    4343   image-flip-horizontal image-flip-horizontal! image-flip-vertical
    4444   image-flip-vertical! image-flip-diagonal image-flip-diagonal!
     
    5252   image-draw-pixel image-draw-line image-draw-rectangle image-draw-text
    5353   image-fill-rectangle
    54    font-load make-image)
     54   font-load make-image image-ptr gc-collect-image)
    5555
    5656(import chicken scheme foreign)
     
    143143           (image (load-image filename (location err))))
    144144      (if (= err IMLIB_LOAD_ERROR_NONE)
    145           (set-finalizer! (make-image image) gc-collect)
     145          (set-finalizer! (make-image image) gc-collect-image)
    146146          (abort
    147147            (make-composite-condition
     
    181181              (image-alpha-set! img #t)
    182182              (image-fill-rectangle img (color/rgba 0 0 0 0) 0 0 width height)
    183               (set-finalizer! img gc-collect))))))
    184 
    185 (define (gc-collect img)
     183              (set-finalizer! img gc-collect-image))))))
     184
     185(define (gc-collect-image img)
    186186  (when (image-ptr img)
    187187        (let ((old (imlib-context-get-image)))
     
    308308    ((foreign-lambda image imlib_create_cropped_image int int int int)
    309309     x y width height))
    310    gc-collect))
     310   gc-collect-image))
    311311
    312312(define/img (image-crop&scale img src-x src-y src-width src-height dest-width dest-height)
     
    316316                     int int int)
    317317     src-x src-y src-width src-height dest-width dest-height))
    318    gc-collect))
     318   gc-collect-image))
    319319
    320320(define/img (image-scale img width height)
     
    322322
    323323(define (image-clone img)
    324   (set-finalizer! (make-image (imlib-clone-image img)) gc-collect))
     324  (set-finalizer! (make-image (imlib-clone-image img)) gc-collect-image))
     325
     326(define (image-create-using-copied-data width height ptr)
     327  (set-finalizer! (make-image
     328                   ((foreign-lambda image imlib_create_image_using_copied_data int int c-pointer)
     329                    width height ptr))
     330                  gc-collect-image))
    325331
    326332(define/img (imlib-clone-image img)
Note: See TracChangeset for help on using the changeset viewer.