29 #include YFM_YSLib_Service_CharRenderer
30 #include YFM_YSLib_Service_YPixel
32 using namespace ystdex;
37 using namespace Drawing;
47 const AlphaType BLT_TEXT_ALPHA_THRESHOLD(16);
58 template<
typename _tOut,
typename _tIn>
60 operator()(_tOut dst_iter, _tIn src_iter)
62 if(*src_iter >= BLT_TEXT_ALPHA_THRESHOLD)
63 yunseq(*dst_iter.base().second = *src_iter,
64 *dst_iter = char_color);
70 template<
unsigned char _vN>
73 static_assert(_vN < CHAR_BIT,
"Specified bits should be within a byte.");
80 return v =
byte(*i << (CHAR_BIT - _vN) | ((1U << _vN) - 1));
108 template<
unsigned char _vN>
123 using namespace Shaders;
125 YAssert(cbuf,
"Invalid buffer found.");
128 case CharBitmap::Mono:
130 MonoItPair_1(PixelIt(c), tr_buf<1>(cbuf)), ss, pc, neg_pitch);
132 case CharBitmap::Gray2:
134 MonoItPair_2(PixelIt(c), tr_buf<2>(cbuf)), ss, pc, neg_pitch);
136 case CharBitmap::Gray4:
138 MonoItPair_4(PixelIt(c), tr_buf<4>(cbuf)), ss, pc, neg_pitch);
142 MonoItPair(PixelIt(c), cbuf), ss, pc, neg_pitch);
153 YAssert(cbuf,
"Invalid buffer found.");
157 case CharBitmap::Mono:
159 alpha), tr_buf<1>(cbuf), ss, pc, neg_pitch);
161 case CharBitmap::Gray2:
163 alpha), tr_buf<2>(cbuf), ss, pc, neg_pitch);
165 case CharBitmap::Gray4:
167 alpha), tr_buf<4>(cbuf), ss, pc, neg_pitch);
171 alpha), cbuf, ss, pc, neg_pitch);
189 const int max_w(GetBufferWidthN() - 1),
190 space_w(ts.GetCache().GetAdvance(
' '));
193 return line_breaks_l = 1;
void BlitGlyphPixels(_fPixelShader blit, _tOut dst, _tIn src, const Size &ss, const PaintContext &pc, bool neg_pitch)
字符按像素块传输。
YF_API u8 PutCharBase(TextState &, SDst, ucs4_t)
使用指定的文本状态和行末位置(横坐标)按需打印换行并判断是否需要渲染单个字符。
std::uint16_t SDst
屏幕坐标距离。
#define YB_UNLIKELY(expr)
分支预测提示。
#define yunseq
无序列依赖表达式组求值。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
YF_API void RenderChar(PaintContext &&pc, Color, bool, CharBitmap::BufferType, CharBitmap::FormatType, const Size &)
渲染单个字符。
char32_t ucs4_t
UCS-4 字符类型。
#define YAssert(_expr, _msg)
YF_API void RenderCharAlpha(PaintContext &&pc, Color, bool, CharBitmap::BufferType, CharBitmap::FormatType, const Size &, AlphaType *)
渲染带 Alpha 缓冲的单个字符。