1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef ANISOTROPIC_H
16 #define ANISOTROPIC_H
17 #include "test_base.h"
18 #include "test_common.h"
19 #include <bits/alltypes.h>
20 #include <native_drawing/drawing_rect.h>
21 #include <native_drawing/drawing_image.h>
22 #include <native_drawing/drawing_canvas.h>
23 #include <native_drawing/drawing_pen.h>
24 
25 class Anisotropic : public TestBase {
26     uint32_t kImageSize = 256;
27     uint32_t kSpacer = 10;
28     uint32_t kNumVertImages = 5;
29     int kNumLines = 100;
30     float kAngleStep = 360.0f / kNumLines;
31     int kInnerOffset = 10;
32     float angle = 0.0f;
33 
34 public:
Anisotropic()35     Anisotropic()
36     {
37         bitmapWidth_ = 2 * kImageSize + 3 * kSpacer;                                  // 2,3宽度
38         bitmapHeight_ = kNumVertImages * kImageSize + (kNumVertImages + 1) * kSpacer; // 1高度
39         fileName_ = "anisotropic_hq";
40     }
41     ~Anisotropic() override;
42 
43 protected:
44     void OnTestFunction(OH_Drawing_Canvas *canvas) override;
45     void BeforeDraw(OH_Drawing_Canvas *canvas);
46     void Draw(OH_Drawing_Canvas *canvas, int x, int y, int xSize, int ySize);
47     void DrawImage(OH_Drawing_Canvas *canvas, OH_Drawing_Image *image, OH_Drawing_Bitmap *bitmap);
48 };
49 
50 #endif // ANISOTROPIC_H
51