LIBPOLYMNIA
picture.h
[詳解]
1 /**********************************************************************//*
10  * (c) 2002-2018 oZ/acy. ALL RIGHTS RESERVED.
11  */
12 #ifndef INC_POLYMNIA_PICTURE_H___
13 #define INC_POLYMNIA_PICTURE_H___
14 
15 #include <string>
16 #include <cstring>
17 #include "ibuf.h"
18 #include "rgb.h"
19 
20 
21 namespace polymnia
22 {
23  class Picture;
24  class PictureIndexed;
25 }
26 
27 
31 class polymnia::Picture : public polymnia::ImageBuffer<polymnia::RgbColor>
32 {
33 protected:
37  Picture(unsigned w, unsigned h)
39  { buf_ = new polymnia::RgbColor[h_ * offset_]; }
40 
41 public:
43  ~Picture() { delete[] buf_; }
45  static Picture* create(unsigned w, unsigned h) noexcept;
47  Picture* clone() const noexcept;
48 
51 
53  void convertToGrayScaled() noexcept;
54 
57 
59  Picture* createReducedPicture(int w, int h) const noexcept;
60 
62  Picture* createMagnifiedPicture(int w, int h) const noexcept;
63 };
64 
65 
66 
67 
71 class polymnia::PictureIndexed : public polymnia::ImageBuffer<themis::UByte>
72 {
73 protected:
74  polymnia::RgbColor pal_[256];
75 
79  PictureIndexed(unsigned w, unsigned h)
80  : polymnia::ImageBuffer<themis::UByte>(w, h, w)
81  { buf_ = new themis::UByte[h_ * offset_]; }
82 
83 
84 public:
86  ~PictureIndexed() { delete[] buf_; }
87 
89  static PictureIndexed* create(unsigned w, unsigned h) noexcept;
90 
92  PictureIndexed* clone() const noexcept;
93 
94 
95  // パレットへのアクセス
99  polymnia::RgbColor& palette(int id) noexcept { return pal_[id]; }
103  const polymnia::RgbColor& palette(int id) const noexcept { return pal_[id]; }
107  polymnia::RgbColor* paletteBuffer() noexcept { return pal_; }
111  const polymnia::RgbColor* paletteBuffer() const noexcept { return pal_; }
112 
114  polymnia::Picture* duplicatePicture() const noexcept;
115 };
116 
117 
118 
119 #endif // INC_POLYMNIA_PICTURE_H___
RGB24bit色情報クラス
Definition: rgb.h:21
Definition: dibio.h:20
const polymnia::RgbColor * paletteBuffer() const noexcept
パレットを參照
Definition: picture.h:111
int offset_
オフセット 水平方向の1ラインのバッファサイズ
Definition: ibuf.h:106
畫像バッファのクラステンプレート
static Picture * create(unsigned w, unsigned h) noexcept
畫像バッファの生成
Definition: picture.cpp:22
RGB24bitカラー型
RGB24bit256色パレットカラー畫像バッファ
Definition: picture.h:71
void convertToGrayScaled() noexcept
グレイスケール化
Definition: tograyscale24.cpp:23
polymnia::RgbColor * paletteBuffer() noexcept
パレットを參照
Definition: picture.h:107
polymnia::PictureIndexed * duplicatePictureIndexed() const noexcept
256色に減色したPictureIndexedオブジェクトを生成
Definition: toindexed.cpp:587
PictureIndexed(unsigned w, unsigned h)
構築子
Definition: picture.h:79
Picture * createMagnifiedPicture(int w, int h) const noexcept
擴大したPictureを生成
Definition: magnify.cpp:64
RGB24bitカラー畫像バッファ
Definition: picture.h:31
Picture * createReducedPicture(int w, int h) const noexcept
縮小したPictureを生成
Definition: reduce.cpp:91
Picture * clone() const noexcept
複製
Definition: picture.cpp:39
Picture(unsigned w, unsigned h)
構築子
Definition: picture.h:37
const polymnia::RgbColor & palette(int id) const noexcept
パレットを參照
Definition: picture.h:103
~Picture()
解體子
Definition: picture.h:43
int h_
高さ
Definition: ibuf.h:105
polymnia::PictureIndexed * createPictureGrayScaleIndexed() const noexcept
内容をグレイスケール化したPictureIndexedオブジェクトを生成
Definition: to_gs_indexed.cpp:24
polymnia::RgbColor * buf_
畫像バッファ
Definition: ibuf.h:103
畫像バッファ基底クラステンプレート
Definition: ibuf.h:23
~PictureIndexed()
解體子
Definition: picture.h:86