Created
December 31, 2009 18:38
-
-
Save joelreymont/266841 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun cocoa-build-sprite (sprite image mask size) | |
(declare #.*optimize* | |
(type fixnum size)) | |
(let ((sp (fli:copy-pointer sprite)) | |
(ip (fli:copy-pointer image)) | |
(mp (fli:copy-pointer mask))) | |
(loop for i fixnum from 0 below size do | |
;; copy red | |
(setf (fli:dereference sp) | |
(the fixnum (fli:dereference ip))) | |
(fli:incf-pointer sp) | |
(fli:incf-pointer ip) | |
;; copy green | |
(setf (fli:dereference sp) | |
(the fixnum (fli:dereference ip))) | |
(fli:incf-pointer sp) | |
(fli:incf-pointer ip) | |
;; copy blue | |
(setf (fli:dereference sp) | |
(the fixnum (fli:dereference ip))) | |
(fli:incf-pointer sp) | |
(fli:incf-pointer ip) | |
;; our mask image is a 3 component JPEG | |
(setf (fli:dereference sp) | |
(the fixnum (fli:dereference mp))) | |
(fli:incf-pointer sp) | |
(fli:incf-pointer mp) | |
(fli:incf-pointer mp) | |
(fli:incf-pointer mp)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment