rpav / cl-cairo2

Cairo bindings for Common Lisp

Home Page:https://github.com/rpav/cl-cairo2/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image-surface-get-data unknown format error

jbromley opened this issue · comments

The image-surface-get-data function is returning the error "unknown format" for :argb32, :rgb24, and :a8 formats. A REPL session sample follows:

CAIRO> (defvar img-surface (create-image-surface :argb32 64 64))
IMG-SURFACE
CAIRO> (image-surface-get-format img-surface)
:ARGB32
CAIRO> (image-surface-get-data img-surface)

unknown format: ARGB32
[Condition of type SIMPLE-ERROR]

Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] Exit debugger, returning to top level.

Backtrace:
0: (GET-BYTES-PER-PIXEL :ARGB32)
1: (IMAGE-SURFACE-GET-DATA #<SURFACE {10032470C1}> :POINTER-ONLY NIL)
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (IMAGE-SURFACE-GET-DATA IMG-SURFACE) #)

It appears the culprit is that the case in get-bytes-per-pixels uses the following symbols: format-argb32, format-rgb24, and format-a8, which do not appear anywhere else in the code. Replacing these symbols with the normal :argb32, :rgb24, :a8 symbols fixes the problem. I will submit a pull request.

Must have been patched. :)