2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 virtual ~StrategyMethod(){}
26 virtual bool dispose(RenderMethod& renderer) = 0;
27 virtual bool update(RenderMethod& renderer, const RenderTransform* pTransform, uint32_t pFlag) = 0;
28 virtual bool render(RenderMethod& renderer) = 0;
30 virtual bool rotate(float degree) = 0;
31 virtual bool scale(float factor) = 0;
32 virtual bool translate(float x, float y) = 0;
33 virtual bool transform(const Matrix& m) = 0;
34 virtual bool bounds(float* x, float* y, float* w, float* h) const = 0;
40 StrategyMethod* smethod = nullptr;
43 if (smethod) delete(smethod);
46 void method(StrategyMethod* method)
51 StrategyMethod* method()
59 struct PaintMethod : StrategyMethod
63 PaintMethod(T* _inst) : inst(_inst) {}
66 bool rotate(float degree) override
68 return inst->rotate(degree);
71 bool scale(float factor) override
73 return inst->scale(factor);
76 bool translate(float x, float y) override
78 return inst->translate(x, y);
81 bool transform(const Matrix& m) override
83 return inst->transform(m);
86 bool bounds(float* x, float* y, float* w, float* h) const override
88 return inst->bounds(x, y, w, h);
91 bool dispose(RenderMethod& renderer)
93 return inst->dispose(renderer);
96 bool update(RenderMethod& renderer, const RenderTransform* pTransform, uint32_t pFlag)
98 return inst->update(renderer, pTransform, pFlag);
101 bool render(RenderMethod& renderer)
103 return inst->render(renderer);
108 #endif //_TVG_PAINT_H_