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 #ifndef GRAPHIC_LITE_IMAGEDECODE_ABILITY_H
17 #define GRAPHIC_LITE_IMAGEDECODE_ABILITY_H
18 #include "gfx_utils/heap_base.h"
19 
20 namespace OHOS {
21 enum {
22     IMG_SUPPORT_UNKNOW = 0x0,
23     IMG_SUPPORT_BITMAP = 0x01,
24     IMG_SUPPORT_JPEG = 0x02,
25     IMG_SUPPORT_PNG = 0x04,
26 };
27 class ImageDecodeAbility : public HeapBase {
28 public:
29     static ImageDecodeAbility& GetInstance();
30 
SetImageDecodeAbility(uint32_t imageType)31     void SetImageDecodeAbility(uint32_t imageType)
32     {
33         imageType_ = imageType;
34     }
35 
GetImageDecodeAbility()36     uint32_t GetImageDecodeAbility()
37     {
38         return imageType_;
39     }
40 
41 private:
ImageDecodeAbility()42     ImageDecodeAbility()
43     {
44 #ifdef VERSION_STANDARD
45         imageType_ = IMG_SUPPORT_BITMAP | IMG_SUPPORT_JPEG | IMG_SUPPORT_PNG;
46 #else
47         imageType_ = IMG_SUPPORT_BITMAP;
48 #endif
49     }
~ImageDecodeAbility()50     ~ImageDecodeAbility() {}
51 
52     uint32_t imageType_;
53 
54     ImageDecodeAbility(const ImageDecodeAbility&) = delete;
55     ImageDecodeAbility& operator=(const ImageDecodeAbility&) = delete;
56     ImageDecodeAbility(ImageDecodeAbility&&) = delete;
57     ImageDecodeAbility& operator=(ImageDecodeAbility&&) = delete;
58 };
59 } // namespace OHOS
60 #endif // GRAPHIC_LITE_IMAGEDECODE_ABILITY_H
61