Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
387f3bf4
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
387f3bf4
编写于
4月 09, 2008
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6683472: Incorrect handling of translation component of font transform.
Reviewed-by: igor, campbell
上级
537e65c5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
90 addition
and
2 deletion
+90
-2
src/share/classes/sun/font/AttributeValues.java
src/share/classes/sun/font/AttributeValues.java
+2
-2
test/java/awt/Graphics2D/DrawString/RotTransText.java
test/java/awt/Graphics2D/DrawString/RotTransText.java
+88
-0
未找到文件。
src/share/classes/sun/font/AttributeValues.java
浏览文件 @
387f3bf4
...
...
@@ -887,10 +887,10 @@ public final class AttributeValues implements Cloneable {
try
{
AffineTransform
rtxi
=
rtx
.
createInverse
();
double
dx
=
tx
.
getTranslateX
();
double
dy
=
tx
.
getTranslateY
();
tx
.
preConcatenate
(
rtxi
);
if
(
andTranslation
)
{
double
dx
=
tx
.
getTranslateX
();
double
dy
=
tx
.
getTranslateY
();
if
(
dx
!=
0
||
dy
!=
0
)
{
tx
.
setTransform
(
tx
.
getScaleX
(),
tx
.
getShearY
(),
tx
.
getShearX
(),
tx
.
getScaleY
(),
0
,
0
);
...
...
test/java/awt/Graphics2D/DrawString/RotTransText.java
0 → 100644
浏览文件 @
387f3bf4
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 6683472
* @summary Transformed fonts using drawString and TextLayout should be in
* the same position.
*/
import
java.awt.*
;
import
java.awt.font.*
;
import
java.awt.geom.*
;
import
java.awt.image.*
;
import
java.util.HashMap
;
public
class
RotTransText
{
public
static
void
main
(
String
[]
args
)
{
int
wid
=
400
,
hgt
=
400
;
BufferedImage
bi
=
new
BufferedImage
(
wid
,
hgt
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics2D
g2d
=
bi
.
createGraphics
();
g2d
.
setColor
(
Color
.
white
);
g2d
.
fillRect
(
0
,
0
,
wid
,
hgt
);
int
x
=
130
,
y
=
130
;
String
s
=
"Text"
;
int
xt
=
90
,
yt
=
50
;
for
(
int
angle
=
0
;
angle
<
360
;
angle
+=
30
)
{
AffineTransform
aff
=
AffineTransform
.
getTranslateInstance
(
50
,
90
);
aff
.
rotate
(
angle
*
Math
.
PI
/
180.0
);
Font
fnt
=
new
Font
(
"SansSerif"
,
Font
.
PLAIN
,
60
);
fnt
=
fnt
.
deriveFont
(
Font
.
PLAIN
,
aff
);
g2d
.
setFont
(
fnt
);
g2d
.
setColor
(
Color
.
blue
);
g2d
.
drawString
(
s
,
x
,
y
);
g2d
.
setColor
(
Color
.
red
);
FontRenderContext
frc
=
g2d
.
getFontRenderContext
();
HashMap
attrMap
=
new
HashMap
();
attrMap
.
put
(
TextAttribute
.
STRIKETHROUGH
,
TextAttribute
.
STRIKETHROUGH_ON
);
fnt
=
fnt
.
deriveFont
(
attrMap
);
TextLayout
tl
=
new
TextLayout
(
s
,
fnt
,
frc
);
tl
.
draw
(
g2d
,
(
float
)
x
,
(
float
)
y
);
}
// Test BI: should be no blue: only red and white.
int
red
=
Color
.
red
.
getRGB
();
int
blue
=
Color
.
blue
.
getRGB
();
int
white
=
Color
.
white
.
getRGB
();
for
(
int
px
=
0
;
px
<
wid
;
px
++)
{
for
(
int
py
=
0
;
py
<
hgt
;
py
++)
{
int
rgb
=
bi
.
getRGB
(
px
,
py
);
if
(
rgb
==
blue
||
(
rgb
!=
red
&&
rgb
!=
white
))
{
throw
new
RuntimeException
(
"Unexpected color : "
+
Integer
.
toHexString
(
rgb
)
+
" at x="
+
x
+
" y="
+
y
);
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录