Skip to content

Commit

Permalink
Expose blending and composite operation
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Jul 27, 2019
1 parent 4a609ab commit 683b555
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
22 changes: 22 additions & 0 deletions canvas/canvas.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,25 @@

(defun update-canvas-pixel-ratio (canvas pixel-ratio)
(bodge-canvas:update-canvas-pixel-ratio (%handle-of canvas) pixel-ratio))


(defmacro with-blend-factors ((source-factor destination-factor
&optional source-alpha-factor destination-alpha-factor)
&body body)
`(bodge-canvas::with-blend-factors (,source-factor ,destination-factor
:source-alpha-factor
,source-alpha-factor
:destination-alpha-factor
,destination-alpha-factor
:canvas (%handle-of *canvas*))
,@body))


(defmacro with-composite-operation ((operation) &body body)
`(bodge-canvas:with-composite-operation (,operation (%handle-of *canvas*))
,@body))


(defmacro with-alpha ((value) &body body)
`(bodge-canvas:with-alpha (,value (%handle-of *canvas*))
,@body))
1 change: 0 additions & 1 deletion canvas/drawing.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(cl:in-package :cl-bodge.canvas)



(defun draw-line (origin end paint &key (thickness 1.0))
(bodge-canvas:draw-line origin end (%paint-handle-of paint)
:thickness thickness))
Expand Down
6 changes: 5 additions & 1 deletion canvas/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@
#:register-font-face
#:canvas-font-metrics
#:canvas-text-bounds
#:canvas-text-advance))
#:canvas-text-advance

#:with-composite-operation
#:with-blend-factors
#:with-alpha))

0 comments on commit 683b555

Please sign in to comment.