Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
acdeb13a
提交
acdeb13a
authored
2月 23, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SQL railroad diagrams: improved images for people with black background settings.
上级
41519da0
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
34 行增加
和
21 行删除
+34
-21
RailroadImages.java
h2/src/tools/org/h2/build/doc/RailroadImages.java
+34
-21
没有找到文件。
h2/src/tools/org/h2/build/doc/RailroadImages.java
浏览文件 @
acdeb13a
...
@@ -20,10 +20,10 @@ import javax.imageio.ImageIO;
...
@@ -20,10 +20,10 @@ import javax.imageio.ImageIO;
*/
*/
public
class
RailroadImages
{
public
class
RailroadImages
{
private
static
final
int
SIZE
=
64
;
private
static
final
int
SIZE
=
128
;
private
static
final
int
LINE_REPEAT
=
32
;
private
static
final
int
LINE_REPEAT
=
32
;
private
static
final
int
DIV
=
4
;
private
static
final
int
DIV
=
8
;
private
static
final
int
STROKE
=
4
;
private
static
final
int
STROKE
=
16
;
private
String
outDir
;
private
String
outDir
;
...
@@ -49,40 +49,53 @@ public class RailroadImages {
...
@@ -49,40 +49,53 @@ public class RailroadImages {
Graphics2D
g
;
Graphics2D
g
;
img
=
new
BufferedImage
(
SIZE
,
SIZE
,
BufferedImage
.
TYPE_INT_ARGB
);
img
=
new
BufferedImage
(
SIZE
,
SIZE
,
BufferedImage
.
TYPE_INT_ARGB
);
g
=
img
.
createGraphics
();
g
=
img
.
createGraphics
();
g
.
setColor
(
Color
.
BLACK
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
g
.
setStroke
(
new
BasicStroke
(
STROKE
)
);
setStroke
(
g
,
i
);
g
.
drawLine
(
0
,
SIZE
/
2
,
SIZE
,
SIZE
/
2
);
g
.
drawLine
(
0
,
SIZE
/
2
,
SIZE
,
SIZE
/
2
);
}
g
.
dispose
();
g
.
dispose
();
savePng
(
img
,
"div-d.png"
);
savePng
(
img
,
"div-d.png"
);
img
=
new
BufferedImage
(
SIZE
,
SIZE
*
LINE_REPEAT
,
BufferedImage
.
TYPE_INT_ARGB
);
img
=
new
BufferedImage
(
SIZE
,
SIZE
*
LINE_REPEAT
,
BufferedImage
.
TYPE_INT_ARGB
);
g
=
img
.
createGraphics
();
g
=
img
.
createGraphics
();
g
.
setColor
(
Color
.
BLACK
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
g
.
setStroke
(
new
BasicStroke
(
STROKE
)
);
setStroke
(
g
,
i
);
g
.
drawLine
(
0
,
SIZE
/
2
,
SIZE
,
SIZE
/
2
);
g
.
drawLine
(
0
,
SIZE
/
2
,
SIZE
,
SIZE
/
2
);
g
.
drawLine
(
SIZE
/
2
,
SIZE
,
SIZE
/
2
,
SIZE
*
LINE_REPEAT
);
g
.
drawLine
(
SIZE
/
2
,
SIZE
,
SIZE
/
2
,
SIZE
*
LINE_REPEAT
);
// g.drawLine(0, SIZE / 2, SIZE / 2, SIZE);
// g.drawLine(0, SIZE / 2, SIZE / 2, SIZE);
g
.
drawArc
(-
SIZE
/
2
,
SIZE
/
2
,
SIZE
,
SIZE
,
0
,
90
);
g
.
drawArc
(-
SIZE
/
2
,
SIZE
/
2
,
SIZE
,
SIZE
,
0
,
90
);
}
g
.
dispose
();
g
.
dispose
();
savePng
(
img
,
"div-ts.png"
);
savePng
(
img
,
"div-ts.png"
);
savePng
(
flipHorizontal
(
img
),
"div-te.png"
);
savePng
(
flipHorizontal
(
img
),
"div-te.png"
);
img
=
new
BufferedImage
(
SIZE
,
SIZE
*
LINE_REPEAT
,
BufferedImage
.
TYPE_INT_ARGB
);
img
=
new
BufferedImage
(
SIZE
,
SIZE
*
LINE_REPEAT
,
BufferedImage
.
TYPE_INT_ARGB
);
g
=
img
.
createGraphics
();
g
=
img
.
createGraphics
();
g
.
setColor
(
Color
.
BLACK
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
g
.
setStroke
(
new
BasicStroke
(
STROKE
));
setStroke
(
g
,
i
);
g
.
drawArc
(
SIZE
/
2
,
-
SIZE
/
2
,
SIZE
,
SIZE
,
180
,
270
);
g
.
drawArc
(
SIZE
/
2
,
-
SIZE
/
2
,
SIZE
,
SIZE
,
180
,
270
);
// g.drawLine(SIZE / 2, 0, SIZE, SIZE / 2);
// g.drawLine(SIZE / 2, 0, SIZE, SIZE / 2);
}
savePng
(
img
,
"div-ls.png"
);
savePng
(
img
,
"div-ls.png"
);
savePng
(
flipHorizontal
(
img
),
"div-le.png"
);
savePng
(
flipHorizontal
(
img
),
"div-le.png"
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
setStroke
(
g
,
i
);
g
.
drawArc
(
SIZE
/
2
,
-
SIZE
/
2
,
SIZE
,
SIZE
,
180
,
270
);
g
.
drawLine
(
SIZE
/
2
,
0
,
SIZE
/
2
,
SIZE
*
LINE_REPEAT
);
g
.
drawLine
(
SIZE
/
2
,
0
,
SIZE
/
2
,
SIZE
*
LINE_REPEAT
);
}
g
.
dispose
();
g
.
dispose
();
savePng
(
img
,
"div-ks.png"
);
savePng
(
img
,
"div-ks.png"
);
savePng
(
flipHorizontal
(
img
),
"div-ke.png"
);
savePng
(
flipHorizontal
(
img
),
"div-ke.png"
);
}
}
private
void
setStroke
(
Graphics2D
g
,
int
i
)
{
if
(
i
==
0
)
{
g
.
setColor
(
Color
.
WHITE
);
g
.
setStroke
(
new
BasicStroke
(
STROKE
*
2
));
}
else
{
g
.
setColor
(
Color
.
BLACK
);
g
.
setStroke
(
new
BasicStroke
(
STROKE
));
}
}
private
void
savePng
(
BufferedImage
img
,
String
fileName
)
{
private
void
savePng
(
BufferedImage
img
,
String
fileName
)
{
int
w
=
img
.
getWidth
();
int
w
=
img
.
getWidth
();
int
h
=
img
.
getHeight
();
int
h
=
img
.
getHeight
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论