rgd 0.4.1a-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/BSDL +22 -0
  2. data/COPYING +4 -0
  3. data/README +3 -0
  4. data/Rakefile +48 -0
  5. data/ext/rgd/extconf.rb +15 -0
  6. data/ext/rgd/gd_playground/bmp.h +114 -0
  7. data/ext/rgd/gd_playground/gd_bmp.c +1130 -0
  8. data/ext/rgd/gd_playground/gdhelpers.h +61 -0
  9. data/ext/rgd/rgd.c +2976 -0
  10. data/lib/rgd/1.8/rgd.so +0 -0
  11. data/lib/rgd/1.9/rgd.so +0 -0
  12. data/lib/rgd.rb +2 -0
  13. data/test/main.rb +22 -0
  14. data/test/mtest_stringft_cn.png +0 -0
  15. data/test/mtest_stringft_cn.rb +20 -0
  16. data/test/test_arc.png +0 -0
  17. data/test/test_arc.rb +10 -0
  18. data/test/test_color_closest.rb +32 -0
  19. data/test/test_color_exact.rb +37 -0
  20. data/test/test_color_resolve.rb +42 -0
  21. data/test/test_color_transparent.rb +16 -0
  22. data/test/test_copy.png +0 -0
  23. data/test/test_copy.rb +13 -0
  24. data/test/test_copy_rotated.png +0 -0
  25. data/test/test_copy_rotated.rb +14 -0
  26. data/test/test_fill_1.png +0 -0
  27. data/test/test_fill_1.rb +9 -0
  28. data/test/test_fill_2.png +0 -0
  29. data/test/test_fill_2.rb +30 -0
  30. data/test/test_fill_3.png +0 -0
  31. data/test/test_fill_3.rb +35 -0
  32. data/test/test_fill_4.png +0 -0
  33. data/test/test_fill_4.rb +25 -0
  34. data/test/test_fill_to_border.rb +14 -0
  35. data/test/test_filled_ellipse.png +0 -0
  36. data/test/test_filled_ellipse.rb +8 -0
  37. data/test/test_filled_rectangle.rb +46 -0
  38. data/test/test_line_1.png +0 -0
  39. data/test/test_line_1.rb +18 -0
  40. data/test/test_line_2.rb +18 -0
  41. data/test/test_line_3.rb +40 -0
  42. data/test/test_line_3_1.png +0 -0
  43. data/test/test_line_3_2.png +0 -0
  44. data/test/test_line_3_3.png +0 -0
  45. data/test/test_line_3_4.png +0 -0
  46. data/test/test_line_3_5.png +0 -0
  47. data/test/test_line_3_6.png +0 -0
  48. data/test/test_line_3_7.png +0 -0
  49. data/test/test_line_3_8.png +0 -0
  50. data/test/test_tiled.png +0 -0
  51. data/test/test_tiled.rb +15 -0
  52. metadata +117 -0
data/BSDL ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (C) 2010 oCameLo. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
14
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
17
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/COPYING ADDED
@@ -0,0 +1,4 @@
1
+ = RGD
2
+
3
+ RGD is copyrighted free software by oCameLo. You can redistribute it and/or
4
+ modify it under the terms of the 2-clause BSDL (see the file BSDL).
data/README ADDED
@@ -0,0 +1,3 @@
1
+ = RGD
2
+
3
+ libgd binding for Ruby
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ # coding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/clean'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/testtask'
9
+
10
+ spec = Gem::Specification.new do |s|
11
+ s.name = 'rgd'
12
+ s.version = '0.4.1a'
13
+ s.has_rdoc = true
14
+ s.extra_rdoc_files = ['README', 'COPYING']
15
+ s.summary = 'libgd binding for Ruby'
16
+ s.description = s.summary
17
+ s.author = 'oCameLo'
18
+ s.email = ''
19
+ s.homepage = 'http://otnth.blogspot.com'
20
+ # s.executables = ['your_executable_here']
21
+ s.files = %w(BSDL COPYING Rakefile README) + Dir.glob("{bin,ext,lib,test}/**/*")
22
+ s.require_path = "lib"
23
+ s.bindir = "bin"
24
+ if $WIN32 then
25
+ s.platform = Gem::Platform::CURRENT
26
+ else
27
+ s.extensions = 'ext/rgd/extconf.rb'
28
+ end
29
+ end
30
+
31
+ Rake::GemPackageTask.new(spec) do |pkg|
32
+ pkg.gem_spec = spec
33
+ pkg.need_tar = true
34
+ pkg.need_zip = true
35
+ end
36
+
37
+ Rake::RDocTask.new do |rdoc|
38
+ files =['README', 'COPYING', 'lib/**/*.rb'] + Dir.glob("ext/**/*.c")
39
+ rdoc.rdoc_files.add(files)
40
+ rdoc.main = "README" # page to start on
41
+ rdoc.title = "RGD Docs"
42
+ rdoc.rdoc_dir = 'doc' # rdoc output folder
43
+ rdoc.options << '--line-numbers'
44
+ end
45
+
46
+ Rake::TestTask.new do |t|
47
+ t.test_files = FileList['test/main.rb']
48
+ end
@@ -0,0 +1,15 @@
1
+ # coding: utf-8
2
+ require 'mkmf'
3
+
4
+ if Config::CONFIG['target_os'] =~ /mingw32/i || Config::CONFIG['target_os'] =~ /mswin32/i then
5
+ $CFLAGS << ' -DWIN32 '
6
+ $CFLAGS << ' -DBGDWIN32 ' if with_config('static')
7
+ end
8
+
9
+ abort 'libgd is missing.' unless have_library('gd')
10
+ have_func('gdImageCreateFromBmp', 'gd.h')
11
+ ['z', 'png', 'jpeg', 'Xpm', 'freetype', 'fontconfig'].each do |lib|
12
+ have_library(lib)
13
+ end
14
+
15
+ create_makefile("rgd/#{RUBY_VERSION.sub(/\.\d+$/, '')}/rgd")
@@ -0,0 +1,114 @@
1
+ /* $Id$ */
2
+ #ifdef __cplusplus
3
+ extern "C" {
4
+ #endif
5
+
6
+ /*
7
+ gd_bmp.c
8
+
9
+ Bitmap format support for libgd
10
+
11
+ * Written 2007, Scott MacVicar
12
+ ---------------------------------------------------------------------------
13
+
14
+ Todo:
15
+
16
+ RLE4, RLE8 and Bitfield encoding
17
+ Add full support for Windows v4 and Windows v5 header formats
18
+
19
+ ----------------------------------------------------------------------------
20
+ */
21
+
22
+ #ifndef BMP_H
23
+ #define BMP_H 1
24
+
25
+ #define BMP_PALETTE_3 1
26
+ #define BMP_PALETTE_4 2
27
+
28
+ #define BMP_WINDOWS_V3 40
29
+ #define BMP_OS2_V1 12
30
+ #define BMP_OS2_V2 64
31
+ #define BMP_WINDOWS_V4 108
32
+ #define BMP_WINDOWS_V5 124
33
+
34
+ #define BMP_BI_RGB 0
35
+ #define BMP_BI_RLE8 1
36
+ #define BMP_BI_RLE4 2
37
+ #define BMP_BI_BITFIELDS 3
38
+ #define BMP_BI_JPEG 4
39
+ #define BMP_BI_PNG 5
40
+
41
+ #define BMP_RLE_COMMAND 0
42
+ #define BMP_RLE_ENDOFLINE 0
43
+ #define BMP_RLE_ENDOFBITMAP 1
44
+ #define BMP_RLE_DELTA 2
45
+
46
+ #define BMP_RLE_TYPE_RAW 0
47
+ #define BMP_RLE_TYPE_RLE 1
48
+
49
+ /* BMP header. */
50
+ typedef struct
51
+ {
52
+ /* 16 bit - header identifying the type */
53
+ signed short int magic;
54
+
55
+ /* 32bit - size of the file */
56
+ int size;
57
+
58
+ /* 16bit - these two are in the spec but "reserved" */
59
+ signed short int reserved1;
60
+ signed short int reserved2;
61
+
62
+ /* 32 bit - offset of the bitmap header from data in bytes */
63
+ signed int off;
64
+
65
+ } bmp_hdr_t;
66
+
67
+ /* BMP info. */
68
+ typedef struct
69
+ {
70
+ /* 16bit - Type, ie Windows or OS/2 for the palette info */
71
+ signed short int type;
72
+ /* 32bit - The length of the bitmap information header in bytes. */
73
+ signed int len;
74
+
75
+ /* 32bit - The width of the bitmap in pixels. */
76
+ signed int width;
77
+
78
+ /* 32bit - The height of the bitmap in pixels. */
79
+ signed int height;
80
+
81
+ /* 8 bit - The bitmap data is specified in top-down order. */
82
+ signed char topdown;
83
+
84
+ /* 16 bit - The number of planes. This must be set to a value of one. */
85
+ signed short int numplanes;
86
+
87
+ /* 16 bit - The number of bits per pixel. */
88
+ signed short int depth;
89
+
90
+ /* 32bit - The type of compression used. */
91
+ signed int enctype;
92
+
93
+ /* 32bit - The size of the image in bytes. */
94
+ signed int size;
95
+
96
+ /* 32bit - The horizontal resolution in pixels/metre. */
97
+ signed int hres;
98
+
99
+ /* 32bit - The vertical resolution in pixels/metre. */
100
+ signed int vres;
101
+
102
+ /* 32bit - The number of color indices used by the bitmap. */
103
+ signed int numcolors;
104
+
105
+ /* 32bit - The number of color indices important for displaying the bitmap. */
106
+ signed int mincolors;
107
+
108
+ } bmp_info_t;
109
+
110
+ #endif
111
+
112
+ #ifdef __cplusplus
113
+ }
114
+ #endif