YSTest: YBrush.cpp 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
YBrush.cpp
浏览该文件的文档.
1 /*
2 © 2012-2014 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "YSLib/UI/YModules.h"
29 #include YFM_YSLib_UI_YBrush
30 #include YFM_YSLib_Service_YDraw
31 #include YFM_YSLib_Service_YPixel // for Drawing::Shaders::BlitAlphaPoint;
32
33 namespace YSLib
34 {
35
36 using namespace Drawing;
37
38 namespace UI
39 {
40
41 void
42 SolidBrush::operator()(PaintEventArgs&& e)
43 {
44 Drawing::FillRect(e.Target, e.ClipArea, Color);
45 }
46
47
48 void
49 ImageBrush::operator()(PaintEventArgs&& e)
50 {
51 YAssert(bool(Update), "Null updater found.");
52 if(ImagePtr)
53 Update(e, *ImagePtr, DstOffset, SrcOffset);
54 }
55
56 void
57 ImageBrush::DefaultUpdate(const PaintContext& pc, const Image& img,
58 const Point& dst_offset, const Point& src_offset)
59 {
60 const auto& g(pc.Target);
61 const Rect& r(pc.ClipArea);
62 const auto& src(img.GetContext());
63
64 // CopyTo(g.GetBufferPtr(), src, g.GetSize(), r.GetPoint(), Offset,
65 // r.GetSize());
66 BlitLines<false, false>(CopyLine<true>(), g.GetBufferPtr(),
67 src.GetBufferPtr(), g.GetSize(), src.GetSize(), r.GetPoint(),
68 r.GetPoint() + src_offset - dst_offset, r.GetSize());
69 }
70
71 void
72 ImageBrush::UpdateComposite(const PaintContext& pc, const Image& img,
73 const Point& dst_offset, const Point& src_offset)
74 {
75 return UpdatePixels(Drawing::Shaders::BlitAlphaPoint(), pc, img, dst_offset,
76 src_offset);
77 }
78
79 } // namespace UI;
80
81 } // namespace YSLib;
82
YSLib::UI::ImageBrush::DefaultUpdate
static void DefaultUpdate(const PaintContext &, const Drawing::Image &, const Point &, const Point &)
默认更新：复制图像。
Definition: YBrush.cpp:57
YModules.h
YSLib::Drawing::FillRect
YF_API void FillRect(const Graphics &g, const Rect &, Color c)
填充标准矩形。
Definition: ydraw.cpp:146
YSLib::UI::SolidBrush::operator()
void operator()(PaintEventArgs &&)
Definition: YBrush.cpp:42
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: ywgtevt.h:276
YSLib::UI::UpdatePixels
void UpdatePixels(_fPixelShader shader, const PaintContext &pc, const Drawing::Image &img, const Point &dst_offset, const Point &src_offset)
更新：逐像素操作。
Definition: YBrush.h:138
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: ygdibase.h:416
YSLib::Drawing::GBinaryGroup< SPos >
YSLib::Drawing::Shaders::BlitAlphaPoint
像素计算：Alpha 混合。
Definition: YPixel.h:647
YSLib::Drawing::r
bounds & r
Definition: ydraw.h:220
YSLib::Drawing::g
c yconstfn g
Definition: ystyle.h:104
platform::Color
颜色。
Definition: Video.h:339
YSLib::Drawing::CopyLine
扫描线：按指定扫描顺序复制一行像素。
Definition: yblit.h:490
YAssert
#define YAssert(_expr, _msg)
Definition: cassert.h:73
YSLib::UI::ImageBrush::UpdateComposite
static void UpdateComposite(const PaintContext &, const Drawing::Image &, const Point &, const Point &)
更新：Alpha 组合图像。
Definition: YBrush.cpp:72