Hi,

For some time now, my game has not worked with color-key at a point
(the :key-color-at parameter seems to be ignored). After a little
investigation, I believe this may be because of
sdl-image:load-and-convert-image (or rather, sdl:convert-image). I
don't know the code that well, but it looks like
sdl-image:load-and-convert-image calls sdl:convert-image with all of
its keyword parameters, expecting convert-image to deal with
:key-color and :key-color-at parameters. Unfortunately, I don't think
convert-image deals with :key-color-at, resulting in an image with no
color-key set.

I wrote up a little code to demonstrate this, but there is one catch:
for whatever reason I can't seem to make it fail on the example images
included with sdl-image. So in addition to the code, I have attached
the image which is giving me trouble so you can play with it and see
what you think.

(asdf:oos 'asdf:load-op :lispbuilder-sdl-image)

(defun main ()
  (sdl:with-init (sdl:sdl-init-video)
  (sdl:window 540 500)
  (let ((image-with-color-key
         (sdl-image:load-image "zelda.gif"
           :key-color (sdl:color :r 72 :g 152 :b 72)))
        (image-with-color-key-at
         (sdl-image:load-image "zelda.gif"
          :key-color-at (sdl:point :x 0 :y 0)))
        (image-converted-with-color-key
         (sdl-image:load-and-convert-image "zelda.gif"
           :key-color (sdl:color :r 72 :g 152 :b 72)))
        ; here is where the :key-color-at parameter seems to be ignored
        (image-converted-with-color-key-at
         (sdl-image:load-and-convert-image "zelda.gif"
          :key-color-at (sdl:point :x 0 :y 0))))
    (sdl:with-events ()
      (:quit-event () t)
      (:idle ()
             (sdl:fill-surface sdl:*black*)
             (sdl:draw-surface-at-* image-with-color-key 0 0)
             (sdl:draw-surface-at-* image-with-color-key-at 270 0)
             (sdl:draw-surface-at-* image-converted-with-color-key 0 250)
             (sdl:draw-surface-at-* image-converted-with-color-key-at 270 250)
             (sdl:update-display))))))

-- 
Elliott Slaughter

"Any road followed precisely to its end leads precisely nowhere." -
Frank Herbert

<<attachment: zelda.gif>>

_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to