Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Import to git
Browse files Browse the repository at this point in the history
  • Loading branch information
drahosp committed Oct 1, 2010
0 parents commit d8272f1
Show file tree
Hide file tree
Showing 51 changed files with 6,526 additions and 0 deletions.
27 changes: 27 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,27 @@
# Copyright (C) 2007-2009 LuaDist.
# Submitted by David Manura
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.

PROJECT(luagd C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
INCLUDE(dist.cmake)

#~2DO autoconf
ADD_DEFINITIONS(-DGD_JPEG -DGD_PNG)
#~2DO FIX: -DGD_GIF -DGD_FONTCONFIG -DGD_XPM -DGD_FREETYPE

# Find gd
FIND_LIBRARY ( GD_LIBRARY NAMES gd bgd)

# Build
ADD_LUA_MODULE(gd luagd.c luagd.def)
TARGET_LINK_LIBRARIES(gd ${GD_LIBRARY})

# Install all files and documentation
INSTALL (TARGETS gd DESTINATION ${INSTALL_CMOD})
INSTALL (FILES README COPYING DESTINATION ${INSTALL_DATA})
INSTALL (DIRECTORY demos/ DESTINATION ${INSTALL_EXAMPLE})
INSTALL (DIRECTORY doc/ DESTINATION ${INSTALL_DOC})

23 changes: 23 additions & 0 deletions COPYING
@@ -0,0 +1,23 @@
Lua-GD (c) 2004-2006 Alexandre Erwin Ittner

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you use this package in a product, an acknowledgment in the product
documentation would be greatly appreciated (but it is not required).
77 changes: 77 additions & 0 deletions Makefile
@@ -0,0 +1,77 @@
# luagd -- gd bindings for the Lua Programming Language.
# (c) 2004-06 Alexandre Erwin Ittner <aittner@netuno.com.br>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# If you use this package in a product, an acknowledgment in the product
# documentation would be greatly appreciated (but it is not required).
#

CC=gcc

# ---------------------------------------------------------------------------
# Automatic configuration using pkgconfig, gd-config and sed. These
# lines should work on most Linux/Unix systems. If your system does not
# have these programs you must comment out these lines and uncomment and
# change the next ones.

# Name of .pc file. "lua5.1" on Debian/Ubuntu
LUAPKG=lua5.1
OUTFILE=gd.so
CFLAGS=`gdlib-config --cflags` `pkg-config $(LUAPKG) --cflags` -O3 -Wall
GDFEATURES=`gdlib-config --features |sed -e "s/GD_/-DGD_/g"`
LFLAGS=-shared `gdlib-config --ldflags` `gdlib-config --libs` \
`pkg-config $(LUAPKG) --libs` -lgd
INSTALL_PATH=`pkg-config $(LUAPKG) --variable=INSTALL_CMOD`


# ---------------------------------------------------------------------------
# Manual configuration for systems without pkgconfig.

#OUTFILE=gd.so
#CFLAGS=-Wall `gdlib-config --cflags` -I/usr/include/lua5.1 -O3
#GDFEATURES=`gdlib-config --features |sed -e "s/GD_/-DGD_/g"`
#LFLAGS=-shared `gdlib-config --ldflags` `gdlib-config --libs` -llua51 -lgd
#INSTALL_PATH=/usr/lib/lua/


# ---------------------------------------------------------------------------
# Manual configuration for Windows and systems without sed, pkgconfig, etc.
# Uncomment, change and good luck :)

#OUTFILE=gd.dll
#CFLAGS=-Wall -IC:/lua5.1/ -O3
#GDFEATURES=-DGD_XPM -DGD_JPEG -DGD_FONTCONFIG -DGD_FREETYPE -DGD_PNG -DGD_GIF
#LFLAGS=-shared -lgd2 -lm -llua51
#INSTALL_PATH="C:/Program Files/lua/"
# ---------------------------------------------------------------------------


all: $(OUTFILE)

$(OUTFILE): luagd.c
$(CC) -o $(OUTFILE) $(GDFEATURES) $(CFLAGS) $(LFLAGS) luagd.c
lua test_features.lua

install: $(OUTFILE)
install -s $(OUTFILE) $(INSTALL_PATH)

clean:
rm -f $(OUTFILE) *.o
60 changes: 60 additions & 0 deletions README
@@ -0,0 +1,60 @@
Lua-GD, the gd bindings for the Lua Programming Language
(c) 2004-06 Alexandre Erwin Ittner <aittner@netuno.com.br>


+ Introduction

"gd" is a C graphics library created by Thomas Boutell that allows your
code to quickly draw complete images with lines, polygons, arcs, text,
multiple colors, cut and paste from other images, flood fills, read in
or write out images in the PNG, JPEG or GIF format. This is particularly
useful in World Wide Web applications, where PNG and JPEG are two of the
formats accepted for inline images by most browsers. gd does not provide
for every possible desirable graphics operation. It is not necessary or
desirable for gd to become a kitchen-sink graphics package, but it does
include most frequently requested features, including both truecolor
and palette images, resampling (smooth resizing of truecolor images)
and so forth. You can get more information about gd from it's homepage.

Lua-GD is a "binding": a library that exports gd functions to the Lua
Programming Language, allowing you to use gd from Lua. The API was
NOT literally exported, but changed in a way that make it familiar to
Lua users.

Lua-GD is a programming library, not a paint program. If you are looking
for that or are not familiar to the Lua Programming Language, you are
in the wrong place.


+ Documentation

See doc/index.html for installation instructions and API documentation.


+ License

Lua-GD is copyrighted free software, distributed under the MIT license
(the same used by Lua 5.1) and it can be used at no cost for both academic
and commercial purpouses. Or, more precisely:

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you use this package in a product, an acknowledgment in the product
documentation would be greatly appreciated (but it is not required).
6 changes: 6 additions & 0 deletions debian/changelog
@@ -0,0 +1,6 @@
lua-gd (2.0.33r2-1) unstable; urgency=low

* Initial release Closes: #nnnn (nnnn is the bug number of your ITP)

-- Alexandre Erwin Ittner <aittner@netuno.com.br> Wed, 3 May 2006 00:46:09 -0300

14 changes: 14 additions & 0 deletions debian/control
@@ -0,0 +1,14 @@
Source: lua-gd
Priority: optional
Maintainer: Alexandre Erwin Ittner <aittner@netuno.com.br>
Build-Depends: debhelper (>= 4.0.0), liblua5.1-dev
Standards-Version: 3.6.1
Section: interpreters

Package: lua-gd
Architecture: any
Depends: ${shlibs:Depends}
Recommends: lua5.1
Description: GD bindings for the Lua Programming Language
Lua-GD is a library that allows you to use the gd graphic library from
programs written in the Lua programming language.
23 changes: 23 additions & 0 deletions debian/copyright
@@ -0,0 +1,23 @@
Lua-GD (c) 2004-2006 Alexandre Erwin Ittner

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you use this package in a product, an acknowledgment in the product
documentation would be greatly appreciated (but it is not required).
83 changes: 83 additions & 0 deletions debian/rules
@@ -0,0 +1,83 @@
#!/usr/bin/make -f
# -*- makefile -*-

## This is my first Debian package. Please, be patient ;)


# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=3

LUAPKG=lua5.1
INSTALL_PATH=`pkg-config $(LUAPKG) --variable=INSTALL_CMOD`

CFLAGS = -Wall -g

build: build-stamp
build-stamp:
dh_testdir

# Well, this does it all.
$(MAKE)

touch build-stamp

clean:
dh_testdir
dh_testroot
rm -f gd.so
rm -f build-stamp configure-stamp

# Toplevel clean does it all
-$(MAKE) clean

dh_clean

install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs

mkdir -p debian/lua-gd/usr/share/doc/lua-gd
mkdir -p debian/lua-gd/usr/share/doc/lua-gd/demos/
mkdir -p debian/lua-gd/$(INSTALL_PATH)

cp gd.so debian/lua-gd/$(INSTALL_PATH)
cp README COPYING doc/* debian/lua-gd/usr/share/doc/lua-gd/
cp demos/* debian/lua-gd/usr/share/doc/lua-gd/demos/

# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
# dh_installdebconf -a
dh_installdocs -a
# dh_installexamples -a
# dh_installmenu -a
# dh_installlogrotate -a
# dh_installemacsen -a
# dh_installpam -a
# dh_installmime -a
# dh_installinit -a
# dh_installcron -a
# dh_installman -a
# dh_installinfo -a
# dh_undocumented -a
dh_installchangelogs -a
dh_strip -a
dh_link -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a -V
dh_installdeb -a
# dh_perl -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a

binary: binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
Binary file added demos/Vera.ttf
Binary file not shown.
18 changes: 18 additions & 0 deletions demos/brush.lua
@@ -0,0 +1,18 @@
require "gd"

im = gd.createTrueColor(400, 400)
assert(im)

black = im:colorAllocate(0, 0, 0)
white = im:colorAllocate(255, 255, 255)

brush = gd.createFromPng("paper.png")
im:setBrush(brush)
im:line(60, 60, 70, 70, gd.BRUSHED)
im:line(120, 120, 130, 130, gd.BRUSHED)
im:line(180, 180, 190, 190, gd.BRUSHED)
im:line(240, 240, 250, 250, gd.BRUSHED)
im:line(300, 300, 310, 310, gd.BRUSHED)

im:png("out.png")
os.execute("display out.png")
Binary file added demos/bugs.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions demos/circle.lua
@@ -0,0 +1,14 @@
#!/usr/bin/env lua

require "gd"

im = gd.createTrueColor(100, 100)

white = im:colorAllocate(255, 255, 255)
blue = im:colorAllocate(0, 0, 255)

im:filledRectangle(0, 0, 100, 100, white)
im:stringFTCircle(50, 50, 40, 10, 0.9, "./Vera.ttf", 24, "Powered", "by Lua", blue)

im:png("out.png")
os.execute("display out.png")

0 comments on commit d8272f1

Please sign in to comment.