YSTest
PreAlpha_b400_20130424
The YSLib Test Project
首页
相关页面
模块
命名空间
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
ydraw.h
浏览该文件的文档.
1
/*
2
Copyright by FrankHB 2009 - 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_Service_ydraw_h_
29
#define YSL_INC_Service_ydraw_h_ 1
30
31
#include "../Core/ygdibase.h"
32
33
YSL_BEGIN
34
35
YSL_BEGIN_NAMESPACE
(Drawing)
36
37
//图形接口上下文操作:绘图。
38
39
44
inline
void
45
PutPixel
(
BitmapPtr
dst,
SDst
w
,
SPos
x,
SPos
y,
Color
c)
46
{
47
YAssert
(dst,
"Null pointer found."
);
48
49
dst[y * w + x] = c;
50
}
55
inline
void
56
PutPixel
(
const
Graphics
& g,
SPos
x,
SPos
y,
Color
c)
57
{
58
YAssert
(
Rect
(g.
GetSize
()).
Contains
(x, y),
59
"The pixel is not in the device context buffer."
);
60
61
PutPixel
(g.
GetBufferPtr
(), g.
GetWidth
(), x, y, c);
62
}
63
68
inline
bool
69
PlotPixel
(
BitmapPtr
dst,
const
Size
& s,
SPos
x,
SPos
y,
Color
c)
70
{
71
if
(
Rect
(s).
Contains
(x, y))
72
{
73
PutPixel
(dst, s.
Width
, x, y, c);
74
return
true
;
75
}
76
return
false
;
77
}
78
82
inline
bool
83
DrawPoint
(
const
Graphics
& g,
SPos
x,
SPos
y,
Color
c)
84
{
85
if
(
YB_LIKELY
(g))
86
return
PlotPixel
(g.
GetBufferPtr
(), g.
GetSize
(), x, y, c);
87
return
false
;
88
}
92
inline
bool
93
DrawPoint
(
const
Graphics
& g,
const
Point
& pt,
Color
c)
94
{
95
return
DrawPoint
(g, pt.
X
, pt.
Y
, c);
96
}
97
102
YF_API
bool
103
DrawHLineSeg
(
const
Graphics& g,
SPos
y,
SPos
x1,
SPos
x2,
Color
c);
104
109
YF_API
bool
110
DrawVLineSeg
(
const
Graphics& g,
SPos
x,
SPos
y1,
SPos
y2,
Color
c);
111
115
YF_API
bool
116
DrawLineSeg
(
const
Graphics& g,
SPos
x1,
SPos
y1,
SPos
x2,
SPos
y2,
Color
c);
120
inline
bool
121
DrawLineSeg
(
const
Graphics
& g,
const
Point
& p1,
const
Point
& p2,
Color
c)
122
{
123
return
DrawLineSeg
(g, p1.
X
, p1.
Y
, p2.
X
, p2.
Y
, c);
124
}
125
130
YF_API
bool
131
DrawRect
(
const
Graphics& g,
const
Point
& pt,
const
Size& s,
Color
c);
136
inline
bool
137
DrawRect
(
const
Graphics
& g,
const
Rect
& r,
Color
c)
138
{
139
return
DrawRect
(g, r.
GetPoint
(), r.
GetSize
(), c);
140
}
141
146
YF_API
bool
147
FillRect
(
const
Graphics& g,
const
Point
& pt,
const
Size& s,
Color
c);
152
inline
bool
153
FillRect
(
const
Graphics
& g,
const
Rect
& r,
Color
c)
154
{
155
return
FillRect
(g, r.
GetPoint
(), r.
GetSize
(), c);
156
}
157
162
YF_API
bool
163
DrawCircle
(
const
Graphics&,
const
Point
&,
SDst
,
Color
c);
164
165
YSL_END_NAMESPACE
(Drawing)
166
167
YSL_END
168
169
#endif
170
YFramework
include
YSLib
Service
ydraw.h
生成于 2013年 四月 24日 星期三 18:41:28 , 为 YSTest使用
1.8.2