[cl-gd-devel] Re: question about cl-gd

Edi Weitz edi at agharta.de
Sun Aug 22 11:55:03 UTC 2004


Hi!

On Fri, 20 Aug 2004 19:00:42 +0200, Lam <lam at no-log.org> wrote:

> i try to use your great software cl-gd
> i have a question about size of image
>
> i use your example :
>
>> (defun test ()
>> (cl-gd:with-image* (800 800) ; create 200x200 pixel image
>>   (cl-gd:allocate-color 68 70 85) ; background color
>>   (let ((beige (cl-gd:allocate-color 222 200 81))
>>         (brown (cl-gd:allocate-color 206 150 75))
>>         (green (cl-gd:allocate-color 104 156 84))
>>         (red (cl-gd:allocate-color 163 83 84))
>>         (white (cl-gd:allocate-color 255 255 255))
>>         (two-pi (* 2 pi)))
>>     ;; move origin to center of image
>>     (cl-gd:with-transformation  (:x1 -100  :x2  100 :y1  -100 :y2  100
>>     :radians t)
>>       ;; draw some 'pie slices'
>>       (cl-gd:draw-arc 0 0 130 130 0 (* .6 two-pi)
>>                 :center-connect t :filled t :color beige)
>>       (cl-gd:draw-arc 0 0 130 130 (* .6 two-pi) (* .8 two-pi)
>>                 :center-connect t :filled t :color brown)
>>       (cl-gd:draw-arc 0 0 130 130 (* .8 two-pi) (* .95 two-pi)
>>                 :center-connect t :filled t :color green)
>>       (cl-gd:draw-arc 0 0 130 130 (* .95 two-pi) two-pi
>>                 :center-connect t :filled t :color red)
>>       (cl-gd:with-default-color (white)
>>         (cl-gd:with-default-font (:small)
>>           (cl-gd:draw-string -8 -30 "60%")
>>           (cl-gd:draw-string -20 40 "20%")
>>           (cl-gd:draw-string 20 30 "15%"))
>> ;;         (cl-gd:draw-freetype-string -90 75 "Global Revenue"
>> ;;                               ;; this          assumes         that
>> 'DEFAULT_FONTPATH'
>> ;;                               ;; is set correctly
>> ;;                               :font-name "verdanab"))))
>>         )))
>>   (cl-gd:write-image-to-file "/tmp/test.png"
>>                              :compression-level      6      :if-exists
>>                              :supersede)))
>
> i have modifed window's size to 800
> it's ok for the image, but why arc's size is larger than is your
> example with size equal to 200 ?

Because of the WITH-TRANSFORMATION macro.

  <http://weitz.de/cl-gd/#with-transformation>

> how can i modify only image's size, not arc size ?

Sure, but then you'd have to change the code to use absolute
coordinates.

> sorry to send your this mail, but this mail isn't my current mail,
> and i have not subscribed to the ml with this mail

It'd be nice if you could send further questions to the mailing
list. Thanks.

Cheers,
Edi.




More information about the Cl-gd-devel mailing list