Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blend modes #153

Closed
kensanata opened this issue Jul 10, 2022 · 1 comment
Closed

Blend modes #153

kensanata opened this issue Jul 10, 2022 · 1 comment

Comments

@kensanata
Copy link

When using set-render-draw-blend-mode I need to specify a blend mode. In my own code, I've used the following:

(defconstant blendmode-none sdl2-ffi:+sdl-blendmode-none+
  "No blending.")
(defconstant blendmode-blend sdl2-ffi:+sdl-blendmode-blend+
  "Alpha blending.")
(defconstant blendmode-add sdl2-ffi:+sdl-blendmode-add+
  "Additive blending.")
(defconstant blendmode-mod sdl2-ffi:+sdl-blendmode-mod+
  "Color modulate.")

Well, actually I just used blendmode-blend. That one at least works:

  (sdl2:with-rects
      ((r (- (* *dimension* *scale* (pos-x *pen*))
	     (floor *scale* 2))
	  (- (* *dimension* *scale* (pos-y *pen*))
	     (floor *scale* 2))
	  (+ (* *dimension* *scale*)
	     *scale*)
	  (+ (* *dimension* *scale*)
	     *scale*)))
    ;; 20% transparent forestgreen
    (sdl2:set-render-draw-blend-mode renderer blendmode-blend)
    (sdl2:set-render-draw-color renderer #x22 #x8B #x22 #x33)
    (sdl2:render-fill-rect renderer r))

I'm not sure whether these belong to render.lisp, or constants.lisp. We would probably want to mention these in the docstrings of blendmode-blend, and possibly set-texture-blend-mode.

@fitzsim
Copy link
Contributor

fitzsim commented Aug 24, 2024

Isn't what you have done in your own code sufficient? If I am missing something, then please submit a pull request (or re-open this and paste a patch here) showing what you would like changed.

@fitzsim fitzsim closed this as completed Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants