YSTest: ystyle.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ystyle.h
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 2010 - 2013.
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 #ifndef YSL_INC_UI_ystyle_h_
29 #define YSL_INC_UI_ystyle_h_ 1
30
31 #include "ycomp.h"
32 #include "../Service/ydraw.h"
33 #include <ystdex/rational.hpp>
34
35 YSL_BEGIN
36
37 YSL_BEGIN_NAMESPACE(Drawing)
38
39
44 YF_API bool
45 DrawRectRoundCorner(const Graphics&, const Point&, const Size&, Color);
46
47
52 YF_API void
53 RectDrawArrow(const Graphics&, const Point&, SDst, Rotation = RDeg0,
54 Color c = ColorSpace::Black);
55
60 YF_API void
61 DrawArrow(const Graphics&, const Rect&, SDst = 4, Rotation = RDeg0,
62 Color = ColorSpace::Black);
63
69 YF_API void
70 DrawCross(const Graphics&, const Point&, const Size&, Color);
71
72
77 template<Color::MonoType r, Color::MonoType g, Color::MonoType b>
78 inline void
79 transform_pixel_ex(BitmapPtr dst)
80 {
81 const Color d(*dst);
82
83 *dst = Color(d.GetR() ^ r, d.GetG() ^ g, d.GetB() ^ b);
84 }
85
86
87 //平台无关色彩系统类型和转换。
88
94 typedef ystdex::fixed_point<u16, 9> Hue;
95
96
101 typedef struct
102 {
107 Hue h;
113 float s, l;
114 } hsl_t;
115
120 YF_API hsl_t
121 ColorToHSL(Color);
122
127 YF_API Color
128 HSLToColor(hsl_t);
129
130
131 YSL_END_NAMESPACE(Drawing)
132
133 YSL_BEGIN_NAMESPACE(UI)
134
135 YSL_BEGIN_NAMESPACE(Styles)
136
141 typedef enum
142 {
143 //背景和填充区域。
144 Null = 0,
145 Desktop = 1,
146 Window = 2,
147 Panel = 3,
148 Track = 4,
149 Workspace = 5,
150 Shadow = 6,
151 DockShadow = 7,
152 Light = 8,
153 Frame = 9,
154 Highlight = 10,
155 BorderFill = 11,
156 ActiveBorder = 12,
157 InactiveBorder = 13,
158 ActiveTitle = 14,
159 InactiveTitle = 15,
160
161 //前景和文本。
162 HighlightText = 16,
163 WindowText = 17,
164 PanelText = 18,
165 GrayText = 19,
166 TitleText = 20,
167 InactiveTitleText = 21,
168 HotTracking = 22,
169
170 EndArea = 24
171 } Area;
172
173
178 class YF_API Palette
179 {
180 public:
181 typedef Drawing::Color ItemType; //项目类型。
182 typedef vector<ItemType> ColorListType; //颜色组类型。
183
184 private:
185 ColorListType colors; //颜色组。
186 // Drawing::Color colors[EndArea];
187
188 public:
193 Palette();
194
198 PDefHOp(Drawing::Color&, [], size_t s)
199 ImplRet(colors[s])
200
201 DefGetter(const ynothrow, const ColorListType&, List, colors)
202 DefGetter(ynothrow, ColorListType&, List, colors)
206 pair<Drawing::Color, Drawing::Color>
207 GetPair(ColorListType::size_type, ColorListType::size_type) const;
208 };
209
210 YSL_END_NAMESPACE(Styles)
211
212 YSL_END_NAMESPACE(UI)
213
214 YSL_END
215
216 #endif
217