28 #ifndef YSL_INC_UI_YBrush_h_
29 #define YSL_INC_UI_YBrush_h_ 1
32 #include YFM_YSLib_UI_YWidgetEvent
33 #include YFM_YSLib_Service_YResource
34 #include YFM_YSLib_Service_YBlit // for Drawing::BlitPixels;
68 template<
typename _type>
69 using GBrushUpdater = std::function<void(
const PaintContext&, _type,
94 ImageBrush(const shared_ptr<Drawing::Image>& h)
98 : ImagePtr(std::move(h))
118 DefaultUpdate(const PaintContext&, const Drawing::Image&, const
Point&,
126 UpdateComposite(const PaintContext&, const Drawing::Image&, const Point&,
136 template<typename _fPixelShader,
bool _bSwapLR = false,
bool _bSwapUD = false>
139 const Drawing::Image& img, const Point& dst_offset, const Point& src_offset)
141 const auto&
g(pc.Target);
142 const Rect&
r(pc.ClipArea);
143 const auto& src(img.GetContext());
145 Drawing::BlitPixels<_bSwapLR, _bSwapUD>(shader,
g.GetBufferPtr(),
146 src.GetBufferPtr(),
g.GetSize(), src.GetSize(), r.GetPoint(),
147 r.GetPoint() + src_offset - dst_offset, r.GetSize());
yconstfn DefDeCtor(ImageBrush) ImageBrush(const shared_ptr< Drawing
#define DefDeCopyCtor(_t)
SolidBrush(Drawing::Color c)
void UpdatePixels(_fPixelShader shader, const PaintContext &pc, const Drawing::Image &img, const Point &dst_offset, const Point &src_offset)
更新:逐像素操作。
shared_ptr< Drawing::Image > ImagePtr
std::function< void(const PaintContext &, _type, const Point &, const Point &)> GBrushUpdater
画刷更新器类型。
#define yconstfn
指定编译时常量函数。
#define DefDeMoveAssignment(_t)
Selected const shared_ptr< ListType > const pair< Color, Color > & DefDeMoveCtor(TextList) DefPredMem(const ynothrow
ImageBrush(shared_ptr< Drawing::Image > &&h)
#define DefDeCopyAssignment(_t)