1 /* 2 * Copyright (c) 2020-2021 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 16 /** 17 * @addtogroup UI_Utils 18 * @{ 19 * 20 * @brief Defines basic UI utils. 21 * 22 * @since 1.0 23 * @version 1.0 24 */ 25 26 /** 27 * @file graphic_types.h 28 * 29 * @brief Defines the common data types for the graphics system. 30 * 31 * @since 1.0 32 * @version 1.0 33 */ 34 35 #ifndef GRAPHIC_LITE_TYPES_H 36 #define GRAPHIC_LITE_TYPES_H 37 38 #include <cstdint> 39 40 namespace OHOS { 41 using TimeType = uint32_t; 42 using ImageSrcType = uint8_t; 43 44 enum BlurLevel : uint8_t { 45 INVALID, 46 LEVEL0, // no blur 47 LEVEL1, // blur one line 48 LEVEL2, // blur two line 49 }; 50 51 enum TransformAlgorithm : uint8_t { 52 NEAREST_NEIGHBOR, 53 BILINEAR, 54 }; 55 56 enum LabelRotateDegree : uint8_t { 57 DEGREE_0, 58 DEGREE_90, 59 DEGREE_180, 60 DEGREE_270, 61 }; 62 63 /** 64 * @brief colormode of image and font. 65 */ 66 enum ColorMode : uint8_t { 67 /** ARGB8888 color mode */ 68 ARGB8888 = 0, 69 /** RGB888 color mode */ 70 RGB888, 71 /** RGB565 color mode */ 72 RGB565, 73 /** ARGB1555 color mode */ 74 ARGB1555, 75 /** ARGB4444 color mode */ 76 ARGB4444, 77 /** AL44 color mode */ 78 AL44, 79 /** AL88 color mode */ 80 AL88, 81 /** L1 color mode */ 82 L1, 83 /** L2 color mode */ 84 L2, 85 /** L4 color mode */ 86 L4, 87 /** L8 color mode */ 88 L8, 89 /** A1 color mode */ 90 A1, 91 /** A2 color mode */ 92 A2, 93 /** A4 color mode */ 94 A4, 95 /** A8 color mode */ 96 A8, 97 /** TSC6 color mode */ 98 TSC6, 99 /** TSC6A color mode */ 100 TSC6A, 101 /** unknow color mode */ 102 UNKNOW, 103 }; 104 105 enum FontWeight : uint8_t { 106 FONT_WEIGHT_1 = 1, 107 FONT_WEIGHT_2 = 2, 108 FONT_WEIGHT_4 = 4, 109 FONT_WEIGHT_8 = 8, 110 }; 111 112 static constexpr uint8_t SHIFT_2 = 2; 113 static constexpr uint8_t SHIFT_3 = 3; 114 static constexpr uint8_t SHIFT_4 = 4; 115 static constexpr uint8_t SHIFT_8 = 8; 116 static constexpr uint8_t SHIFT_16 = 16; 117 118 /** 119 * @brief Defines a point. 120 * @since 1.0 121 * @version 1.0 122 */ 123 struct Point { 124 /** X coordinate */ 125 int16_t x; 126 /** Y coordinate */ 127 int16_t y; 128 }; 129 130 /** 131 * @brief Enumerates image types. 132 */ 133 enum ImageType : uint8_t { 134 IMG_SRC_FILE_PATH, 135 IMG_SRC_IMAGE_INFO, 136 }; 137 138 /** 139 * @brief Enumerates screen shapes. 140 */ 141 enum ScreenShape { 142 RECTANGLE = 0, // rectangular screen 143 CIRCLE // circular screen 144 }; 145 146 enum ScrollBarSide : uint8_t { 147 SCROLL_BAR_RIGHT_SIDE = 0, 148 SCROLL_BAR_LEFT_SIDE 149 }; 150 } // namespace OHOS 151 #endif // GRAPHIC_LITE_TYPES_H 152