pikl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/License.txt +21 -0
- data/Manifest.txt +37 -0
- data/README.txt +52 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +72 -0
- data/config/requirements.rb +15 -0
- data/ext/pikl/extconf.rb +16 -0
- data/ext/pikl/pikl.h +264 -0
- data/ext/pikl/pikl_bitmap.c +152 -0
- data/ext/pikl/pikl_bitmap.h +18 -0
- data/ext/pikl/pikl_effect.c +191 -0
- data/ext/pikl/pikl_effect.h +24 -0
- data/ext/pikl/pikl_io.c +137 -0
- data/ext/pikl/pikl_io.h +27 -0
- data/ext/pikl/pikl_jpeg.c +161 -0
- data/ext/pikl/pikl_jpeg.h +22 -0
- data/ext/pikl/pikl_png.c +188 -0
- data/ext/pikl/pikl_png.h +17 -0
- data/ext/pikl/pikl_private.h +22 -0
- data/ext/pikl/pikl_resize.c +338 -0
- data/ext/pikl/pikl_resize.h +12 -0
- data/ext/pikl/pikl_rotate.c +70 -0
- data/ext/pikl/pikl_rotate.h +12 -0
- data/ext/pikl/pikl_trim.c +28 -0
- data/ext/pikl/pikl_trim.h +11 -0
- data/lib/pikl.rb +14 -0
- data/lib/pikl/const.rb +49 -0
- data/lib/pikl/errors.rb +7 -0
- data/lib/pikl/ext.rb +32 -0
- data/lib/pikl/image.rb +219 -0
- data/lib/pikl/version.rb +9 -0
- data/setup.rb +1585 -0
- data/test/sample.jpg +0 -0
- data/test/test_helper.rb +2 -0
- data/test/test_pikl.rb +13 -0
- data/test/test_pikl_image.rb +262 -0
- metadata +90 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2008 pikl Ryota Maruko
|
2
|
+
Copyright (c) 2008 libpikl Keiko Soejima
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
config/hoe.rb
|
7
|
+
config/requirements.rb
|
8
|
+
ext/pikl/extconf.rb
|
9
|
+
ext/pikl/pikl.h
|
10
|
+
ext/pikl/pikl_bitmap.c
|
11
|
+
ext/pikl/pikl_bitmap.h
|
12
|
+
ext/pikl/pikl_effect.c
|
13
|
+
ext/pikl/pikl_effect.h
|
14
|
+
ext/pikl/pikl_io.c
|
15
|
+
ext/pikl/pikl_io.h
|
16
|
+
ext/pikl/pikl_jpeg.c
|
17
|
+
ext/pikl/pikl_jpeg.h
|
18
|
+
ext/pikl/pikl_png.c
|
19
|
+
ext/pikl/pikl_png.h
|
20
|
+
ext/pikl/pikl_private.h
|
21
|
+
ext/pikl/pikl_resize.c
|
22
|
+
ext/pikl/pikl_resize.h
|
23
|
+
ext/pikl/pikl_rotate.c
|
24
|
+
ext/pikl/pikl_rotate.h
|
25
|
+
ext/pikl/pikl_trim.c
|
26
|
+
ext/pikl/pikl_trim.h
|
27
|
+
lib/pikl.rb
|
28
|
+
lib/pikl/const.rb
|
29
|
+
lib/pikl/errors.rb
|
30
|
+
lib/pikl/ext.rb
|
31
|
+
lib/pikl/image.rb
|
32
|
+
lib/pikl/version.rb
|
33
|
+
setup.rb
|
34
|
+
test/sample.jpg
|
35
|
+
test/test_helper.rb
|
36
|
+
test/test_pikl.rb
|
37
|
+
test/test_pikl_image.rb
|
data/README.txt
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
= pikl
|
2
|
+
|
3
|
+
Pikl is an image librarry. This library aims to process the image easily.
|
4
|
+
|
5
|
+
=== Installation of pikl
|
6
|
+
|
7
|
+
The simplest way is to install the gem:
|
8
|
+
|
9
|
+
$ sudo gem install pikl
|
10
|
+
|
11
|
+
== SYNOPSIS:
|
12
|
+
|
13
|
+
require "pikl"
|
14
|
+
Pikl::Image.open('path/to/image.jpg') do |img|
|
15
|
+
img.trim(10,5,-10,-5)
|
16
|
+
img.save('path/to/output.png', :png)
|
17
|
+
end
|
18
|
+
|
19
|
+
== REQUIREMENTS:
|
20
|
+
|
21
|
+
Currently, pikl-core (implemented with C) depends on the following libraries:
|
22
|
+
|
23
|
+
* libjpeg
|
24
|
+
* libpng
|
25
|
+
|
26
|
+
notice: pikl use binary library on windows. so these libraries aren't necessary.
|
27
|
+
|
28
|
+
== LICENSE:
|
29
|
+
|
30
|
+
(The MIT License)
|
31
|
+
|
32
|
+
Copyright (c) 2008 pikl Ryota Maruko
|
33
|
+
Copyright (c) 2008 libpikl Keiko Soejima
|
34
|
+
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
36
|
+
a copy of this software and associated documentation files (the
|
37
|
+
'Software'), to deal in the Software without restriction, including
|
38
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
39
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
40
|
+
permit persons to whom the Software is furnished to do so, subject to
|
41
|
+
the following conditions:
|
42
|
+
|
43
|
+
The above copyright notice and this permission notice shall be
|
44
|
+
included in all copies or substantial portions of the Software.
|
45
|
+
|
46
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
47
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
48
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
49
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
50
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
51
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
52
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/config/hoe.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'pikl/version'
|
2
|
+
|
3
|
+
AUTHOR = 'Ryota Maruko' # can also be an array of Authors
|
4
|
+
EMAIL = "FIXME email"
|
5
|
+
DESCRIPTION = "Simple Image Lib."
|
6
|
+
GEM_NAME = 'pikl' # what ppl will type to install your gem
|
7
|
+
RUBYFORGE_PROJECT = 'pikl' # The unix name for your project
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
|
11
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
+
@config = nil
|
13
|
+
RUBYFORGE_USERNAME = "unknown"
|
14
|
+
def rubyforge_username
|
15
|
+
unless @config
|
16
|
+
begin
|
17
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
+
rescue
|
19
|
+
puts <<-EOS
|
20
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
21
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
+
EOS
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
REV = nil
|
32
|
+
# UNCOMMENT IF REQUIRED:
|
33
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
+
VERS = Pikl::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
+
RDOC_OPTS = ['--quiet', '--title', 'pikl documentation',
|
36
|
+
"--opname", "index.html",
|
37
|
+
"--line-numbers",
|
38
|
+
"--main", "README",
|
39
|
+
"--inline-source"]
|
40
|
+
|
41
|
+
class Hoe
|
42
|
+
def extra_deps
|
43
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
+
@extra_deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate all the Rake tasks
|
49
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
+
p.developer(AUTHOR, EMAIL)
|
52
|
+
p.description = DESCRIPTION
|
53
|
+
p.summary = DESCRIPTION
|
54
|
+
p.url = HOMEPATH
|
55
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
|
+
p.test_globs = ["test/**/test_*.rb"]
|
57
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
+
|
59
|
+
# == Optional
|
60
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
+
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
62
|
+
|
63
|
+
p.spec_extras = {
|
64
|
+
:extensions => ['ext/pikl/extconf.rb'],
|
65
|
+
} # A hash of extra values to set in the gemspec.
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/ext/pikl/extconf.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
=begin
|
2
|
+
usage: ruby extconf.rb [options ...]
|
3
|
+
configure options:
|
4
|
+
--with-jpeg-include=dir
|
5
|
+
--with-jpeg-lib=dir
|
6
|
+
--with-png-include=dir
|
7
|
+
--with-png-lib=dir
|
8
|
+
=end
|
9
|
+
require 'mkmf'
|
10
|
+
|
11
|
+
dir_config('jpeg')
|
12
|
+
dir_config('png')
|
13
|
+
if have_header('jpeglib.h') and have_library('jpeg') and have_header('png.h') and have_library('png')
|
14
|
+
create_makefile('pikl/pikl')
|
15
|
+
end
|
16
|
+
|
data/ext/pikl/pikl.h
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
/*! @file
|
2
|
+
@brief image library "pikl"
|
3
|
+
simple image library
|
4
|
+
@author soe(soezimaster@gmail.com)
|
5
|
+
@date 2008.4
|
6
|
+
*/
|
7
|
+
#ifndef _LIB_PIKL_
|
8
|
+
#define _LIB_PIKL_
|
9
|
+
|
10
|
+
#ifdef WIN32
|
11
|
+
#define PKLExport __declspec(dllexport)
|
12
|
+
#define XMD_H
|
13
|
+
#else
|
14
|
+
#define PKLExport
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#if defined __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
/*! version */
|
22
|
+
#define PKL_VERSION "libpikl 0.1"
|
23
|
+
|
24
|
+
// PKLImage
|
25
|
+
typedef struct _PKLImage * PKLImage;
|
26
|
+
|
27
|
+
/*!
|
28
|
+
support format<br>
|
29
|
+
■JPEG:<br>
|
30
|
+
gray, rgb, cmyk<br>
|
31
|
+
* color-typeのYCbCrおよびYCCには読み取りも保存も対応していません。<br>
|
32
|
+
■PNG:<br>
|
33
|
+
gray,gray-alpha,rgb,rgb-alpha,palette<br>
|
34
|
+
* alphaは読取は可能ですが、保存はできません。<br>
|
35
|
+
* paletteはRGBとして扱われます。<br>
|
36
|
+
■BMP(windows bitmap):<br>
|
37
|
+
24bit only
|
38
|
+
*/
|
39
|
+
typedef enum {
|
40
|
+
PKL_FORMAT_ERROR, /*!< error */
|
41
|
+
PKL_FORMAT_JPEG, /*!< jpeg */
|
42
|
+
PKL_FORMAT_PNG, /*!< png */
|
43
|
+
PKL_FORMAT_BITMAP /*!< windows bitmap */
|
44
|
+
} PKL_FORMAT;
|
45
|
+
|
46
|
+
/*! color type */
|
47
|
+
typedef enum {
|
48
|
+
PKL_UNKNOWN, /*!< error */
|
49
|
+
PKL_BLACKWHITE, /*!< non support */
|
50
|
+
PKL_GRAYSCALE, /*!< gray scale */
|
51
|
+
PKL_RGB, /*!< 24bit RGB */
|
52
|
+
PKL_RGBA, /*!< non support */
|
53
|
+
PKL_YCbCr, /*!< non support */
|
54
|
+
PKL_CMYK, /*!< CMYK(for jpeg) */
|
55
|
+
PKL_YCCK /*!< non support */
|
56
|
+
} PKL_COLOR_SPACE;
|
57
|
+
|
58
|
+
/*! right turn angle(for rotate) */
|
59
|
+
typedef enum {
|
60
|
+
PKL_ANGLE_000,
|
61
|
+
PKL_ANGLE_090,
|
62
|
+
PKL_ANGLE_180,
|
63
|
+
PKL_ANGLE_270
|
64
|
+
} PKL_ANGLE;
|
65
|
+
|
66
|
+
/*!
|
67
|
+
sampling pattern(for resize)<br>
|
68
|
+
※全てのサンプリングパターンに拡大縮小対応しています。<br>
|
69
|
+
※但し、pixcel averageで拡大をする場合は、lanczosと品質は同じになります。
|
70
|
+
*/
|
71
|
+
typedef enum {
|
72
|
+
PKL_SAMPLE_ERROR,
|
73
|
+
PKL_SAMPLE_NN, /*!< nearest neighbor */
|
74
|
+
PKL_SAMPLE_BL, /*!< bilinear */
|
75
|
+
PKL_SAMPLE_BC, /*!< bicubic */
|
76
|
+
PKL_SAMPLE_PA, /*!< pixcel average */
|
77
|
+
PKL_SAMPLE_LZ /*!< lanczos */
|
78
|
+
} PKL_SAMPLE;
|
79
|
+
|
80
|
+
//=============================================================================
|
81
|
+
// method
|
82
|
+
//=============================================================================
|
83
|
+
/*!
|
84
|
+
PKLImageを構築します。<br>
|
85
|
+
エラーが発生した場合は、NULLが返ります。<br>
|
86
|
+
@param in [in] ロードする画像
|
87
|
+
@return 成功した場合は、PKLImageのポインタが返ります。失敗したときはNULLが返ります。
|
88
|
+
*/
|
89
|
+
PKLExport PKLImage pkl_open(const char *in);
|
90
|
+
|
91
|
+
/*!
|
92
|
+
画像フォーマットを返します。<br>
|
93
|
+
@param pkl [in] PKLImageオブジェクト
|
94
|
+
@return PKL_FORMAT参照
|
95
|
+
*/
|
96
|
+
PKLExport PKL_FORMAT pkl_format(PKLImage pkl);
|
97
|
+
|
98
|
+
/*!
|
99
|
+
画像の幅を返します。<br>
|
100
|
+
@param pkl [in] PKLImageオブジェクト
|
101
|
+
@return 画像の幅(ピクセル数)
|
102
|
+
*/
|
103
|
+
PKLExport int pkl_width(PKLImage pkl);
|
104
|
+
|
105
|
+
/*!
|
106
|
+
画像の高さを返します。<br>
|
107
|
+
@param pkl [in] PKLImageオブジェクト
|
108
|
+
@return 画像の高さ(ピクセル数)
|
109
|
+
*/
|
110
|
+
PKLExport int pkl_height(PKLImage pkl);
|
111
|
+
|
112
|
+
/*!
|
113
|
+
トリミングします。<br>
|
114
|
+
・パラメータは左上原点です。<br>
|
115
|
+
・パラメータは左上原点です。<br>
|
116
|
+
・左上原点はsx=0, sy=0になります。<br>
|
117
|
+
@param pkl [in] PKLImageオブジェクト
|
118
|
+
@param sx [in] 切り出し位置(x)
|
119
|
+
@param sy [in] 切り出し位置(y)
|
120
|
+
@param width [in] sxからの切り出す幅(ピクセル数)
|
121
|
+
@param height [in] syからの切り出す高さ(ピクセル数)
|
122
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
123
|
+
*/
|
124
|
+
PKLExport int pkl_trim(PKLImage pkl, int sx, int sy, int width, int height);
|
125
|
+
|
126
|
+
/*!
|
127
|
+
右回り90度単位で回転します。<br>
|
128
|
+
@param pkl [in] PKLImageオブジェクト
|
129
|
+
@param angle [in] 回転角度(PKL_ANGLE参照)
|
130
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
131
|
+
*/
|
132
|
+
PKLExport int pkl_rotate(PKLImage pkl, PKL_ANGLE angle);
|
133
|
+
|
134
|
+
/*!
|
135
|
+
拡大・縮小します。<br>
|
136
|
+
@param pkl [in] PKLImageオブジェクト
|
137
|
+
@param width [in] 横方向の変形後サイズ(ピクセル数)
|
138
|
+
@param height [in] 縦方向の変形後サイズ(ピクセル数)
|
139
|
+
@param sample [in] サンプリングパターン(PKL_SAMPLE参照)
|
140
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
141
|
+
*/
|
142
|
+
PKLExport int pkl_resize(PKLImage pkl, int width, int height, PKL_SAMPLE sample);
|
143
|
+
|
144
|
+
/*!
|
145
|
+
アンシャープ処理<br>
|
146
|
+
@param pkl [in] PKLImageオブジェクト
|
147
|
+
@param threshold [in]
|
148
|
+
適応量。0から255の範囲で指定します。
|
149
|
+
0の時:変化しません。
|
150
|
+
255の時:全ての色にアンシャープ処理が働きます
|
151
|
+
@param edge [in]
|
152
|
+
エッジ。想定結果が得られる範囲は-10 .. 10程度です。
|
153
|
+
edge=0の時:変化しません。
|
154
|
+
edge>0の時:値が大きいほど先鋭化されます。
|
155
|
+
edge<0の時:値が小さいほどぼやけます。
|
156
|
+
|
157
|
+
想定結果が得られる範囲は-10 .. 10程度です。
|
158
|
+
これを超える場合は、品質の保証はありません。
|
159
|
+
※画質によりこの通りではありません。-10..10の範囲より小さくなる可能性があります。
|
160
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
161
|
+
*/
|
162
|
+
PKLExport int pkl_unsharp(PKLImage pkl, int threshold, double edge);
|
163
|
+
|
164
|
+
/*!
|
165
|
+
コントラスト調整<br>
|
166
|
+
@param pkl [in] PKLImageオブジェクト
|
167
|
+
@param rate [in]
|
168
|
+
調整係数。-127 .. 127の範囲で指定します。<br>
|
169
|
+
0の時:変化しません。
|
170
|
+
* rateが0以上の時は周波数によるコントラスト強調がおこなわれます。
|
171
|
+
* rateが0未満の時は直線的に平坦化されます。
|
172
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
173
|
+
*/
|
174
|
+
PKLExport int pkl_contrast(PKLImage pkl, int rate);
|
175
|
+
|
176
|
+
/*!
|
177
|
+
レベル補正<br>
|
178
|
+
ヒストグラムの平坦化をおこないます。各色の分布に偏りがある画像に有効な場合があります。
|
179
|
+
@param pkl [in] PKLImageオブジェクト
|
180
|
+
@param low [in]
|
181
|
+
全ピクセル数に対して、切り捨てる暗い色の総数の割合(0-100%)
|
182
|
+
@param high [in]
|
183
|
+
全ピクセル数に対して、切り捨てる明るい色の総数の割合(0-100%)
|
184
|
+
@param coeff [in]
|
185
|
+
平坦化時の係数。
|
186
|
+
1が標準です。1より小さい場合は暗く、1より大きい場合は明るくなります(0.0..2.0)
|
187
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
188
|
+
*/
|
189
|
+
PKLExport int pkl_level(PKLImage pkl, double low, double high, double coeff);
|
190
|
+
|
191
|
+
/*!
|
192
|
+
明るさ調整<br>
|
193
|
+
各色にcolor値を加算する単純な処理です。
|
194
|
+
@param pkl [in] PKLImageオブジェクト
|
195
|
+
@param color [in]
|
196
|
+
各色に加算する色。
|
197
|
+
255を指定すれば、ただの白い画像になります。
|
198
|
+
-255を指定すると、ただの黒い画像になります。
|
199
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
200
|
+
*/
|
201
|
+
PKLExport int pkl_brightness(PKLImage pkl, int color);
|
202
|
+
|
203
|
+
/*!
|
204
|
+
輝度(明るさ)・彩度(鮮やかさ)・色相(色合い)調整<br>
|
205
|
+
@param pkl [in] PKLImageオブジェクト
|
206
|
+
@param ym [in]
|
207
|
+
輝度(-1..1)。
|
208
|
+
+0.1で10%up。
|
209
|
+
0.0は変化なし
|
210
|
+
@param sm [in]
|
211
|
+
彩度(-1..1)。
|
212
|
+
+0.1で10%up。
|
213
|
+
0.0は変化なし
|
214
|
+
@param hd [in]
|
215
|
+
色相(360度回転)。
|
216
|
+
360度の倍数では変化しません。
|
217
|
+
参考:R=113.2/Ye=173.0/G=225.0/Cy=293.2/B=353.0/Mg=45.0
|
218
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
219
|
+
*/
|
220
|
+
PKLExport int pkl_hls(PKLImage pkl, double ym, double sm, double hd);
|
221
|
+
|
222
|
+
/*!
|
223
|
+
ガンマ補正<br>
|
224
|
+
@param pkl [in] PKLImageオブジェクト
|
225
|
+
@param gm [in]
|
226
|
+
補正係数(0.0以上の値が指定できます)。
|
227
|
+
1.0より小さい時は暗く、1.0より大きい時は明るく調整されます。
|
228
|
+
1.0を指定した時は調整されません。
|
229
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
230
|
+
*/
|
231
|
+
PKLExport int pkl_gamma(PKLImage pkl, double gm);
|
232
|
+
|
233
|
+
/*!
|
234
|
+
PNG/JPEG保存時の圧縮率<br>
|
235
|
+
@param pkl [in] PKLImageオブジェクト
|
236
|
+
@param level [in]
|
237
|
+
0(無圧縮) .. 10(最高圧縮)。
|
238
|
+
指定がない場合は、デフォルトレベルが設定されます。
|
239
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
240
|
+
*/
|
241
|
+
PKLExport int pkl_compress(PKLImage pkl, int level);
|
242
|
+
|
243
|
+
/*!
|
244
|
+
保存<br>
|
245
|
+
@param pkl [in] PKLImageオブジェクト
|
246
|
+
@param out [in] 保存ファイル名
|
247
|
+
@param format [in] 保存フォーマット(PKL_FORMAT参照)
|
248
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
249
|
+
*/
|
250
|
+
PKLExport int pkl_save(PKLImage pkl, const char *out, PKL_FORMAT format);
|
251
|
+
|
252
|
+
/*!
|
253
|
+
PKLImageオブジェクトの破棄<br>
|
254
|
+
確保していたメモリを全て解放します。用がなくなったら実行するようにしてください。
|
255
|
+
@param pkl [in] PKLImageオブジェクト
|
256
|
+
@return 成功した場合は0。失敗した場合は真を返します。
|
257
|
+
*/
|
258
|
+
PKLExport void pkl_close(PKLImage pkl);
|
259
|
+
|
260
|
+
#if defined __cplusplus
|
261
|
+
}
|
262
|
+
#endif
|
263
|
+
|
264
|
+
#endif
|