rgd 0.4.1a → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{COPYING → COPYING.rdoc} +0 -0
- data/{README → README.rdoc} +0 -0
- data/Rakefile +67 -48
- data/ext/rgd/gd_playground/bmp.h +114 -114
- data/ext/rgd/gd_playground/gd_bmp.c +1130 -1130
- data/ext/rgd/gd_playground/gdhelpers.h +61 -61
- data/ext/rgd/rgd.c +1 -0
- data/lib/rgd.rb +1 -0
- data/lib/rgd/version.rb +5 -0
- data/test/main.rb +8 -3
- data/test/test_copy_rotated.rb +0 -1
- metadata +12 -13
@@ -1,61 +1,61 @@
|
|
1
|
-
#ifdef __cplusplus
|
2
|
-
extern "C" {
|
3
|
-
#endif
|
4
|
-
|
5
|
-
#ifndef GDHELPERS_H
|
6
|
-
#define GDHELPERS_H 1
|
7
|
-
|
8
|
-
/* sys/types.h is needed for size_t on Sparc-SunOS-4.1 */
|
9
|
-
#include <sys/types.h>
|
10
|
-
|
11
|
-
/* TBB: strtok_r is not universal; provide an implementation of it. */
|
12
|
-
|
13
|
-
char * gd_strtok_r (char *s, char *sep, char **state);
|
14
|
-
|
15
|
-
/* These functions wrap memory management. gdFree is
|
16
|
-
in gd.h, where callers can utilize it to correctly
|
17
|
-
free memory allocated by these functions with the
|
18
|
-
right version of free(). */
|
19
|
-
void *gdCalloc (size_t nmemb, size_t size);
|
20
|
-
void *gdMalloc (size_t size);
|
21
|
-
void *gdRealloc (void *ptr, size_t size);
|
22
|
-
|
23
|
-
/* Returns nonzero if multiplying the two quantities will
|
24
|
-
result in integer overflow. Also returns nonzero if
|
25
|
-
either quantity is negative. By Phil Knirsch based on
|
26
|
-
netpbm fixes by Alan Cox. */
|
27
|
-
|
28
|
-
int overflow2(int a, int b);
|
29
|
-
|
30
|
-
/* 2.0.16: portable mutex support for thread safety. */
|
31
|
-
|
32
|
-
#ifdef WIN32
|
33
|
-
/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
|
34
|
-
#include <windows.h>
|
35
|
-
#define gdMutexDeclare(x) CRITICAL_SECTION x
|
36
|
-
#define gdMutexSetup(x) InitializeCriticalSection(&x)
|
37
|
-
#define gdMutexShutdown(x) DeleteCriticalSection(&x)
|
38
|
-
#define gdMutexLock(x) EnterCriticalSection(&x)
|
39
|
-
#define gdMutexUnlock(x) LeaveCriticalSection(&x)
|
40
|
-
#else
|
41
|
-
#ifdef HAVE_PTHREAD
|
42
|
-
#include <pthread.h>
|
43
|
-
#define gdMutexDeclare(x) pthread_mutex_t x
|
44
|
-
#define gdMutexSetup(x) pthread_mutex_init(&x, 0)
|
45
|
-
#define gdMutexShutdown(x) pthread_mutex_destroy(&x)
|
46
|
-
#define gdMutexLock(x) pthread_mutex_lock(&x)
|
47
|
-
#define gdMutexUnlock(x) pthread_mutex_unlock(&x)
|
48
|
-
#else
|
49
|
-
#define gdMutexDeclare(x)
|
50
|
-
#define gdMutexSetup(x)
|
51
|
-
#define gdMutexShutdown(x)
|
52
|
-
#define gdMutexLock(x)
|
53
|
-
#define gdMutexUnlock(x)
|
54
|
-
#endif /* HAVE_PTHREAD */
|
55
|
-
#endif /* WIN32 */
|
56
|
-
|
57
|
-
#endif /* GDHELPERS_H */
|
58
|
-
|
59
|
-
#ifdef __cplusplus
|
60
|
-
}
|
61
|
-
#endif
|
1
|
+
#ifdef __cplusplus
|
2
|
+
extern "C" {
|
3
|
+
#endif
|
4
|
+
|
5
|
+
#ifndef GDHELPERS_H
|
6
|
+
#define GDHELPERS_H 1
|
7
|
+
|
8
|
+
/* sys/types.h is needed for size_t on Sparc-SunOS-4.1 */
|
9
|
+
#include <sys/types.h>
|
10
|
+
|
11
|
+
/* TBB: strtok_r is not universal; provide an implementation of it. */
|
12
|
+
|
13
|
+
char * gd_strtok_r (char *s, char *sep, char **state);
|
14
|
+
|
15
|
+
/* These functions wrap memory management. gdFree is
|
16
|
+
in gd.h, where callers can utilize it to correctly
|
17
|
+
free memory allocated by these functions with the
|
18
|
+
right version of free(). */
|
19
|
+
void *gdCalloc (size_t nmemb, size_t size);
|
20
|
+
void *gdMalloc (size_t size);
|
21
|
+
void *gdRealloc (void *ptr, size_t size);
|
22
|
+
|
23
|
+
/* Returns nonzero if multiplying the two quantities will
|
24
|
+
result in integer overflow. Also returns nonzero if
|
25
|
+
either quantity is negative. By Phil Knirsch based on
|
26
|
+
netpbm fixes by Alan Cox. */
|
27
|
+
|
28
|
+
int overflow2(int a, int b);
|
29
|
+
|
30
|
+
/* 2.0.16: portable mutex support for thread safety. */
|
31
|
+
|
32
|
+
#ifdef WIN32
|
33
|
+
/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
|
34
|
+
#include <windows.h>
|
35
|
+
#define gdMutexDeclare(x) CRITICAL_SECTION x
|
36
|
+
#define gdMutexSetup(x) InitializeCriticalSection(&x)
|
37
|
+
#define gdMutexShutdown(x) DeleteCriticalSection(&x)
|
38
|
+
#define gdMutexLock(x) EnterCriticalSection(&x)
|
39
|
+
#define gdMutexUnlock(x) LeaveCriticalSection(&x)
|
40
|
+
#else
|
41
|
+
#ifdef HAVE_PTHREAD
|
42
|
+
#include <pthread.h>
|
43
|
+
#define gdMutexDeclare(x) pthread_mutex_t x
|
44
|
+
#define gdMutexSetup(x) pthread_mutex_init(&x, 0)
|
45
|
+
#define gdMutexShutdown(x) pthread_mutex_destroy(&x)
|
46
|
+
#define gdMutexLock(x) pthread_mutex_lock(&x)
|
47
|
+
#define gdMutexUnlock(x) pthread_mutex_unlock(&x)
|
48
|
+
#else
|
49
|
+
#define gdMutexDeclare(x)
|
50
|
+
#define gdMutexSetup(x)
|
51
|
+
#define gdMutexShutdown(x)
|
52
|
+
#define gdMutexLock(x)
|
53
|
+
#define gdMutexUnlock(x)
|
54
|
+
#endif /* HAVE_PTHREAD */
|
55
|
+
#endif /* WIN32 */
|
56
|
+
|
57
|
+
#endif /* GDHELPERS_H */
|
58
|
+
|
59
|
+
#ifdef __cplusplus
|
60
|
+
}
|
61
|
+
#endif
|
data/ext/rgd/rgd.c
CHANGED
@@ -2970,6 +2970,7 @@ void Init_rgd() {
|
|
2970
2970
|
rb_define_method(rb_cImage, "data", image_data, -1);
|
2971
2971
|
rb_define_method(rb_cImage, "clone", image_clone, 0);
|
2972
2972
|
rb_define_method(rb_cImage, "to_palette", image_to_palette, -1);
|
2973
|
+
rb_define_alias(rb_cImage, "text", "stringft");
|
2973
2974
|
|
2974
2975
|
// Init
|
2975
2976
|
gdFontCacheSetup();
|
data/lib/rgd.rb
CHANGED
data/lib/rgd/version.rb
ADDED
data/test/main.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
FILE_PATH = File.expand_path(__FILE__)
|
4
|
+
FILE_DIR = File.dirname(FILE_PATH)
|
5
|
+
|
2
6
|
begin
|
3
|
-
require File.join(
|
7
|
+
require File.join(FILE_DIR, '../ext/rgd/rgd')
|
8
|
+
require File.join(FILE_DIR, '../lib/rgd/version')
|
4
9
|
rescue Exception => e
|
5
10
|
require 'rubygems'
|
6
11
|
require 'rgd'
|
@@ -8,12 +13,12 @@ end
|
|
8
13
|
|
9
14
|
$:.push '.'
|
10
15
|
|
11
|
-
if ARGV.length >= 1 &&
|
16
|
+
if ARGV.length >= 1 && FILE_PATH != File.expand_path(ARGV[0]) then
|
12
17
|
load(ARGV[0])
|
13
18
|
exit
|
14
19
|
end
|
15
20
|
|
16
|
-
Dir.chdir(
|
21
|
+
Dir.chdir(FILE_DIR) do;Dir.glob('test*.rb') do |fn|
|
17
22
|
begin
|
18
23
|
load(fn)
|
19
24
|
rescue Exception => e
|
data/test/test_copy_rotated.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 2
|
9
|
+
version: 0.4.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- oCameLo
|
@@ -25,18 +25,19 @@ executables: []
|
|
25
25
|
extensions:
|
26
26
|
- ext/rgd/extconf.rb
|
27
27
|
extra_rdoc_files:
|
28
|
-
- README
|
29
|
-
- COPYING
|
28
|
+
- README.rdoc
|
29
|
+
- COPYING.rdoc
|
30
30
|
files:
|
31
31
|
- BSDL
|
32
|
-
- COPYING
|
32
|
+
- COPYING.rdoc
|
33
33
|
- Rakefile
|
34
|
-
- README
|
34
|
+
- README.rdoc
|
35
35
|
- ext/rgd/extconf.rb
|
36
36
|
- ext/rgd/gd_playground/bmp.h
|
37
37
|
- ext/rgd/gd_playground/gdhelpers.h
|
38
38
|
- ext/rgd/gd_playground/gd_bmp.c
|
39
39
|
- ext/rgd/rgd.c
|
40
|
+
- lib/rgd/version.rb
|
40
41
|
- lib/rgd.rb
|
41
42
|
- test/main.rb
|
42
43
|
- test/mtest_stringft_cn.png
|
@@ -78,7 +79,7 @@ files:
|
|
78
79
|
- test/test_tiled.png
|
79
80
|
- test/test_tiled.rb
|
80
81
|
has_rdoc: true
|
81
|
-
homepage:
|
82
|
+
homepage: https://github.com/oTnTh/rgd
|
82
83
|
licenses: []
|
83
84
|
|
84
85
|
post_install_message:
|
@@ -97,13 +98,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
none: false
|
99
100
|
requirements:
|
100
|
-
- - "
|
101
|
+
- - ">="
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
segments:
|
103
|
-
-
|
104
|
-
|
105
|
-
- 1
|
106
|
-
version: 1.3.1
|
104
|
+
- 0
|
105
|
+
version: "0"
|
107
106
|
requirements: []
|
108
107
|
|
109
108
|
rubyforge_project:
|