1 /* 2 * Copyright (c) 2020-2022 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 /** XRGB888 color mode */ 70 XRGB8888, 71 /** RGB888 color mode */ 72 RGB888, 73 /** RGB565 color mode */ 74 RGB565, 75 /** ARGB1555 color mode */ 76 ARGB1555, 77 /** ARGB4444 color mode */ 78 ARGB4444, 79 /** AL44 color mode */ 80 AL44, 81 /** AL88 color mode */ 82 AL88, 83 /** L1 color mode */ 84 L1, 85 /** L2 color mode */ 86 L2, 87 /** L4 color mode */ 88 L4, 89 /** L8 color mode */ 90 L8, 91 /** A1 color mode */ 92 A1, 93 /** A2 color mode */ 94 A2, 95 /** A4 color mode */ 96 A4, 97 /** A8 color mode */ 98 A8, 99 /** TSC6 color mode */ 100 TSC6, 101 /** TSC6A color mode */ 102 TSC6A, 103 /** unknown color mode */ 104 UNKNOWN, 105 }; 106 107 enum FontWeight : uint8_t { 108 FONT_WEIGHT_1 = 1, 109 FONT_WEIGHT_2 = 2, 110 FONT_WEIGHT_4 = 4, 111 FONT_WEIGHT_8 = 8, 112 FONT_WEIGHT_32 = 32, 113 }; 114 115 static constexpr uint8_t SHIFT_2 = 2; 116 static constexpr uint8_t SHIFT_3 = 3; 117 static constexpr uint8_t SHIFT_4 = 4; 118 static constexpr uint8_t SHIFT_8 = 8; 119 static constexpr uint8_t SHIFT_16 = 16; 120 121 /** 122 * @brief Defines a point. 123 * @since 1.0 124 * @version 1.0 125 */ 126 struct Point { 127 /** X coordinate */ 128 int16_t x; 129 /** Y coordinate */ 130 int16_t y; 131 }; 132 133 /** 134 * @brief Enumerates image types. 135 */ 136 enum ImageType : uint8_t { 137 IMG_SRC_FILE_PATH, 138 IMG_SRC_IMAGE_INFO, 139 }; 140 141 enum class InputType { 142 TEXT_TYPE, 143 PASSWORD_TYPE 144 }; 145 146 /** 147 * @brief Enumerates screen shapes. 148 */ 149 enum ScreenShape { 150 RECTANGLE = 0, // rectangular screen 151 CIRCLE // circular screen 152 }; 153 154 enum ScrollBarSide : uint8_t { 155 SCROLL_BAR_RIGHT_SIDE = 0, 156 SCROLL_BAR_LEFT_SIDE 157 }; 158 } // namespace OHOS 159 #endif // GRAPHIC_LITE_TYPES_H 160