SDXFrameWork  0.04
SDXFrameWork
 全て クラス ネームスペース 関数 変数 ページ
Filter.h
1 #pragma once
2 #include<Multimedia/SDX.h>
3 #include<Multimedia/Image.h>
4 #include<Framework/ImagePack.h>
5 
6 namespace SDX
7 {
9 class Filter
12 {
13 public:
15  static bool Mono( Image* 処理イメージ , int 青色差 , int 赤色差)
21  {
22  #ifdef DXLIB
23  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_MONO ,青色差 , 赤色差);
24  #elif defined(SDL)
25  return false;
26  #endif
27  }
28  static bool Mono( ImagePack *処理イメージ郡 , int 青色差 , int 赤色差)
29  {
30  #ifdef DXLIB
31  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
32  {
33  Mono( 処理イメージ郡[0][i] , 青色差 , 赤色差 );
34  }
35  return true;
36  #elif defined(SDL)
37  return false;
38  #endif
39  }
40 
42  static bool Gauss( Image* 処理イメージ , int 使用ピクセル幅 , double ぼかし強さ)
52  {
53  #ifdef DXLIB
54  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_GAUSS , 使用ピクセル幅 , int(ぼかし強さ*100) );
55  #elif defined(SDL)
56  return false;
57  #endif
58  }
59  static bool Gauss( ImagePack *処理イメージ郡 , int 使用ピクセル幅 , double ぼかし強さ)
60  {
61  #ifdef DXLIB
62  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
63  {
64  Gauss( 処理イメージ郡[0][i] , 使用ピクセル幅 , int(ぼかし強さ*100));
65  }
66  return true;
67  #elif defined(SDL)
68  return false;
69  #endif
70  }
71 
73  static bool DownScale( Image* 処理イメージ , int 分母)
78  {
79  #ifdef DXLIB
80  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_DOWN_SCALE , 分母 );
81  #elif defined(SDL)
82  return false;
83  #endif
84  }
85  static bool DownScale( ImagePack *処理イメージ郡 , int 分母)
86  {
87  #ifdef DXLIB
88  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
89  {
90  DownScale( 処理イメージ郡[0][i] , 分母);
91  }
92  return true;
93  #elif defined(SDL)
94  return false;
95  #endif
96  }
97 
99  static bool BrightClip( Image* 処理イメージ , ClipType cmpType,int cmpParam , int clipFillColor , int clipFillAlpha)
104  {
105  #ifdef DXLIB
106  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_BRIGHT_CLIP , cmpType, cmpParam , true , clipFillColor , clipFillAlpha);
107  #elif defined(SDL)
108  return false;
109  #endif
110  }
111  static bool BrightClip( ImagePack *処理イメージ郡 , ClipType cmpType,int cmpParam , int clipFillColor , int clipFillAlpha)
112  {
113  #ifdef DXLIB
114  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
115  {
116  BrightClip( 処理イメージ郡[0][i] , cmpType , cmpParam , clipFillColor , clipFillAlpha);
117  }
118  return true;
119  #elif defined(SDL)
120  return false;
121  #endif
122  }
123 
125  static bool Hsb( Image* 処理イメージ , int 色相 , double 彩度 , double 明度)
130  {
131  #ifdef DXLIB
132  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_HSB , TRUE , 色相 , int(彩度*255) , int(明度*255) );
133  #elif defined(SDL)
134  return false;
135  #endif
136  }
137  static bool Hsb( ImagePack *処理イメージ郡 , int 色相 , double 彩度 , double 明度)
138  {
139  #ifdef DXLIB
140  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
141  {
142  Hsb( 処理イメージ郡[0][i] , 色相 , 彩度 , 明度);
143  }
144  return true;
145  #elif defined(SDL)
146  return false;
147  #endif
148  }
149 
151  static bool MonoHsb( Image* 処理イメージ , int 色相 , double 彩度 , double 明度)
156  {
157  #ifdef DXLIB
158  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_HSB , FALSE , 色相 , int(彩度*255) , int(明度*255) );
159  #elif defined(SDL)
160  return false;
161  #endif
162  }
163  static bool MonoHsb( ImagePack *処理イメージ郡 , int 色相 , double 彩度 , double 明度)
164  {
165  #ifdef DXLIB
166  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
167  {
168  MonoHsb( 処理イメージ郡[0][i] , 色相 , 彩度 , 明度);
169  }
170  return true;
171  #elif defined(SDL)
172  return false;
173  #endif
174  }
175 
177  bool Invert( Image* 処理イメージ )
179  {
180  #ifdef DXLIB
181  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_INVERT );
182  #elif defined(SDL)
183  return false;
184  #endif
185  }
186  bool Invert( ImagePack *処理イメージ郡 )
187  {
188  #ifdef DXLIB
189  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
190  {
191  Invert( 処理イメージ郡[0][i] );
192  }
193  return true;
194  #elif defined(SDL)
195  return false;
196  #endif
197  }
198 
200  bool Level( Image* 処理イメージ , int 処理前下限 , int 処理前上限 , int 処理後下限 , int 処理後上限, double ガンマ値 )
207  {
208  #ifdef DXLIB
209  if( ガンマ値 < 0.01 ) ガンマ値 = 0.01;
210  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_LEVEL , 処理前下限 , 処理前上限 , int(ガンマ値*100) , 処理後下限 , 処理後上限);
211  #elif defined(SDL)
212  return false;
213  #endif
214  }
215 
216  bool Level( ImagePack *処理イメージ郡 , int 処理前下限 , int 処理前上限 , int 処理後下限 , int 処理後上限, double ガンマ値 )
217  {
218  #ifdef DXLIB
219  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
220  {
221  Level( 処理イメージ郡[0][i] , 処理前下限 , 処理前上限 , 処理後下限 , 処理後上限, ガンマ値);
222  }
223  return true;
224  #elif defined(SDL)
225  return false;
226  #endif
227  }
228 
230  bool TwoColor( Image* 処理イメージ , int 閾値 , int 暗色 , int 暗色α値 , int 明色 , int 明色α値 )
232  {
233  #ifdef DXLIB
234  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_TWO_COLOR , 閾値 , 暗色 , 暗色α値 , 明色 , 明色α値 );
235  #elif defined(SDL)
236  return false;
237  #endif
238  }
239 
240  bool TwoColor( ImagePack *処理イメージ郡 , int 閾値 , int 暗色 , int 暗色α値 , int 明色 , int 明色α値 )
241  {
242  #ifdef DXLIB
243  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
244  {
245  TwoColor( 処理イメージ郡[0][i] , 閾値 , 暗色 , 暗色α値 , 明色 , 明色α値 );
246  }
247  return true;
248  #elif defined(SDL)
249  return false;
250  #endif
251  }
252 
254  bool GradientMap( Image* 処理イメージ , const Image *入力イメージ , bool 反転フラグ)
259  {
260  #ifdef DXLIB
261  return !DxLib::GraphFilter( 処理イメージ->GetHandle() , DX_GRAPH_FILTER_GRADIENT_MAP , 入力イメージ->GetHandle(), 反転フラグ );
262  #elif defined(SDL)
263  return false;
264  #endif
265  }
266  bool GradientMap( ImagePack *処理イメージ郡 , const Image *入力イメージ , bool 反転フラグ)
267  {
268  #ifdef DXLIB
269  for( int i=0 ; i<処理イメージ郡->GetSize() ;++i )
270  {
271  GradientMap( 処理イメージ郡[0][i] , 入力イメージ , 反転フラグ);
272  }
273  return true;
274  #elif defined(SDL)
275  return false;
276  #endif
277  }
278 };
279 
281 class FilterBlt
283 {
284 public:
286  static Image Mono(const Image *元イメージ , int 青色差 , int 赤色差)
287  {
288  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
289  #ifdef DXLIB
290  DxLib::GraphFilterBlt(元イメージ->GetHandle(), outPut.GetHandle(), DX_GRAPH_FILTER_MONO, 青色差, 赤色差);
291  #elif defined(SDL)
292  #endif
293  return outPut;
294  }
295  static Image Mono(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int 青色差, int 赤色差)
296  {
297  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
298  #ifdef DXLIB
299  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_MONO ,青色差 , 赤色差);
300  #elif defined(SDL)
301  #endif
302  return outPut;
303  }
304 
306  static Image Gauss(const Image *元イメージ, int 使用ピクセル幅, int ぼかし強さ)
307  {
308  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
309  #ifdef DXLIB
310  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_GAUSS , 使用ピクセル幅 , ぼかし強さ);
311  #elif defined(SDL)
312  #endif
313  return outPut;
314  }
315  static Image Gauss(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int 使用ピクセル幅, int ぼかし強さ)
316  {
317  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
318  #ifdef DXLIB
319  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_GAUSS , 使用ピクセル幅 , ぼかし強さ);
320  #elif defined(SDL)
321  #endif
322  return outPut;
323  }
324 
326  static Image DownScale(const Image *元イメージ, int num)
327  {
328  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
329  #ifdef DXLIB
330  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_DOWN_SCALE , num );
331  #elif defined(SDL)
332  #endif
333  return outPut;
334  }
335  static Image DownScale(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int num)
336  {
337  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
338  #ifdef DXLIB
339  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_DOWN_SCALE , num );
340  #elif defined(SDL)
341  #endif
342  return outPut;
343  }
344 
346  static Image BrightClip(const Image *元イメージ, ClipType cmpType, int cmpParam, bool isClipFill, int clipFillColor, int clipFillAlpha)
347  {
348  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
349  #ifdef DXLIB
350  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_BRIGHT_CLIP , cmpType, cmpParam , isClipFill , clipFillColor , clipFillAlpha);
351  #elif defined(SDL)
352  #endif
353  return outPut;
354  }
355  static Image BrightClip(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, ClipType cmpType, int cmpParam, bool isClipFill, int clipFillColor, int clipFillAlpha)
356  {
357  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
358  #ifdef DXLIB
359  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_BRIGHT_CLIP , cmpType, cmpParam , isClipFill , clipFillColor , clipFillAlpha);
360  #elif defined(SDL)
361  #endif
362  return outPut;
363  }
364 
366  static Image Hsb(const Image *元イメージ, int hue, int saturation, int bright)
367  {
368  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
369  #ifdef DXLIB
370  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_HSB , true , hue , saturation , bright );
371  #elif defined(SDL)
372  #endif
373  return outPut;
374  }
375  static Image Hsb(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int hue, int saturation, int bright)
376  {
377  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
378  #ifdef DXLIB
379  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_HSB , true , hue , saturation , bright );
380  #elif defined(SDL)
381  #endif
382  return outPut;
383  }
384 
386  static Image MonoHsb(const Image *元イメージ, int hue, int saturation, int bright)
387  {
388  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
389  #ifdef DXLIB
390  DxLib::GraphFilterBlt(元イメージ->GetHandle(), outPut.GetHandle(), DX_GRAPH_FILTER_HSB, false, hue, saturation, bright);
391  #elif defined(SDL)
392  #endif
393  return outPut;
394  }
395  static Image MonoHsb(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int hue, int saturation, int bright)
396  {
397  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
398  #ifdef DXLIB
399  DxLib::GraphFilterRectBlt(元イメージ->GetHandle(), outPut.GetHandle(), srcX1, srcY1, srcX2, srcY2, destX, destY, DX_GRAPH_FILTER_HSB, false, hue, saturation, bright);
400  #elif defined(SDL)
401  #endif
402  return outPut;
403  }
404 
406  static Image Invert(const Image *元イメージ)
408  {
409  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
410  #ifdef DXLIB
411  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_INVERT );
412  #elif defined(SDL)
413  #endif
414  return outPut;
415  }
416  static Image Invert(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY)
417  {
418  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
419  #ifdef DXLIB
420  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_INVERT );
421  #elif defined(SDL)
422  #endif
423  return outPut;
424  }
425 
427  static Image Level(const Image *元イメージ, int min, int max, int gammma, int affterMin, int affterMax)
434  {
435  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
436  #ifdef DXLIB
437  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_LEVEL , min , max , gammma , affterMin , affterMax);
438  #elif defined(SDL)
439  #endif
440  return outPut;
441  }
442  static Image Level(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int min, int max, int gammma, int affterMin, int affterMax)
443  {
444  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
445  #ifdef DXLIB
446  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_LEVEL , min , max , gammma , affterMin , affterMax);
447  #elif defined(SDL)
448  #endif
449  return outPut;
450  }
451 
453  static Image TwoColor(const Image *元イメージ, int threshold, int lowColor, int lowAlpha, int highColor, int highAlpha)
455  {
456  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
457  #ifdef DXLIB
458  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_TWO_COLOR , threshold , lowColor , lowAlpha , highColor , highAlpha );
459  #elif defined(SDL)
460  #endif
461  return outPut;
462  }
463  static Image TwoColor(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, int threshold, int lowColor, int lowAlpha, int highColor, int highAlpha)
464  {
465  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
466  #ifdef DXLIB
467  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_TWO_COLOR , threshold , lowColor , lowAlpha , highColor , highAlpha );
468  #elif defined(SDL)
469  #endif
470  return outPut;
471  }
472 
474  static Image GradientMap(const Image *元イメージ, const Image *mapGraph, bool isReverse)
479  {
480  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
481  #ifdef DXLIB
482  DxLib::GraphFilterBlt( 元イメージ->GetHandle(), outPut.GetHandle() , DX_GRAPH_FILTER_GRADIENT_MAP , mapGraph->GetHandle() , isReverse );
483  #elif defined(SDL)
484  #endif
485  return outPut;
486  }
487  static Image GradientMap(const Image *元イメージ, int srcX1, int srcY1, int srcX2, int srcY2, int destX, int destY, const Image *mapGraph, bool isReverse)
488  {
489  Image outPut(元イメージ->GetWidth(), 元イメージ->GetHeight(), true, true, true);
490  #ifdef DXLIB
491  DxLib::GraphFilterRectBlt( 元イメージ->GetHandle(), outPut.GetHandle() , srcX1, srcY1, srcX2, srcY2, destX, destY , DX_GRAPH_FILTER_GRADIENT_MAP , mapGraph->GetHandle() , isReverse );
492  #elif defined(SDL)
493  #endif
494  return outPut;
495  }
496 };
497 
498 }
static bool Mono(Image *処理イメージ, int 青色差, int 赤色差)
モノトーンフィルタ.
Definition: Filter.h:20
static Image DownScale(const Image *元イメージ, int num)
縮小フィルタ.
Definition: Filter.h:326
static Image Gauss(const Image *元イメージ, int 使用ピクセル幅, int ぼかし強さ)
ガウスフィルタ.
Definition: Filter.h:306
static bool BrightClip(Image *処理イメージ, ClipType cmpType, int cmpParam, int clipFillColor, int clipFillAlpha)
明るさクリップフィルタ.
Definition: Filter.h:103
static bool Hsb(Image *処理イメージ, int 色相, double 彩度, double 明度)
色相・彩度・明度フィルタ.
Definition: Filter.h:129
static Image MonoHsb(const Image *元イメージ, int hue, int saturation, int bright)
色相・彩度・明度フィルタ.
Definition: Filter.h:386
ImageHandle GetHandle() const
ハンドルを取得.
Definition: Image.h:189
static Image BrightClip(const Image *元イメージ, ClipType cmpType, int cmpParam, bool isClipFill, int clipFillColor, int clipFillAlpha)
明るさクリップフィルタ.
Definition: Filter.h:346
static bool DownScale(Image *処理イメージ, int 分母)
縮小フィルタ.
Definition: Filter.h:77
bool Level(Image *処理イメージ, int 処理前下限, int 処理前上限, int 処理後下限, int 処理後上限, double ガンマ値)
レベル補正フィルタ.
Definition: Filter.h:206
static Image Mono(const Image *元イメージ, int 青色差, int 赤色差)
モノトーンフィルタ.
Definition: Filter.h:286
static bool MonoHsb(Image *処理イメージ, int 色相, double 彩度, double 明度)
色相・彩度・明度フィルタ.
Definition: Filter.h:155
画像データを表すクラス.
Definition: Image.h:37
bool Invert(Image *処理イメージ)
階調反転フィルタ.
Definition: Filter.h:178
static Image GradientMap(const Image *元イメージ, const Image *mapGraph, bool isReverse)
グラデーションマップフィルタ.
Definition: Filter.h:478
int GetHeight() const
高さを取得.
Definition: Image.h:385
int GetWidth() const
幅を取得.
Definition: Image.h:375
static Image Invert(const Image *元イメージ)
階調反転フィルタ.
Definition: Filter.h:407
static Image TwoColor(const Image *元イメージ, int threshold, int lowColor, int lowAlpha, int highColor, int highAlpha)
2階調フィルタ.
Definition: Filter.h:454
bool GradientMap(Image *処理イメージ, const Image *入力イメージ, bool 反転フラグ)
グラデーションマップフィルタ.
Definition: Filter.h:258
bool TwoColor(Image *処理イメージ, int 閾値, int 暗色, int 暗色α値, int 明色, int 明色α値)
2階調フィルタ.
Definition: Filter.h:231
static Image Hsb(const Image *元イメージ, int hue, int saturation, int bright)
色相・彩度・明度フィルタ.
Definition: Filter.h:366
static bool Gauss(Image *処理イメージ, int 使用ピクセル幅, double ぼかし強さ)
ガウスフィルタ.
Definition: Filter.h:51
static Image Level(const Image *元イメージ, int min, int max, int gammma, int affterMin, int affterMax)
レベル補正フィルタ.
Definition: Filter.h:433