mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 07:02:25 +00:00
graphic native test codes update
Signed-off-by: HaoXinyu <haoxinyu1@huawei.com>
This commit is contained in:
parent
e5b81a79f3
commit
9735fe9539
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "parameters_defination.h"
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
|
||||
@ -41,17 +42,18 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, FgBrightnessParams_Fraction_T
|
||||
float rateList[] = { -0.05, 0.0, 1.0, 20.0 };
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
std::array<float, 3> RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
RSDynamicBrightnessPara params = RSDynamicBrightnessPara(rateList[i], rateList[(i + 3) % 4],
|
||||
saturationList[j], saturationList[(j + 1) % 4], saturationList[j], RGB[k], RGB[(k + 1) % 2]);
|
||||
params.fraction_ = 0.5;
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
params.fraction_ = ZERO_POINT_FIVE_;
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetFgBrightnessParams(params);
|
||||
testNode->SetFgBrightnessFract(params.fraction_);
|
||||
@ -69,17 +71,18 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, FgBrightnessParams_Fraction_T
|
||||
float rateList[] = { -0.05, 0.0, 1.0, 20.0 };
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
std::array<float, 3> RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
RSDynamicBrightnessPara params = RSDynamicBrightnessPara(rateList[i], rateList[(i + 3) % 4],
|
||||
saturationList[j], saturationList[(j + 1) % 4], saturationList[j], RGB[k], RGB[(k + 1) % 2]);
|
||||
params.fraction_ = 1.0;
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
params.fraction_ = ONE_;
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetFgBrightnessParams(params);
|
||||
testNode->SetFgBrightnessFract(params.fraction_);
|
||||
@ -97,17 +100,18 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, FgBrightnessParams_Fraction_T
|
||||
float rateList[] = { -0.05, 0.0, 1.0, 20.0 };
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
std::array<float, 3> RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
RSDynamicBrightnessPara params = RSDynamicBrightnessPara(rateList[i], rateList[(i + 3) % 4],
|
||||
saturationList[j], saturationList[(j + 1) % 4], saturationList[j], RGB[k], RGB[(k + 1) % 2]);
|
||||
params.fraction_ = 0.0;
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
params.fraction_ = ZERO_;
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetFgBrightnessParams(params);
|
||||
testNode->SetFgBrightnessFract(params.fraction_);
|
||||
@ -126,9 +130,9 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_1)
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
float fractionVal = 0.5;
|
||||
Vector3f RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
auto blenderPara = std::make_shared<BrightnessBlender>();
|
||||
blenderPara->SetFraction(fractionVal);
|
||||
blenderPara->SetLinearRate(rateList[i]);
|
||||
@ -138,11 +142,12 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_1)
|
||||
blenderPara->SetSaturation(saturationList[j]);
|
||||
blenderPara->SetPositiveCoeff(RGB[k]);
|
||||
blenderPara->SetNegativeCoeff(RGB[(k + 1) % 2]);
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetBlender(blenderPara.get());
|
||||
GetRootNode()->AddChild(testFaNode);
|
||||
@ -160,9 +165,9 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_2)
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
float fractionVal = 1.0;
|
||||
Vector3f RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
auto blenderPara = std::make_shared<BrightnessBlender>();
|
||||
blenderPara->SetFraction(fractionVal);
|
||||
blenderPara->SetLinearRate(rateList[i]);
|
||||
@ -172,11 +177,12 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_2)
|
||||
blenderPara->SetSaturation(saturationList[j]);
|
||||
blenderPara->SetPositiveCoeff(RGB[k]);
|
||||
blenderPara->SetNegativeCoeff(RGB[(k + 1) % 2]);
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetBlender(blenderPara.get());
|
||||
GetRootNode()->AddChild(testFaNode);
|
||||
@ -194,9 +200,9 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_3)
|
||||
float saturationList[] = { 0.0, 5.0, 10.0, 20.0 };
|
||||
float fractionVal = 0.0;
|
||||
Vector3f RGB[] = { { 2.3, 4.5, 2 }, { 0.5, 2, 0.5 } };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
for (int j = 0; j < FOUR_; j++) {
|
||||
for (int k = 0; k < TWO_; k++) {
|
||||
auto blenderPara = std::make_shared<BrightnessBlender>();
|
||||
blenderPara->SetFraction(fractionVal);
|
||||
blenderPara->SetLinearRate(rateList[i]);
|
||||
@ -206,11 +212,12 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Foreground_SetBlender_Test_3)
|
||||
blenderPara->SetSaturation(saturationList[j]);
|
||||
blenderPara->SetPositiveCoeff(RGB[k]);
|
||||
blenderPara->SetNegativeCoeff(RGB[(k + 1) % 2]);
|
||||
int x = i * 310;
|
||||
int y = (k + j * 2) * 310;
|
||||
auto testFaNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 300, 300 });
|
||||
int x = i * THREE_HUNDRED_TEN_;
|
||||
int y = (k + j * 2) * THREE_HUNDRED_TEN_;
|
||||
auto testFaNode =
|
||||
SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0, 0, 300, 300 });
|
||||
testNode->SetBounds({ 0, 0, THREE_HUNDRED_, THREE_HUNDRED_ });
|
||||
testNode->SetForegroundColor(0xff7d112c);
|
||||
testNode->SetBlender(blenderPara.get());
|
||||
GetRootNode()->AddChild(testFaNode);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "parameters_defination.h"
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
|
||||
@ -38,10 +39,10 @@ public:
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, GrayScale_Test_1)
|
||||
{
|
||||
float grayScaleList[] = { 0.0, 0.5, 1.0, 2.0 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetGrayScale(grayScaleList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -51,10 +52,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, GrayScale_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Brightness_Test_1)
|
||||
{
|
||||
float brightnessList[] = { 0.0, 0.5, 1.0, 2.0, 5.0 };
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetBrightness(brightnessList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -64,10 +65,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Brightness_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Contrast_Test_1)
|
||||
{
|
||||
float contrastList[] = { 0.0, 0.5, 1.0, 5.0, 20.0 };
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetContrast(contrastList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -77,10 +78,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Contrast_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Saturate_Test_1)
|
||||
{
|
||||
float saturateList[] = { 0.0, 0.5, 1.0, 10.0, 100.0 };
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetSaturate(saturateList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -90,10 +91,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Saturate_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Sepia_Test_1)
|
||||
{
|
||||
float sepiaList[] = { 0.0, 0.5, 1.0, 2.0 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetSepia(sepiaList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -103,10 +104,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Sepia_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Color_Invert_Test_1)
|
||||
{
|
||||
float invertList[] = { 0.0, 0.5, 1.0, 2.0 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetInvert(invertList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -116,10 +117,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Color_Invert_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, HueRotate_Test_1)
|
||||
{
|
||||
float hueRotateList[] = { 0.0, 90.0, 180.0, 270.0, 360.0 };
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetHueRotate(hueRotateList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -129,10 +130,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, HueRotate_Test_1)
|
||||
GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, ColorBlend_Test_1)
|
||||
{
|
||||
uint32_t colorList[] = { 0xffffffff, 0xff000000, 0xffff0000, 0xff00ff00, 0xff0000ff, 0x00000000 };
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < SIX_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetColorBlend(colorList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -145,10 +146,10 @@ GRAPHIC_TEST(ForegroundTest01, CONTENT_DISPLAY_TEST, Color_AiInvert_Test_1)
|
||||
GetRootNode()->AddChild(testFaNode);
|
||||
RegisterNode(testFaNode);
|
||||
Vector4f param_list[] = { { 0.0, 1.0, 0.5, 0.2 }, { 0.2, 0.5, 0.2, 0.2 }, { 0.0, 1.0, 0.5, 0.0 } };
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int y = i * 310;
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int y = i * THREE_HUNDRED_TEN_;
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0.0, y, 1000.0, 310.0 });
|
||||
testNode->SetBounds({ 0.0, y, ONE_THOUSAND_, THREE_HUNDRED_TEN_ });
|
||||
testNode->SetAiInvert(param_list[i]);
|
||||
testFaNode->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define PARAMETERS_DEFINATION_H
|
||||
|
||||
#define ZERO_ 0
|
||||
#define ZERO_POINT_FIVE_ 0.5
|
||||
#define ONE_ 1
|
||||
#define TWO_ 2
|
||||
#define THREE_ 3
|
||||
@ -39,6 +40,7 @@
|
||||
#define TWO_HUNDRED_ 200
|
||||
#define TWO_HUNDRED_FIFTY_ 250
|
||||
#define THREE_HUNDRED_ 300
|
||||
#define THREE_HUNDRED_TEN_ 310
|
||||
#define FOUR_HUNDRED_ 400
|
||||
#define FIVE_HUNDRED_ 500
|
||||
#define FIVE_HUNDRED_TEN_ 510
|
||||
@ -47,4 +49,6 @@
|
||||
#define SIX_HUNDRED_ 600
|
||||
#define SIX_HUNDRED_TEN_ 610
|
||||
|
||||
#define ONE_THOUSAND_ 1000
|
||||
|
||||
#endif // PARAMETERS_DEFINATION_H
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
|
||||
#include "ui/rs_effect_node.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -52,30 +54,39 @@ GRAPHIC_TEST(BackgroundTest01, CONTENT_DISPLAY_TEST, Use_Effect_Test)
|
||||
int rowCount = 2;
|
||||
auto sizeX = screenWidth / columnCount;
|
||||
auto sizeY = screenHeight / rowCount;
|
||||
const bool useEffectList[] = { false, true, false };
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
int x = (i % columnCount) * sizeX;
|
||||
int y = (i / columnCount) * sizeY;
|
||||
auto testNodeBackGround =
|
||||
SetUpNodeBgImage("/data/local/tmp/Images/backGroundImage.jpg", { x, y, sizeX - 10, sizeY - 10 });
|
||||
auto effectNode = RSEffectNode::Create();
|
||||
effectNode->SetBounds({ x, y, sizeX - 10, sizeY - 10 });
|
||||
effectNode->SetFrame({ x, y, sizeX - 10, sizeY - 10 });
|
||||
effectNode->SetBackgroundColor(0xffff0000);
|
||||
effectNode->SetBackgroundFilter(RSFilter::CreateBlurFilter(10, 10));
|
||||
GetRootNode()->AddChild(effectNode);
|
||||
RegisterNode(effectNode);
|
||||
|
||||
auto childNode1 =
|
||||
SetUpNodeBgImage("/data/local/tmp/Images/475x327.jpg", { sizeX / 4, sizeY / 4, sizeX / 3, sizeY / 3 });
|
||||
setNode(childNode1, 0.3);
|
||||
childNode1->SetFrame({ sizeX / 4, sizeY / 4, sizeX / 3, sizeY / 3 });
|
||||
childNode1->SetUseEffect(useEffectList[i]);
|
||||
childNode1->SetBorderStyle(0, 0, 0, 0);
|
||||
childNode1->SetBorderWidth(5, 5, 5, 5);
|
||||
childNode1->SetBorderColor(Vector4<Color>(RgbPalette::Green()));
|
||||
RegisterNode(childNode1);
|
||||
auto childNode2 = RSCanvasNode::Create();
|
||||
childNode2->SetBounds({ sizeX / 2, sizeY / 2, sizeX / 3, sizeY / 3 });
|
||||
effectNode->AddChild(childNode1);
|
||||
|
||||
auto childNode2 =
|
||||
SetUpNodeBgImage("/data/local/tmp/appearance_test.jpg", { sizeX / 2, sizeY / 2, sizeX / 3, sizeY / 3 });
|
||||
childNode2->SetFrame({ sizeX / 2, sizeY / 2, sizeX / 3, sizeY / 3 });
|
||||
childNode2->SetBackgroundColor(0xff00ff00);
|
||||
setNode(childNode2, 0.5);
|
||||
childNode2->SetUseEffect(useEffectList[i + 1]);
|
||||
childNode2->SetBorderStyle(0, 0, 0, 0);
|
||||
childNode2->SetBorderWidth(5, 5, 5, 5);
|
||||
childNode2->SetBorderColor(Vector4<Color>(RgbPalette::Red()));
|
||||
RegisterNode(childNode2);
|
||||
testNodeBackGround->SetBounds({ x, y, sizeX - 10, sizeY - 10 });
|
||||
testNodeBackGround->AddChild(childNode1);
|
||||
testNodeBackGround->AddChild(childNode2);
|
||||
testNodeBackGround->SetUseEffect(i);
|
||||
testNodeBackGround->SetBorderStyle(0, 0, 0, 0);
|
||||
testNodeBackGround->SetBorderWidth(5, 5, 5, 5);
|
||||
testNodeBackGround->SetBorderColor(Vector4<Color>(RgbPalette::Green()));
|
||||
GetRootNode()->AddChild(testNodeBackGround);
|
||||
RegisterNode(testNodeBackGround);
|
||||
effectNode->AddChild(childNode2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,16 +66,16 @@ void TextCustomModifier::SetText(std::string text)
|
||||
|
||||
void TextCustomModifier::Draw(RSDrawingContext& context) const
|
||||
{
|
||||
if (!text_)
|
||||
if (text_ == nullptr)
|
||||
return;
|
||||
uint32_t colorInt = 0xff000000;
|
||||
Vector2f position = { 0.0, 0.0 };
|
||||
float fontSize = 16;
|
||||
if (!color_)
|
||||
if (color_ != nullptr)
|
||||
colorInt = color_->Get();
|
||||
if (!position_)
|
||||
if (position_ != nullptr)
|
||||
position = position_->Get();
|
||||
if (!size_)
|
||||
if (size_ != nullptr)
|
||||
fontSize = size_->Get();
|
||||
auto brushColor = OHOS::Rosen::Drawing::Color(colorInt);
|
||||
Drawing::Brush brush;
|
||||
|
Loading…
Reference in New Issue
Block a user