LIBEUNOMIA
読み取り中…
検索中…
一致する文字列を見つけられません
picture_indexed.h
[詳解]
1/*
2 * Copyright 2001-2021 oZ/acy (名賀月晃嗣)
3 * Redistribution and use in source and binary forms,
4 * with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
41#ifndef INCLUDE_GUARD_EUNOMIA_PICTURE_INDEXED_H
42#define INCLUDE_GUARD_EUNOMIA_PICTURE_INDEXED_H
43
44#include <memory>
45#include "imagebuffer.h"
46#include "colour.h"
47
48
49namespace eunomia
50{
51 class Picture;
52 class PictureRgba;
53
57class PictureIndexed : public ImageBuffer<std::uint8_t>
58{
59private:
61 std::unique_ptr<std::uint8_t[]> upbuf_;
62
63protected:
65
69 PictureIndexed(unsigned w, unsigned h);
70
71public:
77 static
78 std::unique_ptr<PictureIndexed> create(unsigned w, unsigned h) noexcept;
79
81 std::unique_ptr<PictureIndexed> clone() const noexcept;
82
87
88
90
94 eunomia::RgbColour& palette(int id) noexcept { return pal_[id]; }
95
99 const eunomia::RgbColour& palette(int id) const noexcept { return pal_[id]; }
100
105
110};
111
112
121{
122private:
123 const PictureIndexed& pi_;
124
125public:
126 explicit
130
131 void operator()(std::uint8_t src, RgbColour& dst) const noexcept
132 {
133 dst = pi_.palette(src);
134 }
135
136 void operator()(std::uint8_t src, RgbaColour& dst) const noexcept
137 {
138 dst.red = pi_.palette(src).red;
139 dst.green = pi_.palette(src).green;
140 dst.blue = pi_.palette(src).blue;
141 }
142};
143
144
145
146
147}// end of namespace eunomia
148
149
150#endif // INCLUDE_GUARD_EUNOMIA_PICTURE_INDEXED_H
畫像バッファ基底クラステンプレート
Definition imagebuffer.h:84
ImageBuffer(int w, int h, int p) noexcept
構築子
Definition imagebuffer.h:101
PictureIndexed を單純に轉送するための函數オブジェクトクラス
Definition picture_indexed.h:121
void operator()(std::uint8_t src, RgbColour &dst) const noexcept
Definition picture_indexed.h:131
NormalBrendCopierFromPictureIndexed(const PictureIndexed &p) noexcept
Definition picture_indexed.h:127
void operator()(std::uint8_t src, RgbaColour &dst) const noexcept
Definition picture_indexed.h:136
RGB24bit256インデックスの畫像バッファ
Definition picture_indexed.h:58
eunomia::RgbColour & palette(int id) noexcept
パレットの參照
Definition picture_indexed.h:94
const eunomia::RgbColour * paletteBuffer() const noexcept
パレットバッファの參照
Definition picture_indexed.h:109
eunomia::RgbColour * paletteBuffer() noexcept
パレットバッファの參照
Definition picture_indexed.h:104
std::unique_ptr< PictureIndexed > clone() const noexcept
複製
Definition picture_indexed.cpp:66
static std::unique_ptr< PictureIndexed > create(unsigned w, unsigned h) noexcept
畫像バッファ生成
Definition picture_indexed.cpp:54
PictureIndexed(unsigned w, unsigned h)
構築子
Definition picture_indexed.cpp:44
const eunomia::RgbColour & palette(int id) const noexcept
パレットの參照
Definition picture_indexed.h:99
RgbColour pal_[256]
パレット
Definition picture_indexed.h:64
std::unique_ptr< Picture > duplicatePicture() const noexcept
複製(RGB24bit化)
Definition pictidx_dupl_pict.cpp:42
RGB24bitの畫像バッファ
Definition picture.h:59
RGB24bit色情報クラス
Definition colour.h:54
std::uint8_t green
緑要素
Definition colour.h:57
std::uint8_t red
赤要素
Definition colour.h:56
std::uint8_t blue
青要素
Definition colour.h:58
RGBA32bit色情報クラス
Definition colour.h:90
RGB24bit色及びRGBA32bit色
畫像バッファクラステンプレート
Definition colour.h:49