1 /* 2 * Copyright (c) 2023-2023 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 PIXMAP_H 17 #define PIXMAP_H 18 19 #include "drawing/engine_adapter/impl_interface/pixmap_impl.h" 20 #include "utils/drawing_macros.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 namespace Drawing { 25 class DRAWING_API Pixmap { 26 public: 27 Pixmap(); 28 Pixmap(const ImageInfo& imageInfo, const void* addr, size_t rowBytes); 29 virtual ~Pixmap(); 30 std::shared_ptr<ColorSpace> GetColorSpace() const; 31 ColorType GetColorType() const; 32 AlphaType GetAlphaType() const; 33 ColorQuad GetColor(int x, int y) const; 34 size_t GetRowBytes() const; 35 const void* GetAddr() const; 36 int32_t GetWidth() const; 37 int32_t GetHeight() const; 38 bool ScalePixels(const Pixmap& dst, const SamplingOptions& options) const; 39 40 template<typename T> GetImpl()41 T* GetImpl() const 42 { 43 return pixmapImplPtr_->DowncastingTo<T>(); 44 } 45 46 private: 47 std::shared_ptr<PixmapImpl> pixmapImplPtr_; 48 }; 49 } // namespace Drawing 50 } // namespace Rosen 51 } // namespace OHOS 52 #endif 53