1 /*
2  * Copyright (c) 2024 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 RENDER_SERVICE_BASE_PIXEL_MAP_SHADER_H
17 #define RENDER_SERVICE_BASE_PIXEL_MAP_SHADER_H
18 #include "effect/shader_effect.h"
19 #include "pixel_map.h"
20 #include "utils/extend_object.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class RSB_EXPORT RSPixelMapShader : public Drawing::ExtendObject {
25 public:
26     RSPixelMapShader() = default;
27     RSPixelMapShader(
28         std::shared_ptr<Media::PixelMap> pixelMap, Drawing::TileMode tileX, Drawing::TileMode tileY,
29         const Drawing::SamplingOptions& sampling, const Drawing::Matrix& matrix);
30     ~RSPixelMapShader() override = default;
31 #ifdef ROSEN_OHOS
32     bool Marshalling(Parcel& parcel) override;
33     bool Unmarshalling(Parcel& parcel) override;
34 #endif
35     // Be Careful: this Function will return an Object Ptr which should be managed by Caller.
36     void* GenerateBaseObject() override;
37 private:
38     std::shared_ptr<Media::PixelMap> pixelMap_;
39     Drawing::TileMode tileX_;
40     Drawing::TileMode tileY_;
41     Drawing::SamplingOptions sampling_;
42     Drawing::Matrix matrix_;
43 };
44 } // namespace Rosen
45 } // namespace OHOS
46 
47 #endif // RENDER_SERVICE_BASE_PIXEL_MAP_SHADER_H