Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
3449815b
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3449815b
编写于
9月 26, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 26, 2021
浏览文件
操作
浏览文件
下载
差异文件
!380 支持硬件级别三维变换
Merge pull request !380 from JayLeeHW/master
上级
17aca158
d1dc3aee
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
325 addition
and
67 deletion
+325
-67
frameworks/components/root_view.cpp
frameworks/components/root_view.cpp
+8
-1
frameworks/components/ui_image_view.cpp
frameworks/components/ui_image_view.cpp
+8
-8
frameworks/components/ui_view.cpp
frameworks/components/ui_view.cpp
+90
-29
frameworks/draw/draw_utils.cpp
frameworks/draw/draw_utils.cpp
+164
-18
frameworks/draw/draw_utils.h
frameworks/draw/draw_utils.h
+10
-6
interfaces/kits/components/ui_image_view.h
interfaces/kits/components/ui_image_view.h
+3
-3
interfaces/kits/components/ui_view.h
interfaces/kits/components/ui_view.h
+42
-2
未找到文件。
frameworks/components/root_view.cpp
浏览文件 @
3449815b
...
@@ -505,7 +505,6 @@ void RootView::BlitMapBuffer(Rect& curViewRect, TransformMap& transMap, const Re
...
@@ -505,7 +505,6 @@ void RootView::BlitMapBuffer(Rect& curViewRect, TransformMap& transMap, const Re
Rect
invalidRect
=
curViewRect
;
Rect
invalidRect
=
curViewRect
;
transMap
.
SetTransMapRect
(
curViewRect
);
transMap
.
SetTransMapRect
(
curViewRect
);
invalidRect
.
Join
(
invalidRect
,
transMap
.
GetBoxRect
());
invalidRect
.
Join
(
invalidRect
,
transMap
.
GetBoxRect
());
if
(
invalidRect
.
Intersect
(
invalidRect
,
invalidatedArea
))
{
if
(
invalidRect
.
Intersect
(
invalidRect
,
invalidatedArea
))
{
uint8_t
pxSize
=
DrawUtils
::
GetPxSizeByColorMode
(
dc_
.
mapBufferInfo
->
mode
);
uint8_t
pxSize
=
DrawUtils
::
GetPxSizeByColorMode
(
dc_
.
mapBufferInfo
->
mode
);
ImageInfo
imageInfo
;
ImageInfo
imageInfo
;
...
@@ -706,6 +705,14 @@ UIView* RootView::GetTopUIView(const Rect& rect)
...
@@ -706,6 +705,14 @@ UIView* RootView::GetTopUIView(const Rect& rect)
currentView
=
(
g_viewStack
[
stackCount
])
->
GetNextSibling
();
currentView
=
(
g_viewStack
[
stackCount
])
->
GetNextSibling
();
}
}
}
}
UIView
*
parentView
=
topView
;
while
(
parentView
->
GetParent
()
!=
nullptr
)
{
UIView
*
tempView
=
parentView
;
parentView
=
parentView
->
GetParent
();
if
(
!
tempView
->
IsTransInvalid
())
{
topView
=
parentView
;
}
}
return
topView
;
return
topView
;
}
}
...
...
frameworks/components/ui_image_view.cpp
浏览文件 @
3449815b
...
@@ -266,7 +266,7 @@ void UIImageView::SetResizeMode(ImageResizeMode mode)
...
@@ -266,7 +266,7 @@ void UIImageView::SetResizeMode(ImageResizeMode mode)
}
}
}
}
void
UIImageView
::
AdjustScaleAndTranslate
(
Vector
2
<
float
>&
scale
,
Vector2
<
int16_t
>&
translate
,
void
UIImageView
::
AdjustScaleAndTranslate
(
Vector
3
<
float
>&
scale
,
Vector3
<
int16_t
>&
translate
,
int16_t
widgetWidth
,
int16_t
widgetHeight
)
const
int16_t
widgetWidth
,
int16_t
widgetHeight
)
const
{
{
// adjust scale
// adjust scale
...
@@ -314,7 +314,7 @@ void UIImageView::UpdateContentMatrix()
...
@@ -314,7 +314,7 @@ void UIImageView::UpdateContentMatrix()
return
;
return
;
}
}
if
(
contentMatrix_
==
nullptr
)
{
if
(
contentMatrix_
==
nullptr
)
{
contentMatrix_
=
new
Matrix
3
<
float
>
();
contentMatrix_
=
new
Matrix
4
<
float
>
();
if
(
contentMatrix_
==
nullptr
)
{
if
(
contentMatrix_
==
nullptr
)
{
GRAPHIC_LOGE
(
"can not new contentMatrix"
);
GRAPHIC_LOGE
(
"can not new contentMatrix"
);
return
;
return
;
...
@@ -327,13 +327,13 @@ void UIImageView::UpdateContentMatrix()
...
@@ -327,13 +327,13 @@ void UIImageView::UpdateContentMatrix()
float
scaleX
=
static_cast
<
float
>
(
widgetWidth
)
/
static_cast
<
float
>
(
imageWidth_
);
float
scaleX
=
static_cast
<
float
>
(
widgetWidth
)
/
static_cast
<
float
>
(
imageWidth_
);
float
scaleY
=
static_cast
<
float
>
(
widgetHeight
)
/
static_cast
<
float
>
(
imageHeight_
);
float
scaleY
=
static_cast
<
float
>
(
widgetHeight
)
/
static_cast
<
float
>
(
imageHeight_
);
Vector
2
<
float
>
scale
(
scaleX
,
scaleY
);
Vector
3
<
float
>
scale
(
scaleX
,
scaleY
,
1.0
f
);
Vector
2
<
int16_t
>
translate
(
style_
->
paddingLeft_
+
style_
->
borderWidth_
,
Vector
3
<
int16_t
>
translate
(
style_
->
paddingLeft_
+
style_
->
borderWidth_
,
style_
->
paddingTop_
+
style_
->
borderWidth_
);
style_
->
paddingTop_
+
style_
->
borderWidth_
,
0
);
AdjustScaleAndTranslate
(
scale
,
translate
,
widgetWidth
,
widgetHeight
);
AdjustScaleAndTranslate
(
scale
,
translate
,
widgetWidth
,
widgetHeight
);
auto
scaleMatrix
=
Matrix
3
<
float
>::
Scale
(
scale
,
Vector2
<
float
>
(
viewRect
.
GetX
(),
viewRect
.
GetY
()
));
auto
scaleMatrix
=
Matrix
4
<
float
>::
Scale
(
scale
,
Vector3
<
float
>
(
viewRect
.
GetX
(),
viewRect
.
GetY
(),
0
));
auto
translateMatrix
=
Matrix
3
<
float
>::
Translate
(
Vector2
<
float
>
(
translate
.
x_
,
translate
.
y_
));
auto
translateMatrix
=
Matrix
4
<
float
>::
Translate
(
Vector3
<
float
>
(
translate
.
x_
,
translate
.
y_
,
0
));
*
contentMatrix_
=
translateMatrix
*
scaleMatrix
;
*
contentMatrix_
=
translateMatrix
*
scaleMatrix
;
}
}
...
@@ -382,7 +382,7 @@ void UIImageView::UpdateDrawTransMap(bool updateContentMatrix)
...
@@ -382,7 +382,7 @@ void UIImageView::UpdateDrawTransMap(bool updateContentMatrix)
}
}
// merge the transMap and content matrix
// merge the transMap and content matrix
auto
rect
=
transMap_
->
GetTransMapRect
();
auto
rect
=
transMap_
->
GetTransMapRect
();
auto
translate
=
Matrix
3
<
float
>::
Translate
(
Vector2
<
float
>
(
-
rect
.
GetX
(),
-
rect
.
GetY
()
));
auto
translate
=
Matrix
4
<
float
>::
Translate
(
Vector3
<
float
>
(
-
rect
.
GetX
(),
-
rect
.
GetY
(),
0
));
auto
matrix
=
transMap_
->
GetTransformMatrix
()
*
translate
;
auto
matrix
=
transMap_
->
GetTransformMatrix
()
*
translate
;
matrix
=
matrix
*
(
*
contentMatrix_
);
matrix
=
matrix
*
(
*
contentMatrix_
);
drawTransMap_
->
SetMatrix
(
matrix
);
drawTransMap_
->
SetMatrix
(
matrix
);
...
...
frameworks/components/ui_view.cpp
浏览文件 @
3449815b
...
@@ -245,32 +245,43 @@ void UIView::UpdateRectInfo(uint8_t key, const Rect& rect)
...
@@ -245,32 +245,43 @@ void UIView::UpdateRectInfo(uint8_t key, const Rect& rect)
}
}
void
UIView
::
Rotate
(
int16_t
angle
,
const
Vector2
<
float
>&
pivot
)
void
UIView
::
Rotate
(
int16_t
angle
,
const
Vector2
<
float
>&
pivot
)
{
Vector3
<
float
>
pivotStart3D
=
Vector3
<
float
>
(
pivot
.
x_
,
pivot
.
y_
,
0
);
Vector3
<
float
>
pivotEnd3D
=
Vector3
<
float
>
(
pivot
.
x_
,
pivot
.
y_
,
1.0
f
);
Rotate
(
angle
,
pivotStart3D
,
pivotEnd3D
);
}
void
UIView
::
Rotate
(
int16_t
angle
,
const
Vector3
<
float
>&
pivotStart
,
const
Vector3
<
float
>&
pivotEnd
)
{
{
if
(
transMap_
==
nullptr
)
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
ReMeasure
();
transMap_
=
new
TransformMap
();
transMap_
=
new
TransformMap
();
if
(
transMap_
==
nullptr
)
{
GRAPHIC_LOGE
(
"new TransformMap fail"
);
return
;
}
}
}
bool
firstTrans
=
transMap_
->
IsInvalid
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
Rotate
(
angle
,
pivot
);
transMap_
->
Rotate
(
angle
,
pivotStart
,
pivotEnd
);
if
(
firstTrans
)
{
joinRect
=
transMap_
->
GetBoxRect
();
}
else
{
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
}
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
InvalidateRect
(
joinRect
);
InvalidateRect
(
joinRect
);
}
}
void
UIView
::
Scale
(
const
Vector2
<
float
>&
scale
,
const
Vector2
<
float
>&
pivot
)
void
UIView
::
Scale
(
const
Vector2
<
float
>&
scale
,
const
Vector2
<
float
>&
pivot
)
{
Vector3
<
float
>
scale3D
=
Vector3
<
float
>
(
scale
.
x_
,
scale
.
y_
,
1.0
f
);
Vector3
<
float
>
pivot3D
=
Vector3
<
float
>
(
scale
.
x_
,
scale
.
y_
,
0
);
Scale
(
scale3D
,
pivot3D
);
}
void
UIView
::
Scale
(
const
Vector3
<
float
>&
scale
,
const
Vector3
<
float
>&
pivot
)
{
{
if
(
transMap_
==
nullptr
)
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
ReMeasure
();
transMap_
=
new
TransformMap
();
transMap_
=
new
TransformMap
();
if
(
transMap_
==
nullptr
)
{
GRAPHIC_LOGE
(
"new TransformMap fail"
);
return
;
}
}
}
bool
firstTrans
=
transMap_
->
IsInvalid
();
bool
firstTrans
=
transMap_
->
IsInvalid
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
...
@@ -285,23 +296,47 @@ void UIView::Scale(const Vector2<float>& scale, const Vector2<float>& pivot)
...
@@ -285,23 +296,47 @@ void UIView::Scale(const Vector2<float>& scale, const Vector2<float>& pivot)
InvalidateRect
(
joinRect
);
InvalidateRect
(
joinRect
);
}
}
void
UIView
::
Translate
(
const
Vector2
<
int16_t
>&
trans
)
void
UIView
::
Shear
(
const
Vector2
<
float
>&
shearX
,
const
Vector2
<
float
>&
shearY
,
const
Vector2
<
float
>&
shearZ
)
{
{
if
(
transMap_
==
nullptr
)
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
ReMeasure
();
transMap_
=
new
TransformMap
(
GetOrigRect
());
transMap_
=
new
TransformMap
();
if
(
transMap_
==
nullptr
)
{
GRAPHIC_LOGE
(
"new TransformMap fail"
);
return
;
}
}
bool
firstTrans
=
transMap_
->
IsInvalid
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
Shear
(
shearX
,
shearY
,
shearZ
);
if
(
firstTrans
)
{
joinRect
=
transMap_
->
GetBoxRect
();
}
else
{
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
}
}
transMap_
->
Translate
(
trans
);
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
InvalidateRect
(
joinRect
);
}
Rect
prevRect
=
GetRect
();
void
UIView
::
Translate
(
const
Vector2
<
int16_t
>&
trans
)
Rect
mapRect
=
transMap_
->
GetBoxRect
();
{
Vector3
<
int16_t
>
trans3D
=
Vector3
<
int16_t
>
(
trans
.
x_
,
trans
.
y_
,
0
);
Translate
(
trans3D
);
}
Rect
joinRect
;
void
UIView
::
Translate
(
const
Vector3
<
int16_t
>&
trans
)
joinRect
.
Join
(
prevRect
,
mapRect
);
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
transMap_
=
new
TransformMap
();
}
bool
firstTrans
=
transMap_
->
IsInvalid
();
Rect
joinRect
=
transMap_
->
GetBoxRect
();
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
Translate
(
trans
);
if
(
firstTrans
)
{
joinRect
=
transMap_
->
GetBoxRect
();
}
else
{
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
}
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
InvalidateRect
(
joinRect
);
InvalidateRect
(
joinRect
);
}
}
...
@@ -313,6 +348,34 @@ bool UIView::IsTransInvalid()
...
@@ -313,6 +348,34 @@ bool UIView::IsTransInvalid()
return
transMap_
->
IsInvalid
();
return
transMap_
->
IsInvalid
();
}
}
void
UIView
::
SetCameraDistance
(
int16_t
distance
)
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
transMap_
=
new
TransformMap
();
}
Rect
joinRect
=
transMap_
->
GetBoxRect
();
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
SetCameraDistance
(
distance
);
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
InvalidateRect
(
joinRect
);
}
void
UIView
::
SetCameraPosition
(
const
Vector2
<
float
>&
position
)
{
if
(
transMap_
==
nullptr
)
{
ReMeasure
();
transMap_
=
new
TransformMap
();
}
Rect
joinRect
=
transMap_
->
GetBoxRect
();
transMap_
->
SetTransMapRect
(
GetOrigRect
());
transMap_
->
SetCameraPosition
(
position
);
joinRect
.
Join
(
joinRect
,
transMap_
->
GetBoxRect
());
joinRect
.
Join
(
joinRect
,
GetOrigRect
());
InvalidateRect
(
joinRect
);
}
void
UIView
::
ResetTransParameter
()
void
UIView
::
ResetTransParameter
()
{
{
if
(
transMap_
!=
nullptr
)
{
if
(
transMap_
!=
nullptr
)
{
...
@@ -614,19 +677,16 @@ void UIView::SetTransformMap(const TransformMap& transMap)
...
@@ -614,19 +677,16 @@ void UIView::SetTransformMap(const TransformMap& transMap)
return
;
return
;
}
}
Rect
prevRect
=
GetRect
();
Rect
mapRect
=
transMap
.
GetBoxRect
();
Rect
joinRect
;
joinRect
.
Join
(
prevRect
,
mapRect
);
InvalidateRect
(
joinRect
);
if
(
transMap_
==
nullptr
)
{
if
(
transMap_
==
nullptr
)
{
transMap_
=
new
TransformMap
();
transMap_
=
new
TransformMap
();
}
}
*
transMap_
=
transMap
;
*
transMap_
=
transMap
;
transMap_
->
SetTransMapRect
(
GetOrigRect
());
Rect
joinRect
;
joinRect
.
Join
(
GetRect
(),
transMap_
->
GetBoxRect
());
InvalidateRect
(
joinRect
);
}
}
void
UIView
::
SetWidthPercent
(
float
widthPercent
)
void
UIView
::
SetWidthPercent
(
float
widthPercent
)
...
@@ -731,6 +791,7 @@ void UIView::LayoutCenterOfParent(int16_t xOffset, int16_t yOffset)
...
@@ -731,6 +791,7 @@ void UIView::LayoutCenterOfParent(int16_t xOffset, int16_t yOffset)
int16_t
bottomMargin
=
style_
->
marginBottom_
;
int16_t
bottomMargin
=
style_
->
marginBottom_
;
// 2: half
// 2: half
int16_t
posX
=
parent_
->
GetWidth
()
/
2
-
(
rect_
.
GetWidth
()
-
leftMargin
+
rightMargin
)
/
2
+
xOffset
;
int16_t
posX
=
parent_
->
GetWidth
()
/
2
-
(
rect_
.
GetWidth
()
-
leftMargin
+
rightMargin
)
/
2
+
xOffset
;
// 2: half
int16_t
posY
=
parent_
->
GetHeight
()
/
2
-
(
rect_
.
GetHeight
()
-
topMargin
+
bottomMargin
)
/
2
+
yOffset
;
int16_t
posY
=
parent_
->
GetHeight
()
/
2
-
(
rect_
.
GetHeight
()
-
topMargin
+
bottomMargin
)
/
2
+
yOffset
;
SetPosition
(
posX
,
posY
);
SetPosition
(
posX
,
posY
);
}
}
...
...
frameworks/draw/draw_utils.cpp
浏览文件 @
3449815b
...
@@ -1132,10 +1132,10 @@ static void DrawFixedTriangleTrueColorBilinear8888Inner(const TriangleScanInfo&
...
@@ -1132,10 +1132,10 @@ static void DrawFixedTriangleTrueColorBilinear8888Inner(const TriangleScanInfo&
#endif
#endif
Color32
result
;
Color32
result
;
result
.
red
=
static_cast
<
uint8_t
>
(
outR
>>
15
);
// 15: shift 15 bit right to convert fixed to int
result
.
red
=
static_cast
<
uint8_t
>
(
outR
>>
FIXED_Q_NUM
);
result
.
green
=
static_cast
<
uint8_t
>
(
outG
>>
15
);
// 15: shift 15 bit right to convert fixed to int
result
.
green
=
static_cast
<
uint8_t
>
(
outG
>>
FIXED_Q_NUM
);
result
.
blue
=
static_cast
<
uint8_t
>
(
outB
>>
15
);
// 15: shift 15 bit right to convert fixed to int
result
.
blue
=
static_cast
<
uint8_t
>
(
outB
>>
FIXED_Q_NUM
);
result
.
alpha
=
static_cast
<
uint8_t
>
(
outA
>>
15
);
// 15: shift 15 bit right to convert fixed to int
result
.
alpha
=
static_cast
<
uint8_t
>
(
outA
>>
FIXED_Q_NUM
);
if
((
in
.
opaScale
==
OPA_OPAQUE
)
&&
(
result
.
alpha
==
OPA_OPAQUE
))
{
if
((
in
.
opaScale
==
OPA_OPAQUE
)
&&
(
result
.
alpha
==
OPA_OPAQUE
))
{
COLOR_FILL_COVER
(
screenBuffer
,
bufferMode
,
result
.
red
,
result
.
green
,
result
.
blue
,
ARGB8888
);
COLOR_FILL_COVER
(
screenBuffer
,
bufferMode
,
result
.
red
,
result
.
green
,
result
.
blue
,
ARGB8888
);
}
else
{
}
else
{
...
@@ -1282,6 +1282,144 @@ static void DrawTriangleTrueColorBilinear8888InnerNeon(const TriangleScanInfo& i
...
@@ -1282,6 +1282,144 @@ static void DrawTriangleTrueColorBilinear8888InnerNeon(const TriangleScanInfo& i
}
}
#endif
#endif
void
DrawUtils
::
Draw3DTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
in
,
const
ColorMode
bufferMode
)
{
int16_t
maskLeft
=
in
.
mask
.
GetLeft
();
int16_t
maskRight
=
in
.
mask
.
GetRight
();
int16_t
xMinErr
=
0
;
int16_t
xMaxErr
=
0
;
GetXAxisErrForJunctionLine
(
in
.
ignoreJunctionPoint
,
in
.
isRightPart
,
xMinErr
,
xMaxErr
);
#if ENABLE_FIXED_POINT
int64_t
invMatrix00
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
0
]);
int64_t
invMatrix01
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
1
]);
int64_t
invMatrix02
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
2
]);
int64_t
invMatrix20
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
3
]);
int64_t
invMatrix21
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
4
]);
int64_t
invMatrix22
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
5
]);
int64_t
invMatrix30
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
6
]);
int64_t
invMatrix31
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
7
]);
int64_t
invMatrix32
=
FO_TRANS_FLOAT_TO_FIXED
(
in
.
matrix
.
GetData
()[
8
]);
#else // ENABLE_FIXED_POINT
float
invMatrix00
=
in
.
matrix
.
GetData
()[
0
];
float
invMatrix01
=
in
.
matrix
.
GetData
()[
1
];
float
invMatrix02
=
in
.
matrix
.
GetData
()[
2
];
float
invMatrix20
=
in
.
matrix
.
GetData
()[
3
];
float
invMatrix21
=
in
.
matrix
.
GetData
()[
4
];
float
invMatrix22
=
in
.
matrix
.
GetData
()[
5
];
float
invMatrix30
=
in
.
matrix
.
GetData
()[
6
];
float
invMatrix31
=
in
.
matrix
.
GetData
()[
7
];
float
invMatrix32
=
in
.
matrix
.
GetData
()[
8
];
#endif // ENABLE_FIXED_POINT
for
(
int16_t
y
=
in
.
yMin
;
y
<=
in
.
yMax
;
++
y
)
{
#if ENABLE_FIXED_POINT
int16_t
tempV
=
FO_TO_INTEGER
(
in
.
edge1
.
curX
)
+
xMinErr
;
int16_t
xMin
=
MATH_MAX
(
tempV
,
maskLeft
);
tempV
=
FO_TO_INTEGER
(
in
.
edge2
.
curX
)
+
xMaxErr
;
int16_t
xMax
=
MATH_MIN
(
tempV
,
maskRight
);
#else // ENABLE_FIXED_POINT
int16_t
xMin
=
MATH_MAX
(
static_cast
<
int16_t
>
(
in
.
edge1
.
curX
+
xMinErr
),
maskLeft
);
int16_t
xMax
=
MATH_MIN
(
static_cast
<
int16_t
>
(
in
.
edge2
.
curX
+
xMaxErr
),
maskRight
);
#endif // ENABLE_FIXED_POINT
// move to current position
uint8_t
*
screenBuffer
=
in
.
screenBuffer
+
(
y
*
in
.
screenBufferWidth
+
xMin
)
*
in
.
bufferPxSize
;
for
(
int16_t
x
=
xMin
;
x
<=
xMax
;
x
++
)
{
#if ENABLE_FIXED_POINT
int64_t
w
=
invMatrix02
*
x
+
invMatrix22
*
y
+
invMatrix32
;
int64_t
u
=
FO_DIV
((
invMatrix00
*
x
+
invMatrix20
*
y
+
invMatrix30
),
w
);
int64_t
v
=
FO_DIV
((
invMatrix01
*
x
+
invMatrix21
*
y
+
invMatrix31
),
w
);
int16_t
intU
=
FO_TO_INTEGER
(
u
);
int16_t
intV
=
FO_TO_INTEGER
(
v
);
#else // ENABLE_FIXED_POINT
float
w
=
invMatrix02
*
x
+
invMatrix22
*
y
+
invMatrix32
;
float
u
=
(
invMatrix00
*
x
+
invMatrix20
*
y
+
invMatrix30
)
/
w
;
float
v
=
(
invMatrix01
*
x
+
invMatrix21
*
y
+
invMatrix31
)
/
w
;
int16_t
intU
=
static_cast
<
int16_t
>
(
u
);
int16_t
intV
=
static_cast
<
int16_t
>
(
v
);
#endif // ENABLE_FIXED_POINT
if
((
u
>=
0
)
&&
(
intU
<
in
.
info
.
header
.
width
-
1
)
&&
(
v
>=
0
)
&&
(
intV
<
in
.
info
.
header
.
height
-
1
))
{
#if ENABLE_ARM_MATH
uint32_t
val1
=
__SMUAD
(
intV
,
in
.
srcLineWidth
);
uint32_t
val2
=
__SMUAD
(
intU
,
in
.
pixelSize
);
uint32_t
px1
=
val1
+
val2
;
#else // ENABLE_ARM_MATH
uint32_t
px1
=
intV
*
in
.
srcLineWidth
+
intU
*
in
.
pixelSize
;
#endif // ENABLE_ARM_MATH
uint8_t
*
imgHead
=
const_cast
<
uint8_t
*>
(
in
.
info
.
data
);
const
ColorType
p1
=
*
(
reinterpret_cast
<
ColorType
*>
(
&
imgHead
[
px1
]));
const
ColorType
p2
=
*
(
reinterpret_cast
<
ColorType
*>
(
&
imgHead
[
px1
+
in
.
pixelSize
]));
const
ColorType
p3
=
*
(
reinterpret_cast
<
ColorType
*>
(
&
imgHead
[
px1
+
in
.
srcLineWidth
]));
const
ColorType
p4
=
*
(
reinterpret_cast
<
ColorType
*>
(
&
imgHead
[
px1
+
in
.
srcLineWidth
+
in
.
pixelSize
]));
#if ENABLE_FIXED_POINT
int64_t
decU
=
FO_DECIMAL
(
u
);
int64_t
decV
=
FO_DECIMAL
(
v
);
int64_t
decUMinus1
=
FIXED_NUM_1
-
decU
;
int64_t
decVMinus1
=
FIXED_NUM_1
-
decV
;
int64_t
w1
=
FO_MUL
(
decUMinus1
,
decVMinus1
);
int64_t
w2
=
FO_MUL
(
decU
,
decVMinus1
);
int64_t
w3
=
FO_MUL
(
decUMinus1
,
decV
);
int64_t
w4
=
FO_MUL
(
decU
,
decV
);
#if ENABLE_ARM_MATH
const
int64_t
outR
=
__SMUAD
(
p1
.
red
,
w1
)
+
__SMUAD
(
p2
.
red
,
w2
)
+
__SMUAD
(
p3
.
red
,
w3
)
+
__SMUAD
(
p4
.
red
,
w4
);
const
int64_t
outG
=
__SMUAD
(
p1
.
green
,
w1
)
+
__SMUAD
(
p2
.
green
,
w2
)
+
__SMUAD
(
p3
.
green
,
w3
)
+
__SMUAD
(
p4
.
green
,
w4
);
const
int64_t
outB
=
__SMUAD
(
p1
.
blue
,
w1
)
+
__SMUAD
(
p2
.
blue
,
w2
)
+
__SMUAD
(
p3
.
blue
,
w3
)
+
__SMUAD
(
p4
.
blue
,
w4
);
const
int64_t
outA
=
__SMUAD
(
p1
.
alpha
,
w1
)
+
__SMUAD
(
p2
.
alpha
,
w2
)
+
__SMUAD
(
p3
.
alpha
,
w3
)
+
__SMUAD
(
p4
.
alpha
,
w4
);
#else
const
int64_t
outR
=
p1
.
red
*
w1
+
p2
.
red
*
w2
+
p3
.
red
*
w3
+
p4
.
red
*
w4
;
const
int64_t
outG
=
p1
.
green
*
w1
+
p2
.
green
*
w2
+
p3
.
green
*
w3
+
p4
.
green
*
w4
;
const
int64_t
outB
=
p1
.
blue
*
w1
+
p2
.
blue
*
w2
+
p3
.
blue
*
w3
+
p4
.
blue
*
w4
;
const
int64_t
outA
=
p1
.
alpha
*
w1
+
p2
.
alpha
*
w2
+
p3
.
alpha
*
w3
+
p4
.
alpha
*
w4
;
#endif
Color32
result
;
result
.
red
=
static_cast
<
uint8_t
>
(
outR
>>
FIXED_Q_NUM
);
result
.
green
=
static_cast
<
uint8_t
>
(
outG
>>
FIXED_Q_NUM
);
result
.
blue
=
static_cast
<
uint8_t
>
(
outB
>>
FIXED_Q_NUM
);
result
.
alpha
=
static_cast
<
uint8_t
>
(
outA
>>
FIXED_Q_NUM
);
#else // ENABLE_FIXED_POINT
const
float
decU
=
u
-
intU
;
const
float
decV
=
v
-
intV
;
const
float
decUMinus1
=
1
-
decU
;
const
float
decVMinus1
=
1
-
decV
;
const
int32_t
w1
=
static_cast
<
int32_t
>
(
decUMinus1
*
decVMinus1
*
256.0
f
);
// 256:shift 8 bit left
const
int32_t
w2
=
static_cast
<
int32_t
>
(
decU
*
decVMinus1
*
256.0
f
);
// 256:shift 8 bit left
const
int32_t
w3
=
static_cast
<
int32_t
>
(
decUMinus1
*
decV
*
256.0
f
);
// 256:shift 8 bit left
const
int32_t
w4
=
static_cast
<
int32_t
>
(
decU
*
decV
*
256.0
f
);
#if ENABLE_ARM_MATH
const
int32_t
outR
=
__SMUAD
(
p1
.
red
,
w1
)
+
__SMUAD
(
p2
.
red
,
w2
)
+
__SMUAD
(
p3
.
red
,
w3
)
+
__SMUAD
(
p4
.
red
,
w4
);
const
int32_t
outG
=
__SMUAD
(
p1
.
green
,
w1
)
+
__SMUAD
(
p2
.
green
,
w2
)
+
__SMUAD
(
p3
.
green
,
w3
)
+
__SMUAD
(
p4
.
green
,
w4
);
const
int32_t
outB
=
__SMUAD
(
p1
.
blue
,
w1
)
+
__SMUAD
(
p2
.
blue
,
w2
)
+
__SMUAD
(
p3
.
blue
,
w3
)
+
__SMUAD
(
p4
.
blue
,
w4
);
const
int32_t
outA
=
__SMUAD
(
p1
.
alpha
,
w1
)
+
__SMUAD
(
p2
.
alpha
,
w2
)
+
__SMUAD
(
p3
.
alpha
,
w3
)
+
__SMUAD
(
p4
.
alpha
,
w4
);
#else // ENABLE_ARM_MATH
const
int32_t
outR
=
p1
.
red
*
w1
+
p2
.
red
*
w2
+
p3
.
red
*
w3
+
p4
.
red
*
w4
;
const
int32_t
outG
=
p1
.
green
*
w1
+
p2
.
green
*
w2
+
p3
.
green
*
w3
+
p4
.
green
*
w4
;
const
int32_t
outB
=
p1
.
blue
*
w1
+
p2
.
blue
*
w2
+
p3
.
blue
*
w3
+
p4
.
blue
*
w4
;
const
int32_t
outA
=
p1
.
alpha
*
w1
+
p2
.
alpha
*
w2
+
p3
.
alpha
*
w3
+
p4
.
alpha
*
w4
;
#endif // ENABLE_ARM_MATH
Color32
result
;
result
.
red
=
static_cast
<
uint8_t
>
(
outR
>>
8
);
// 8:shift 8 bit right
result
.
green
=
static_cast
<
uint8_t
>
(
outG
>>
8
);
// 8:shift 8 bit right
result
.
blue
=
static_cast
<
uint8_t
>
(
outB
>>
8
);
// 8:shift 8 bit right
result
.
alpha
=
static_cast
<
uint8_t
>
(
outA
>>
8
);
// 8:shift 8 bit right
#endif // ENABLE_FIXED_POINT
if
((
in
.
opaScale
==
OPA_OPAQUE
)
&&
(
result
.
alpha
==
OPA_OPAQUE
))
{
COLOR_FILL_COVER
(
screenBuffer
,
bufferMode
,
result
.
red
,
result
.
green
,
result
.
blue
,
ARGB8888
);
}
else
{
COLOR_FILL_BLEND
(
screenBuffer
,
bufferMode
,
&
result
,
ARGB8888
,
in
.
opaScale
);
}
}
screenBuffer
+=
in
.
bufferPxSize
;
}
StepToNextLine
(
in
.
edge1
,
in
.
edge2
);
}
}
void
DrawUtils
::
DrawTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
in
,
const
ColorMode
bufferMode
)
void
DrawUtils
::
DrawTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
in
,
const
ColorMode
bufferMode
)
{
{
int16_t
maskLeft
=
in
.
mask
.
GetLeft
();
int16_t
maskLeft
=
in
.
mask
.
GetLeft
();
...
@@ -1490,7 +1628,11 @@ void DrawUtils::DrawTriangleTransformPart(BufferInfo& gfxDstBuffer, const Triang
...
@@ -1490,7 +1628,11 @@ void DrawUtils::DrawTriangleTransformPart(BufferInfo& gfxDstBuffer, const Triang
if
(
part
.
info
.
algorithm
==
TransformAlgorithm
::
NEAREST_NEIGHBOR
)
{
if
(
part
.
info
.
algorithm
==
TransformAlgorithm
::
NEAREST_NEIGHBOR
)
{
fuc
=
DrawTriangleTrueColorNearest
;
fuc
=
DrawTriangleTrueColorNearest
;
}
else
if
(
part
.
info
.
header
.
colorMode
==
ARGB8888
)
{
}
else
if
(
part
.
info
.
header
.
colorMode
==
ARGB8888
)
{
if
(
part
.
transMap
.
Is3DTransform
())
{
fuc
=
Draw3DTriangleTrueColorBilinear8888
;
}
else
{
fuc
=
DrawTriangleTrueColorBilinear8888
;
fuc
=
DrawTriangleTrueColorBilinear8888
;
}
}
else
if
(
part
.
info
.
header
.
colorMode
==
RGB888
)
{
}
else
if
(
part
.
info
.
header
.
colorMode
==
RGB888
)
{
fuc
=
DrawTriangleTrueColorBilinear888
;
fuc
=
DrawTriangleTrueColorBilinear888
;
}
else
{
}
else
{
...
@@ -1516,7 +1658,8 @@ void DrawUtils::DrawTriangleTransformPart(BufferInfo& gfxDstBuffer, const Triang
...
@@ -1516,7 +1658,8 @@ void DrawUtils::DrawTriangleTransformPart(BufferInfo& gfxDstBuffer, const Triang
part
.
info
,
part
.
info
,
part
.
mask
,
part
.
mask
,
part
.
isRightPart
,
part
.
isRightPart
,
part
.
ignoreJunctionPoint
};
part
.
ignoreJunctionPoint
,
part
.
transMap
.
invMatrix_
};
fuc
(
input
,
gfxDstBuffer
.
mode
);
fuc
(
input
,
gfxDstBuffer
.
mode
);
}
}
...
@@ -1644,36 +1787,39 @@ void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo)
...
@@ -1644,36 +1787,39 @@ void DrawUtils::AddBorderToImageData(TransformDataInfo& newDataInfo)
void
DrawUtils
::
UpdateTransMap
(
int16_t
width
,
int16_t
height
,
TransformMap
&
transMap
)
void
DrawUtils
::
UpdateTransMap
(
int16_t
width
,
int16_t
height
,
TransformMap
&
transMap
)
{
{
Rect
rect
=
transMap
.
GetTransMapRect
();
Rect
rect
=
transMap
.
GetTransMapRect
();
Matrix
3
<
float
>
matrix
=
transMap
.
GetTransformMatrix
();
Matrix
4
<
float
>
matrix
=
transMap
.
GetTransformMatrix
();
matrix
=
matrix
*
(
Matrix
3
<
float
>::
Translate
(
Vector2
<
float
>
(
-
rect
.
GetX
(),
-
rect
.
GetY
()
)));
matrix
=
matrix
*
(
Matrix
4
<
float
>::
Translate
(
Vector3
<
float
>
(
-
rect
.
GetX
(),
-
rect
.
GetY
(),
0
)));
int16_t
offsetX
=
(
width
-
rect
.
GetWidth
())
/
2
;
// 2 : half;
int16_t
offsetX
=
(
width
-
rect
.
GetWidth
())
/
2
;
// 2 : half;
int16_t
offsetY
=
(
height
-
rect
.
GetHeight
())
/
2
;
// 2 : half;
int16_t
offsetY
=
(
height
-
rect
.
GetHeight
())
/
2
;
// 2 : half;
rect
.
SetPosition
(
rect
.
GetX
()
-
offsetX
,
rect
.
GetY
()
-
offsetY
);
rect
.
SetPosition
(
rect
.
GetX
()
-
offsetX
,
rect
.
GetY
()
-
offsetY
);
rect
.
Resize
(
width
,
height
);
rect
.
Resize
(
width
,
height
);
Polygon
polygon
=
Polygon
(
rect
);
Polygon
polygon
=
Polygon
(
rect
);
uint8_t
vertexNum
=
transMap
.
GetPolygon
().
GetVertexNum
();
uint8_t
vertexNum
=
transMap
.
GetPolygon
().
GetVertexNum
();
Vector
3
<
float
>
imgPoint3
;
Vector
4
<
float
>
imgPoint4
;
for
(
uint8_t
i
=
0
;
i
<
vertexNum
;
i
++
)
{
for
(
uint8_t
i
=
0
;
i
<
vertexNum
;
i
++
)
{
Vector
3
<
float
>
point
(
polygon
[
i
].
x_
,
polygon
[
i
].
y_
,
1
);
Vector
4
<
float
>
point
(
polygon
[
i
].
x_
,
polygon
[
i
].
y_
,
0
,
1
);
imgPoint
3
=
matrix
*
point
;
imgPoint
4
=
matrix
*
point
;
if
(
imgPoint
3
.
x_
<
COORD_MIN
)
{
if
(
imgPoint
4
.
x_
<
COORD_MIN
)
{
polygon
[
i
].
x_
=
COORD_MIN
;
polygon
[
i
].
x_
=
COORD_MIN
;
}
else
if
(
imgPoint
3
.
x_
>
COORD_MAX
)
{
}
else
if
(
imgPoint
4
.
x_
>
COORD_MAX
)
{
polygon
[
i
].
x_
=
COORD_MAX
;
polygon
[
i
].
x_
=
COORD_MAX
;
}
else
{
}
else
{
polygon
[
i
].
x_
=
MATH_ROUND
(
imgPoint
3
.
x_
);
polygon
[
i
].
x_
=
MATH_ROUND
(
imgPoint
4
.
x_
);
}
}
if
(
imgPoint
3
.
y_
<
COORD_MIN
)
{
if
(
imgPoint
4
.
y_
<
COORD_MIN
)
{
polygon
[
i
].
y_
=
COORD_MIN
;
polygon
[
i
].
y_
=
COORD_MIN
;
}
else
if
(
imgPoint
3
.
y_
>
COORD_MAX
)
{
}
else
if
(
imgPoint
4
.
y_
>
COORD_MAX
)
{
polygon
[
i
].
y_
=
COORD_MAX
;
polygon
[
i
].
y_
=
COORD_MAX
;
}
else
{
}
else
{
polygon
[
i
].
y_
=
MATH_ROUND
(
imgPoint
3
.
y_
);
polygon
[
i
].
y_
=
MATH_ROUND
(
imgPoint
4
.
y_
);
}
}
}
}
transMap
.
SetPolygon
(
polygon
);
transMap
.
SetPolygon
(
polygon
);
transMap
.
invMatrix_
=
(
matrix
*
(
Matrix3
<
float
>::
Translate
(
Vector2
<
float
>
(
rect
.
GetX
(),
rect
.
GetY
())))).
Inverse
();
Matrix3
<
float
>
matrix3
(
matrix
[
0
][
0
],
matrix
[
0
][
1
],
matrix
[
0
][
3
],
matrix
[
1
][
0
],
matrix
[
1
][
1
],
matrix
[
1
][
3
],
matrix
[
3
][
0
],
matrix
[
3
][
1
],
matrix
[
3
][
3
]);
transMap
.
invMatrix_
=
(
matrix3
*
(
Matrix3
<
float
>::
Translate
(
Vector2
<
float
>
(
rect
.
GetX
(),
rect
.
GetY
())))).
Inverse
();
}
}
void
DrawUtils
::
DrawTransform
(
BufferInfo
&
gfxDstBuffer
,
void
DrawUtils
::
DrawTransform
(
BufferInfo
&
gfxDstBuffer
,
...
...
frameworks/draw/draw_utils.h
浏览文件 @
3449815b
...
@@ -37,13 +37,14 @@ namespace OHOS {
...
@@ -37,13 +37,14 @@ namespace OHOS {
SWAP_INT16(y1, y2);
SWAP_INT16(y1, y2);
// FixedPointed Related definition.
// FixedPointed Related definition.
#define FIXED_NUM_1 32768
#define FIXED_NUM_1 1048576
#define FIXED_Q_NUM 20
#define FO_TRANS_FLOAT_TO_FIXED(f) (static_cast<int64_t>((f) * FIXED_NUM_1))
#define FO_TRANS_FLOAT_TO_FIXED(f) (static_cast<int64_t>((f) * FIXED_NUM_1))
#define FO_TRANS_INTEGER_TO_FIXED(f) ((static_cast<int64_t>(f)) <<
15
)
#define FO_TRANS_INTEGER_TO_FIXED(f) ((static_cast<int64_t>(f)) <<
FIXED_Q_NUM
)
#define FO_DIV(n1, n2) ((static_cast<int64_t>(n1) <<
15
) / (n2))
#define FO_DIV(n1, n2) ((static_cast<int64_t>(n1) <<
FIXED_Q_NUM
) / (n2))
#define FO_TO_INTEGER(n) ((n) >= 0 ? ((n) >>
15) : (((n) >> 15
) + 1))
#define FO_TO_INTEGER(n) ((n) >= 0 ? ((n) >>
FIXED_Q_NUM) : (((n) >> FIXED_Q_NUM
) + 1))
#define FO_DECIMAL(n) ((n) >= 0 ? ((n) &
32767) : ((n) | (-32768
)))
#define FO_DECIMAL(n) ((n) >= 0 ? ((n) &
(FIXED_NUM_1 - 1)) : ((n) | (-FIXED_NUM_1
)))
#define FO_MUL(n1, n2) ((static_cast<int64_t>(n1) * (n2)) >>
15
)
#define FO_MUL(n1, n2) ((static_cast<int64_t>(n1) * (n2)) >>
FIXED_Q_NUM
)
struct
EdgeSides
{
struct
EdgeSides
{
int16_t
left
;
int16_t
left
;
...
@@ -154,6 +155,7 @@ struct TriangleScanInfo {
...
@@ -154,6 +155,7 @@ struct TriangleScanInfo {
const
Rect
&
mask
;
const
Rect
&
mask
;
bool
isRightPart
;
bool
isRightPart
;
bool
ignoreJunctionPoint
;
bool
ignoreJunctionPoint
;
Matrix3
<
float
>
matrix
;
};
};
struct
TrianglePartInfo
{
struct
TrianglePartInfo
{
...
@@ -301,6 +303,8 @@ private:
...
@@ -301,6 +303,8 @@ private:
static
void
DrawTriangleTrueColorBilinear888
(
const
TriangleScanInfo
&
triangle
,
const
ColorMode
bufferMode
);
static
void
DrawTriangleTrueColorBilinear888
(
const
TriangleScanInfo
&
triangle
,
const
ColorMode
bufferMode
);
static
void
Draw3DTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
triangle
,
const
ColorMode
bufferMode
);
static
void
DrawTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
triangle
,
const
ColorMode
bufferMode
);
static
void
DrawTriangleTrueColorBilinear8888
(
const
TriangleScanInfo
&
triangle
,
const
ColorMode
bufferMode
);
inline
static
void
StepToNextLine
(
TriangleEdge
&
edg1
,
TriangleEdge
&
edg2
);
inline
static
void
StepToNextLine
(
TriangleEdge
&
edg1
,
TriangleEdge
&
edg2
);
...
...
interfaces/kits/components/ui_image_view.h
100755 → 100644
浏览文件 @
3449815b
...
@@ -268,8 +268,6 @@ public:
...
@@ -268,8 +268,6 @@ public:
CENTER
,
CENTER
,
SCALE_DOWN
,
SCALE_DOWN
,
};
};
void
AdjustScaleAndTranslate
(
Vector2
<
float
>&
scale
,
Vector2
<
int16_t
>&
translate
,
int16_t
widgetWidth
,
int16_t
widgetHeight
)
const
;
void
SetResizeMode
(
ImageResizeMode
mode
);
void
SetResizeMode
(
ImageResizeMode
mode
);
void
SetWidth
(
int16_t
width
)
override
;
void
SetWidth
(
int16_t
width
)
override
;
void
SetHeight
(
int16_t
height
)
override
;
void
SetHeight
(
int16_t
height
)
override
;
...
@@ -307,7 +305,7 @@ protected:
...
@@ -307,7 +305,7 @@ protected:
Image
image_
;
Image
image_
;
ImageResizeMode
imageResizeMode_
=
ImageResizeMode
::
NONE
;
ImageResizeMode
imageResizeMode_
=
ImageResizeMode
::
NONE
;
TransformMap
*
drawTransMap_
=
nullptr
;
TransformMap
*
drawTransMap_
=
nullptr
;
Matrix
3
<
float
>*
contentMatrix_
=
nullptr
;
Matrix
4
<
float
>*
contentMatrix_
=
nullptr
;
bool
transMapInvalid_
=
true
;
bool
transMapInvalid_
=
true
;
private:
private:
void
ReMeasure
()
override
;
void
ReMeasure
()
override
;
...
@@ -320,6 +318,8 @@ private:
...
@@ -320,6 +318,8 @@ private:
#endif
#endif
void
UpdateContentMatrix
();
void
UpdateContentMatrix
();
void
UpdateDrawTransMap
(
bool
updateContentMatrix
=
false
);
void
UpdateDrawTransMap
(
bool
updateContentMatrix
=
false
);
void
AdjustScaleAndTranslate
(
Vector3
<
float
>&
scale
,
Vector3
<
int16_t
>&
translate
,
int16_t
widgetWidth
,
int16_t
widgetHeight
)
const
;
};
};
}
// namespace OHOS
}
// namespace OHOS
#endif // GRAPHIC_LITE_UI_IMAGE_VIEW_H
#endif // GRAPHIC_LITE_UI_IMAGE_VIEW_H
\ No newline at end of file
interfaces/kits/components/ui_view.h
浏览文件 @
3449815b
...
@@ -1516,7 +1516,7 @@ public:
...
@@ -1516,7 +1516,7 @@ public:
}
}
/**
/**
* @brief Rotates the view.
* @brief Rotates the view
in 2d
.
* @param angle Indicates the rotation angle.
* @param angle Indicates the rotation angle.
* @param pivot Indicates the coordinates of the rotation pivot.
* @param pivot Indicates the coordinates of the rotation pivot.
* @since 5.0
* @since 5.0
...
@@ -1525,7 +1525,17 @@ public:
...
@@ -1525,7 +1525,17 @@ public:
void
Rotate
(
int16_t
angle
,
const
Vector2
<
float
>&
pivot
);
void
Rotate
(
int16_t
angle
,
const
Vector2
<
float
>&
pivot
);
/**
/**
* @brief Scales the view.
* @brief Rotates the view in 3d.
* @param angle Indicates the rotation angle.
* @param pivotStart Indicates the coordinates of the rotation start pivot.
* @param pivotEnd Indicates the coordinates of the rotation end pivot.
* @since 5.0
* @version 3.0
*/
void
Rotate
(
int16_t
angle
,
const
Vector3
<
float
>&
pivotStart
,
const
Vector3
<
float
>&
pivotEnd
);
/**
* @brief Scales the view in 2d.
*
*
* @param scale Indicates the scale factor on x- and y- axes.
* @param scale Indicates the scale factor on x- and y- axes.
* @param pivot Indicates the scaling pivot.
* @param pivot Indicates the scaling pivot.
...
@@ -1534,10 +1544,40 @@ public:
...
@@ -1534,10 +1544,40 @@ public:
*/
*/
void
Scale
(
const
Vector2
<
float
>&
scale
,
const
Vector2
<
float
>&
pivot
);
void
Scale
(
const
Vector2
<
float
>&
scale
,
const
Vector2
<
float
>&
pivot
);
/**
* @brief Scales the view in 3d.
*
* @param scale Indicates the scale factor on x- and y- axes.
* @param pivot Indicates the scaling pivot.
* @since 5.0
* @version 3.0
*/
void
Scale
(
const
Vector3
<
float
>&
scale
,
const
Vector3
<
float
>&
pivot
);
/**
* @brief Shears the view in 3d.
*
* @param shearX Indicates the shear parameters around x- axes,
* which means many it shears in y and z direction(current invalid).
* @param shearY Indicates the shear parameters around y- axes,
* which means many it shears in x and z direction(current invalid).
* @param shaerZ Indicates the shear parameters around z- axes,
* which means many it shears in x and y.
* @since 5.0
* @version 3.0
*/
void
Shear
(
const
Vector2
<
float
>&
shearX
,
const
Vector2
<
float
>&
shearY
,
const
Vector2
<
float
>&
shearZ
);
void
Translate
(
const
Vector2
<
int16_t
>&
trans
);
void
Translate
(
const
Vector2
<
int16_t
>&
trans
);
void
Translate
(
const
Vector3
<
int16_t
>&
trans
);
bool
IsTransInvalid
();
bool
IsTransInvalid
();
void
SetCameraDistance
(
int16_t
distance
);
void
SetCameraPosition
(
const
Vector2
<
float
>&
position
);
void
ResetTransParameter
();
void
ResetTransParameter
();
#if ENABLE_ROTATE_INPUT
#if ENABLE_ROTATE_INPUT
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录