1 /* 2 * Copyright (c) 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 BITMAPIMPL_H 17 #define BITMAPIMPL_H 18 19 #include "base_impl.h" 20 21 #include "draw/color.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 namespace Drawing { 26 class Bitmap; 27 struct BitmapFormat; 28 class BitmapImpl : public BaseImpl { 29 public: 30 static inline constexpr AdapterType TYPE = AdapterType::BASE_INTERFACE; BitmapImpl()31 BitmapImpl() {} ~BitmapImpl()32 ~BitmapImpl() override {} GetType()33 AdapterType GetType() const override 34 { 35 return AdapterType::BASE_INTERFACE; 36 } 37 virtual void Build(const int width, const int height, const BitmapFormat& format) = 0; 38 virtual int GetWidth() = 0; 39 virtual int GetHeight() = 0; 40 virtual void* GetPixels() = 0; 41 virtual void SetPixels(void* pixel) = 0; 42 virtual void CopyPixels(Bitmap& dst, int srcLeft, int srcTop, int width, int height) const = 0; 43 virtual void ClearWithColor(const ColorQuad& color) const = 0; 44 virtual ColorQuad GetColor(int x, int y) const = 0; 45 virtual void Free() = 0; 46 virtual bool IsValid() const = 0; 47 }; 48 } // namespace Drawing 49 } // namespace Rosen 50 } // namespace OHOS 51 #endif