typeset 0.1.0
縦書き・横書きの日本語組版ライブラリ(JLReq 水準、ラスタ / PDF / SVG)
読み取り中…
検索中…
一致する文字列を見つけられません
raster.hpp
[詳解]
1#ifndef TYPESET_BACKEND_RASTER_HPP
2#define TYPESET_BACKEND_RASTER_HPP
3
4#include <cstdint>
5#include <memory>
6#include <vector>
7
9
17namespace typeset::backend {
18
22struct Bitmap {
23 int width = 0;
24 int height = 0;
25 std::vector<uint32_t> argb;
26
27 uint32_t* row(int y) { return argb.data() + static_cast<size_t>(y) * width; }
28 const uint32_t* row(int y) const { return argb.data() + static_cast<size_t>(y) * width; }
29};
30
32 float dpi = 72.0f;
33 Color background{255, 255, 255, 255};
34 bool useCache = true;
39 bool antialias = true;
41 uint8_t alphaThreshold = 128;
42};
43
45public:
48
51
55 Bitmap render(const dl::DisplayList& list, const RasterOptions& opts = {});
56
63 void render(const dl::DisplayList& list,
64 uint32_t* pixels, int width, int height, int stridePixels,
65 const Matrix& toDevice, bool useCache = true, uint8_t alphaThreshold = 0);
66
67 void clearCache();
68 void setCacheMaxBytes(size_t bytes);
69
70private:
71 struct Impl;
72 std::unique_ptr<Impl> impl_;
73};
74
76bool savePng(const Bitmap& bitmap, const std::string& path);
77
78} // namespace typeset::backend
79
80#endif // TYPESET_BACKEND_RASTER_HPP
void render(const dl::DisplayList &list, uint32_t *pixels, int width, int height, int stridePixels, const Matrix &toDevice, bool useCache=true, uint8_t alphaThreshold=0)
既存バッファへ描く(組み込み用)
RasterRenderer(const RasterRenderer &)=delete
RasterRenderer & operator=(const RasterRenderer &)=delete
void setCacheMaxBytes(size_t bytes)
Bitmap render(const dl::DisplayList &list, const RasterOptions &opts={})
ページ全体を描いた Bitmap を返す
backend/pdf_writer — 表示リストを PDF へ
bool savePng(const Bitmap &bitmap, const std::string &path)
PNG 書き出し(ラスタ backend の確認用。zlib で圧縮)
色(非前乗算 RGBA)
Definition geom.hpp:117
2x3 アフィン行列(行優先) x' = xx*x + xy*y + dx y' = yx*x + yy*y + dy
Definition geom.hpp:68
ARGB8888(非前乗算)画像
Definition raster.hpp:22
const uint32_t * row(int y) const
Definition raster.hpp:28
uint32_t * row(int y)
Definition raster.hpp:27
std::vector< uint32_t > argb
Definition raster.hpp:25
uint8_t alphaThreshold
2 値化の閾値(0〜255。カバレッジがこれ以上なら塗る)
Definition raster.hpp:41
Color background
a=0 で透明
Definition raster.hpp:33
bool antialias
アンチエイリアス。false でカバレッジを閾値で 2 値化して描く(小サイズのゲーム用途。にじみが出ない)。 グリッドフィット(ヒンティング)は glyphware のマスク API が持たないので効...
Definition raster.hpp:39
1 ページ分の表示リスト