[cl-gd-devel] Re: Drawing anti-aliased text with transparent background
Andrei Stebakov
lispercat at gmail.com
Sat Mar 17 13:55:26 UTC 2007
I tred to use the (make-anti-aliased) function:
(draw-freetype-string 0 0
text
:anti-aliased t
:font-name font
:angle 0
:point-size font-size
:color (make-anti-aliased (allocate-color 0 0 255)))
But the lisp gives me the error:
The value of CL-GD::COLOR is #S(CL-GD::ANTI-ALIASED-COLOR
:COLOR 255
:DO-NOT-BLEND NIL), which is not of type
INTEGER.
[Condition of type SIMPLE-TYPE-ERROR]
Restarts:
0: [STORE-VALUE] Supply a new value of CL-GD::COLOR.
1: [ABORT] Return to SLIME's top level.
2: [ABORT] Return to Top-Level.
Backtrace:
0: (LISP::CHECK-TYPE-ERROR CL-GD::COLOR
#S(CL-GD::ANTI-ALIASED-COLOR
:COLOR 255
:DO-NOT-BLEND NIL)
INTEGER
NIL)
Thank you,
Andrew
On 3/17/07, Andrei Stebakov <lispercat at gmail.com> wrote:
>
> Here is what I've got:
> http://www.greenpixeldesign.com/cphandler/tmp-img/test.png
> I'd like to remove the black outline from the anti-aliased text (I need
> RGB true color image). I know I am missing some stupid thing, but I
> experimented with different backgrounds, just doesn't make it right. My
> current setup is gdlib 2.0.33 on debian, and here is the code;
>
> (defun create-text-image (text font font-size file-name)
> (multiple-value-bind (width height horizont-shift vertical-shift)
> (get-bounding-rect text font font-size)
> (with-image* (width height t)
> (let* ((white (allocate-color 255 255 255))
> (black (allocate-color 0 0 0))
> (red (allocate-color 255 0 0))
> (green (allocate-color 0 255 0))
> (blue (allocate-color 0 0 255)))
> (setf (transparent-color) black)
> (draw-freetype-string (- 0 horizont-shift) (- height vertical-shift)
> text
> :anti-aliased t
> :font-name font
> :angle 0
> :point-size font-size
> :color (allocate-color 0 0 255))
>
> ;;(true-color-to-palette)
> (write-image-to-file file-name :if-exists :supersede)))))
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-gd-devel/attachments/20070317/11eed1ee/attachment.html>
More information about the Cl-gd-devel
mailing list