edicl / cl-gd Goto Github PK
View Code? Open in Web Editor NEWUFFI bindings to the GD graphics library
Home Page: https://edicl.github.io/cl-gd/
UFFI bindings to the GD graphics library
Home Page: https://edicl.github.io/cl-gd/
Complete documentation for CL-GD can be found in the 'doc' directory. CL-GD also supports Nikodemus Siivola's HYPERDOC, see <http://common-lisp.net/project/hyperdoc/> and <http://www.cliki.net/hyperdoc>. 1. Installation (see doc/index.html for Windows instructions) 1.1. Download and install a recent version of GD and its supporting libraries. Please use your operating system's package manager to install the "development" version of the GD library. On Ubuntu Linux, this can be achieved with the command: apt-get install libgd2-xpm-dev GD depends on several other libraries to handle different graphics formats. These should be installed by your package manager automatically. If you cannot use or do not have a package manager that includes GD, you'll have to follow the GD installation instructions (http://www.boutell.com/gd/). Note that you won't be able to compile CL-GD unless you have installed all supporting libraries. This is different from using GD directly from C where you only have to install the libraries you intend to use. 1.2. Install cl-gd and its Lisp dependencies using quicklisp (http://quicklisp.org/). 1.3. Compile cl-gd-glue.c into a shared library for your platform. A simple Makefile is included in the cl-gd source directory. For FreeBSD and Linux, just type make For OSX, type make cl-gd-glue.dylib 2. Test CL-GD comes with a simple test suite that can be used to check if it's basically working. Note that this'll only test a subset of CL-GD. To run the tests load CL-GD and then (asdf:oos 'asdf:load-op :cl-gd-test) (cl-gd-test:test) If you have the georgiab.ttf TrueType font from Microsoft you can also check the FreeType support of CL-GD with (cl-gd-test:test #p"/usr/X11R6/lib/X11/fonts/truetype/georgiab.ttf") where you should obviously replace the path above with the full path to the font on your machine. (See the note about failed tests in the documentation.)
I've used this library very successfully for many years under Linux.
Now, I am trying to move my program to FreeBSD, and when I attempt to compile cl-gd-glue.so
, I receive the following error messages:
`make
cc -I/usr/local/include -fPIC -c cl-gd-glue.c
ld -shared -lgd -lz -lpng -ljpeg -lfreetype -lm -lc cl-gd-glue.o -o cl-gd-glue.so -L/usr/local/lib
ld: error: unable to find library -lz
ld: error: unable to find library -lm
ld: error: unable to find library -lc
*** Error code 1
Stop.
make: stopped in /usr/home/wgl/quicklisp/dists/quicklisp/software/cl-gd-20201220-git
`
It sounds like there are some support libraries missing?
With libgd installed from homebrew.
I'm pretty sure this output will help:
CL-USER> (uffi:load-foreign-library #p"/usr/lib/libgd.3.dylib")
STYLE-WARNING: Undefined alien: "gdImageCreateFromJpegFile"
STYLE-WARNING: Undefined alien: "gdImageCreateFromPngFile"
STYLE-WARNING: Undefined alien: "gdImageCreateFromGdFile"
STYLE-WARNING: Undefined alien: "gdImageCreateFromGd2File"
STYLE-WARNING: Undefined alien: "gdImageCreateFromGd2PartFile"
STYLE-WARNING: Undefined alien: "gdImageCreateFromXbmFile"
STYLE-WARNING: Undefined alien: "gdImageCreateFromGifFile"
STYLE-WARNING: Undefined alien: "gdImageGetGetTransparent"
STYLE-WARNING: Undefined alien: "gdImageGetRed"
STYLE-WARNING: Undefined alien: "gdImageGetGreen"
STYLE-WARNING: Undefined alien: "gdImageGetBlue"
STYLE-WARNING: Undefined alien: "gdImageGetAlpha"
STYLE-WARNING: Undefined alien: "gdImageGetColorsTotal"
STYLE-WARNING: Undefined alien: "gdImageGetSX"
STYLE-WARNING: Undefined alien: "gdImageGetSY"
STYLE-WARNING: Undefined alien: "gdImageGetGetInterlaced"
STYLE-WARNING: Undefined alien: "gdImageGifAnimBeginWrap"
STYLE-WARNING: Undefined alien: "gdImageGifAnimEndWrap"
STYLE-WARNING: Undefined alien: "_gdImageCreate"
T
Would you please consider adding a :description option to your system definition of cl-gd?
Hi,
Following the instructions, I've installed cl-gd via Quicklisp and then attempted to compile cl-gd-glue.c using make (I'm using Ubuntu 17.04). However I receive the error:
gcc -I/usr/local/include -fPIC -c cl-gd-glue.c
cl-gd-glue.c:29:16: fatal error: gd.h: No such file or directory
#include "gd.h"
compilation terminated.
Makefile:4: recipe for target 'cl-gd-glue.so' failed
make: *** [cl-gd-glue.so] Error 1
and the header file is missing from the directory.
David
Hello!
Manjaro Linux, gd package is installed.
I had this error:
Test 1 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 2 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 3 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 4 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 5 failed with the following error: File #P"/home/iam/quicklisp/local-projects/cl-gd/test/one-pixel.png" could not be found
Test 6 failed with the following error: File #P"/home/iam/quicklisp/local-projects/cl-gd/test/one-pixel.png" could not be found
Test 7 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 8 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 9 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 10 failed with the following error: The alien function "gdImageCreateFromJpegFile" is undefined.
Test 11 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 12 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 13 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 14 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 15 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 16 failed with the following error: The alien function "gdImageCreateTrueColor" is undefined.
Test 17 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 18 failed with the following error: The alien function "gdImageCreate" is undefined.
Test 19 failed with the following error: The alien function "gdImageCreateTrueColor" is undefined.
How I can fix this error on my computer?
Thanks!
This error message showing up in several projects I maintain which employ cl-gd:
;; STYLE-WARNING:
;; bare references to struct types are deprecated. Please use (:POINTER (:STRUCT CL-GD::GD-IMAGE))
;; or (:STRUCT CL-GD::GD-IMAGE) instead.
I've put together a simple case which exhibits the behavior. It seems to be the WITH-THICKNESS macro causing the warning in this case:
(ql:quickload "cl-gd")
(use-package :cl-gd)
(let* ((x1 -86)
(x2 529)
(y1 -0.13)
(y2 1.16)
(xv '(0.0 1.0 2.0 3.0 4.0))
(yv '(0.99 0.12 0.66 0.24 0.075)))
(with-image* (500 250)
(allocate-color 255 255 255)
(let ((c (allocate-color 0 0 255)))
(with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2)
(with-thickness (1)
(mapl #'(lambda (x y)
(when (and (cdr x) (cdr y))
(draw-line (car x) (car y) (cadr x) (cadr y) :color c))) xv yv))
(write-image-to-file "test.png" :if-exists :supersede)))))
If you take out the with-thickness macro call the message disappears.
I posted this to both the cl-gd-devel and cffi-devel lists. Liam Healy from the latter sent this response:
"It's harmless, it's just telling you that the syntax that cl-gd uses for structure arguments will eventually (in a future version of CFFI) not work. The messages describes the problem. The structure is specified as cl-gd::gd-image in a function argument or return value. In the old versions of CFFI, that was interpreted as a pointer to that structure, because there was no other possibility. Now structures can also be passed/returned by value using cffi-libffi, so you have to say explicitly as the error message indicates. They might also need to change the use of #'mem-aref (which before returned a pointer to the structure but now returns the structure itself) into a #'mem-aptr."
Much obliged.
--Jeff Cunningham
https://www.dropbox.com/sh/asj7pcksp72un8t/iIXtyT4HjO
to use add to slime-setup modules list, to return picture (values
'whatever (make-instance 'swank::picture :url "/tmp/whatever.png")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.