LIBEUNOMIA
読み取り中…
検索中…
一致する文字列を見つけられません
ibuf_blt.h
[詳解]
1/*
2 * Copyright 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 */
27/*
28 * @file ibuf_blt.h
29 * @author oZ/acy
30 * @brief 畫像バッファクラステンプレートのblt系メンバ函數の實裝
31 *
32 * @date 2021.4.22 作成
33 *
34 */
35/* This file is included by "imagebuffer.h". */
36
37
39{
44{
45public:
46 int sx, sy;
47 int w, h;
48 int dx, dy;
49
50private:
51 bool flag_;
52
53public:
68 int srcx, int srcy, int srcw, int srch, int bltw, int blth,
69 int dstx, int dsty, int dstw, int dsth,
70 const std::optional<Rect>& cliprect);
71
72 explicit operator bool() const { return flag_; }
73};
74
75
76}//end of namespace eunomia::implement_
77
78
79
80
81template<class C_> template<class CSrc, class Copier>
82inline
83void
85 const eunomia::ImageBuffer<CSrc>& src, int sx, int sy, int w, int h,
86 int dx, int dy, const std::optional<eunomia::Rect>& cliprect,
88{
90 clipper(
91 sx, sy, src.width(), src.height(), w, h,
92 dx, dy, width(), height(), cliprect);
93
94 if (clipper) {
95 auto dl = buffer() + pitch() * clipper.dy;
96 auto sl = src.buffer() + src.pitch() * clipper.sy;
97
98 for (int j = 0; j < clipper.h; ++j, dl += pitch(), sl += src.pitch())
99 for (int i = 0; i < clipper.w; ++i)
100 copier(
101 reinterpret_cast<const CSrc*>(sl)[clipper.sx + i],
102 reinterpret_cast<C_*>(dl)[clipper.dx + i]);
103 }
104}
105
106
107
108
109//eof
畫像バッファ基底クラステンプレート
Definition imagebuffer.h:84
int width() const noexcept
Definition imagebuffer.h:114
ImageBuffer(int w, int h, int p) noexcept
構築子
Definition imagebuffer.h:101
int pitch() const noexcept
ピッチ
Definition imagebuffer.h:118
void blt(const ImageBuffer< CSrc > &src, int sx, int sy, int w, int h, int dx, int dy, const std::optional< Rect > &cliprect, Copier copier)
轉送
uint8_t * buffer() noexcept
バッファの先頭アドレスの取得
Definition imagebuffer.h:121
int height() const noexcept
高さ
Definition imagebuffer.h:116
クリッピング處理クラス
Definition ibuf_blt.h:44
int h
Definition ibuf_blt.h:47
int dy
Definition ibuf_blt.h:48
int sy
Definition ibuf_blt.h:46
int w
Definition ibuf_blt.h:47
Clipper_(int srcx, int srcy, int srcw, int srch, int bltw, int blth, int dstx, int dsty, int dstw, int dsth, const std::optional< Rect > &cliprect)
構築子
Definition ibuf_blt.cpp:37
int dx
Definition ibuf_blt.h:48
int sx
Definition ibuf_blt.h:46
Definition ibuf_blt.h:39