• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in comliance with the License.
5  * You may obtian 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 #include "dtk_constants.h"
17 #include "dtk_test_base.h"
18 
19 namespace OHOS {
20 namespace Rosen {
21 
22 using namespace Drawing;
23 
24 // Pixmap_Scene_0121
25 // Pixmap构造接口:Pixmap_ImageInfo_10
26 // Pixmap操作接口:GetHeight
27 // cilp:ClipPath
28 // transform:Scale(极小值)
29 // 抗锯齿:AA
30 // 透明度:透明
31 // 视效:CreateBlendShader
32 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 1)
33 {
34     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
35     Drawing::Brush brush;
36     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
37 
38     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
39     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
40         Drawing::ColorSpace::CreateSRGB()); // 512 width * 512 height
41     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
42 
43     // 3.Pixmap操作接口GetHeight,绘制部分放到第6步的绘制结果里
44     auto height = pixmap.GetHeight();
45 
46     Drawing::Bitmap bitmap1;
47     bitmap1.Build(imageInfo);
48     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
49     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
50 
51     brush.SetColor(0xFFFF0000);
52 
53     // 4.组合transform函数Scale(极小值)
54     playbackCanvas_->Scale(10100.0f, 1.0f); // ratio
55 
56     int rectPos = 0;
57     auto dst = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_RED);
58     auto src = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_GREEN);
59     for (auto blendMode : blendModes) {
60         auto blendShader = Drawing::ShaderEffect::CreateBlendShader(*dst, *src, blendMode);
61         // 5.设置视效效果CreateBlendShader,将效果添加到笔刷
62         brush.SetShaderEffect(blendShader);
63 
64         // 6.绘制结果
65         const void* pixel = pixmap.GetAddr();
66         bitmap1.SetPixels(const_cast<void*>(pixel));
67         playbackCanvas_->AttachBrush(brush);
68         playbackCanvas_->DrawRect(Rect(0 + (rectPos % VARIATION) * LEFT, 0 + (rectPos / VARIATION) * LEFT,
69             500 + (rectPos % VARIATION) * LEFT, height + (rectPos / VARIATION) * LEFT)); // 500 width * height
70         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
71             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
72         rectPos += 1;
73     }
74     playbackCanvas_->DetachBrush();
75 
76     // 7.组合Clip函数ClipPath,cilp也有抗锯齿效果,默认和笔刷效果保持一致
77     TestBase::ClipPath(true);
78 }
79 
80 // Pixmap_Scene_0122
81 // Pixmap构造接口:Pixmap_ImageInfo_10
82 // Pixmap操作接口:GetHeight
83 // cilp:ClipRect
84 // transform:Translate
85 // 抗锯齿:非AA
86 // 透明度:半透明
87 // 视效:CreateLinearToSrgbGamma
88 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 2)
89 {
90     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
91     Drawing::Brush brush;
92     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
93 
94     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
95     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
96         Drawing::ColorSpace::CreateSRGB()); // 512 width * 512 height
97     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
98 
99     // 3.Pixmap操作接口GetHeight,绘制部分放到第6步的绘制结果里
100     auto height = pixmap.GetHeight();
101 
102     Drawing::Bitmap bitmap1;
103     bitmap1.Build(imageInfo);
104     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
105     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
106 
107     // 4.设置视效效果CreateLinearToSrgbGamma,将效果添加到笔刷
108     brush.SetColor(0xFF4F7091);
109     auto filter = Drawing::Filter();
110     filter.SetColorFilter(Drawing::ColorFilter::CreateLinearToSrgbGamma());
111     brush.SetFilter(filter);
112 
113     // 5.组合transform函数Translate
114     playbackCanvas_->Translate(200, 200); // 200 distance
115 
116     // 6.绘制结果
117     const void* pixel = pixmap.GetAddr();
118     bitmap1.SetPixels(const_cast<void*>(pixel));
119     playbackCanvas_->AttachBrush(brush);
120     playbackCanvas_->DrawRect(Rect(0, 0, 500, height)); // 500 width * height
121     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);     // 250,300 is bitmap1 position
122     playbackCanvas_->DetachBrush();
123 
124     // 7.组合Clip函数ClipRect,cilp也有抗锯齿效果,默认和笔刷效果保持一致
125     TestBase::ClipRect(false);
126 }
127 
128 // Pixmap_Scene_0123
129 // Pixmap构造接口:Pixmap_ImageInfo_10
130 // Pixmap操作接口:GetColorType
131 // cilp:ClipRect
132 // transform:Translate
133 // 抗锯齿:非AA
134 // 透明度:半透明
135 // 视效:CreateLumaColorFilter
136 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 3)
137 {
138     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
139     Drawing::Brush brush;
140     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
141 
142     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
143     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
144         Drawing::ColorSpace::CreateSRGB()); // 512 width * 512 height
145     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
146 
147     // 3.Pixmap操作接口GetColorType,绘制部分放到第6步的绘制结果里
148 
149     Drawing::Bitmap bitmap1;
150     bitmap1.Build(imageInfo);
151     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
152     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
153 
154     // 4.设置视效效果CreateLumaColorFilter,将效果添加到笔刷
155     brush.SetColor(0xFF0000FF);
156     auto filter = Drawing::Filter();
157     filter.SetColorFilter(Drawing::ColorFilter::CreateLumaColorFilter());
158     brush.SetFilter(filter);
159 
160     // 5.组合transform函数Translate
161     playbackCanvas_->Translate(200, 200); // 200 distance
162 
163     // 6.绘制结果
164     const void* pixel = pixmap.GetAddr();
165     bitmap1.SetPixels(const_cast<void*>(pixel));
166     playbackCanvas_->AttachBrush(brush);
167     if (pixmap.GetColorType() == Drawing::ColorType::COLORTYPE_RGB_565) {
168         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
169     } else {
170         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
171     }
172     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap1 position
173     playbackCanvas_->DetachBrush();
174 
175     // 7.组合Clip函数ClipRect,cilp也有抗锯齿效果,默认和笔刷效果保持一致
176     TestBase::ClipRect(false);
177 }
178 
179 // Pixmap_Scene_0124
180 // Pixmap构造接口:Pixmap_ImageInfo_10
181 // Pixmap操作接口:GetColorType
182 // cilp:ClipRoundRect(G2)
183 // transform:Shear
184 // 抗锯齿:AA
185 // 透明度:不透明
186 // 视效:CreateBlurMaskFilter
187 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 4)
188 {
189     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
190     Drawing::Brush brush;
191     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
192 
193     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
194     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
195         Drawing::ColorSpace::CreateSRGB()); // 512 width * 512 height
196     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
197 
198     // 3.Pixmap操作接口GetColorType,绘制部分放到第6步的绘制结果里
199 
200     Drawing::Bitmap bitmap1;
201     bitmap1.Build(imageInfo);
202     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
203     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
204 
205     brush.SetColor(0xFFFF0000);
206 
207     // 4.组合transform函数Shear
208     playbackCanvas_->Shear(10.0f, 10.0f); // slope
209 
210     int rectPos = 0;
211     for (auto& blurType : blurTypes) {
212         auto filter = Drawing::Filter();
213         // 5.设置视效效果CreateBlurMaskFilter,将效果添加到笔刷
214         filter.SetMaskFilter(Drawing::MaskFilter::CreateBlurMaskFilter(blurType, 10.0f, true));
215         brush.SetFilter(filter);
216         // 6.绘制结果
217         const void* pixel = pixmap.GetAddr();
218         bitmap1.SetPixels(const_cast<void*>(pixel));
219         playbackCanvas_->AttachBrush(brush);
220         if (pixmap.GetColorType() == Drawing::ColorType::COLORTYPE_RGB_565) {
221             playbackCanvas_->DrawRect(Drawing::Rect(800 + (rectPos % VARIATION) * LEFT,
222                 800 + (rectPos / VARIATION) * LEFT, 1000 + (rectPos % VARIATION) * LEFT,
223                 1000 + (rectPos / VARIATION) * LEFT)); // rect region(800, 800, 1000, 1000)
224         } else {
225             playbackCanvas_->DrawRect(Drawing::Rect(1000 + (rectPos % VARIATION) * LEFT,
226                 1000 + (rectPos / VARIATION) * LEFT, 1200 + (rectPos % VARIATION) * LEFT,
227                 1200 + (rectPos / VARIATION) * LEFT)); // rect region(1000, 1000, 1200, 1200)
228         }
229         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
230             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
231         rectPos += 200;
232     }
233     playbackCanvas_->DetachBrush();
234 
235     // 7.组合Clip函数ClipRoundRect(G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
236     TestBase::ClipRoundRectG2(true);
237 }
238 
239 // Pixmap_Scene_0125
240 // Pixmap构造接口:Pixmap_ImageInfo_10
241 // Pixmap操作接口:GetAlphaType
242 // cilp:ClipRoundRect(G2)
243 // transform:Shear
244 // 抗锯齿:AA
245 // 透明度:透明
246 // 视效:CreateBlendImageFilter
247 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 5)
248 {
249     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
250     Drawing::Brush brush;
251     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
252 
253     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
254     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
255         Drawing::ColorSpace::CreateSRGB()); // 512 width * 512 height
256     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
257 
258     // 3.Pixmap操作接口GetAlphaType,绘制部分放到第6步的绘制结果里
259 
260     Drawing::Bitmap bitmap1;
261     bitmap1.Build(imageInfo);
262     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
263     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
264 
265     brush.SetColor(0x4CB21933);
266 
267     // 4.组合transform函数Shear
268     playbackCanvas_->Shear(10.0f, 10.0f); // slope
269 
270     int rectPos = 0;
271     for (auto blendMode : blendModes) {
272         auto background = Drawing::ImageFilter::CreateBlurImageFilter(
273             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
274         auto foreground = Drawing::ImageFilter::CreateBlurImageFilter(
275             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
276         auto filter = Drawing::Filter();
277         // 5.设置视效效果CreateBlendImageFilter,将效果添加到笔刷
278         filter.SetImageFilter(Drawing::ImageFilter::CreateBlendImageFilter(blendMode, background, foreground));
279         brush.SetFilter(filter);
280 
281         // 6.绘制结果
282         const void* pixel = pixmap.GetAddr();
283         bitmap1.SetPixels(const_cast<void*>(pixel));
284         playbackCanvas_->Save();
285         playbackCanvas_->AttachBrush(brush);
286         if (pixmap.GetAlphaType() == Drawing::AlphaType::ALPHATYPE_UNKNOWN) {
287             playbackCanvas_->DrawRect(Drawing::Rect(800 + (rectPos % VARIATION) * LEFT,
288                 800 + (rectPos / VARIATION) * LEFT, 1000 + (rectPos % VARIATION) * LEFT,
289                 1000 + (rectPos / VARIATION) * LEFT)); // rect region(800, 800, 1000, 1000)
290         } else {
291             playbackCanvas_->DrawRect(Drawing::Rect(1000 + (rectPos % VARIATION) * LEFT,
292                 1000 + (rectPos / VARIATION) * LEFT, 1200 + (rectPos % VARIATION) * LEFT,
293                 1200 + (rectPos / VARIATION) * LEFT)); // rect region(1000, 1000, 1200, 1200)
294         }
295         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
296             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
297         playbackCanvas_->Restore();
298         rectPos += 1;
299     }
300     playbackCanvas_->DetachBrush();
301 
302     // 7.组合Clip函数ClipRoundRect(G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
303     TestBase::ClipRoundRectG2(true);
304 }
305 
306 // Pixmap_Scene_0126
307 // Pixmap构造接口:Pixmap_ImageInfo_10
308 // Pixmap操作接口:GetColorSpace
309 // cilp:ClipRoundRect(G2_capsule)
310 // transform:null
311 // 抗锯齿:非AA
312 // 透明度:半透明
313 // 视效:CreateLinearGradient
314 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 6)
315 {
316     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
317     Drawing::Brush brush;
318     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
319 
320     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
321     auto colorspace = Drawing::ColorSpace::CreateSRGB();
322     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
323         colorspace); // 512 width * 512 height
324     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
325 
326     // 3.Pixmap操作接口GetColorSpace,绘制部分放到第6步的绘制结果里
327 
328     Drawing::Bitmap bitmap1;
329     bitmap1.Build(imageInfo);
330     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
331     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
332 
333     // 4.设置视效效果CreateLinearGradient,将效果添加到笔刷
334     std::vector<Drawing::ColorQuad> colors = { Drawing::Color::COLOR_RED, Drawing::Color::COLOR_GREEN,
335         Drawing::Color::COLOR_BLUE };
336     std::vector<Drawing::scalar> pos = { 0.00f, 0.50f, 1.00f };
337     auto linearGradient = Drawing::ShaderEffect::CreateLinearGradient(
338         { 0, 0 }, { 1000, 1000 }, colors, pos, Drawing::TileMode::CLAMP); // 0 start pos & 1000 end pos
339     brush.SetShaderEffect(linearGradient);
340 
341     // 5.无transform函数
342     // 6.绘制结果
343     const void* pixel = pixmap.GetAddr();
344     bitmap1.SetPixels(const_cast<void*>(pixel));
345     playbackCanvas_->AttachBrush(brush);
346     if (pixmap.GetColorSpace() == colorspace) {
347         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
348     } else {
349         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
350     }
351     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
352     playbackCanvas_->DetachBrush();
353 
354     // 7.组合Clip函数ClipRoundRect(G2_capsule),cilp也有抗锯齿效果,默认和笔刷效果保持一致
355     TestBase::ClipRoundRectG2capsule(false);
356 }
357 
358 // Pixmap_Scene_0127
359 // Pixmap构造接口:Pixmap_ImageInfo_10
360 // Pixmap操作接口:GetRowBytes
361 // cilp:ClipRoundRect(非G2)
362 // transform:ConcatMatrix
363 // 抗锯齿:AA
364 // 透明度:不透明
365 // 视效:CreateColorShader
366 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 7)
367 {
368     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
369     Drawing::Brush brush;
370     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
371 
372     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
373     auto colorspace = Drawing::ColorSpace::CreateSRGB();
374     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
375         colorspace); // 512 width * 512 height
376     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
377 
378     // 3.Pixmap操作接口GetRowBytes,绘制部分放到第6步的绘制结果里
379     ImageInfo imageInfo1(1, 1, COLORTYPE_RGBA_8888, ALPHATYPE_PREMUL);
380     uint32_t pixel[] = { 0xFF123456 };
381     Pixmap pixmap1(imageInfo1, pixel, sizeof(pixel));
382     std::shared_ptr<Data> data = std::make_shared<Data>();
383     data->BuildWithCopy(pixmap1.GetAddr(), pixmap1.GetRowBytes() * pixmap1.GetHeight());
384     auto image = Image::MakeRasterData(imageInfo1, data, pixmap1.GetRowBytes());
385 
386     Drawing::Bitmap bitmap1;
387     bitmap1.Build(imageInfo);
388     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
389     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
390 
391     // 4.设置视效效果CreateColorShader,将效果添加到笔刷
392     brush.SetColor(0xFFFF0000);
393     auto colorShader = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_RED);
394     brush.SetShaderEffect(colorShader);
395 
396     // 5.组合transform函数ConcatMatrix
397     Drawing::Matrix matrix;
398     matrix.Rotate(15, 10, 10); // 15 angle 10 position
399     playbackCanvas_->ConcatMatrix(matrix);
400 
401     // 6.绘制结果
402     const void* pixel1 = pixmap.GetAddr();
403     bitmap1.SetPixels(const_cast<void*>(pixel1));
404     playbackCanvas_->AttachBrush(brush);
405     playbackCanvas_->DrawImageNine(image.get(), Drawing::RectI(0, 0, 1, 1),
406         Rect(100, 100, 500, 500), // Rect(100, 100, 500, 500) & RectI(0, 0, 1, 1)
407         FilterMode::NEAREST);
408     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
409     playbackCanvas_->DetachBrush();
410 
411     // 7.组合Clip函数ClipRoundRect(非G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
412     TestBase::ClipRoundRectnotG2(true);
413 }
414 
415 // Pixmap_Scene_0128
416 // Pixmap构造接口:Pixmap_ImageInfo_10
417 // Pixmap操作接口:GetAddr
418 // cilp:ClipRoundRect(G2_capsule)
419 // transform:Rotate
420 // 抗锯齿:非AA
421 // 透明度:透明
422 // 视效:null
423 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 8)
424 {
425     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
426     Drawing::Brush brush;
427     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
428 
429     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
430     auto colorspace = Drawing::ColorSpace::CreateSRGB();
431     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
432         colorspace); // 512 width * 512 height
433     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
434 
435     // 3.Pixmap操作接口GetAddr,绘制部分放到第6步的绘制结果里
436 
437     Drawing::Bitmap bitmap1;
438     bitmap1.Build(imageInfo);
439     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
440     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
441 
442     // 4.无视效效果函数
443     // 5.组合transform函数Rotate
444     playbackCanvas_->Rotate(30, 10, 10); // 30 angle 10 position
445 
446     // 6.绘制结果
447     const void* pixel1 = pixmap.GetAddr();
448     bitmap1.SetPixels(const_cast<void*>(pixel1));
449     playbackCanvas_->AttachBrush(brush);
450     playbackCanvas_->DrawBitmap(bitmap1, 300, 300); // 300,300 is bitmap1 position
451     playbackCanvas_->DetachBrush();
452 
453     // 7.组合Clip函数ClipRoundRect(G2_capsule),cilp也有抗锯齿效果,默认和笔刷效果保持一致
454     TestBase::ClipRoundRectG2capsule(false);
455 }
456 
457 // Pixmap_Scene_0129
458 // Pixmap构造接口:Pixmap_ImageInfo_10
459 // Pixmap操作接口:GetColor
460 // cilp:ClipRoundRect(非G2)
461 // transform:Scale(正常值)
462 // 抗锯齿:AA
463 // 透明度:半透明
464 // 视效:CreateBlendModeColorFilter
465 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 9)
466 {
467     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
468     Drawing::Brush brush;
469     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
470 
471     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
472     auto colorspace = Drawing::ColorSpace::CreateSRGB();
473     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
474         colorspace); // 512 width * 512 height
475     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
476 
477     // 3.Pixmap操作接口GetColor,绘制部分放到第6步的绘制结果里
478     Drawing::Pen pen;
479     pen.SetWidth(8.5f);
480     pen.SetColor(pixmap.GetColor(imageInfo.GetWidth() / 2, imageInfo.GetHeight() / 2));
481 
482     Drawing::Bitmap bitmap1;
483     bitmap1.Build(imageInfo);
484     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
485     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
486 
487     brush.SetColor(0xFFFF0000);
488 
489     // 4.组合transform函数Scale(正常值)
490     playbackCanvas_->Scale(2.0f, 2.0f); // ratio
491 
492     int rectPos = 0;
493     for (auto blendMode : blendModes) {
494         std::shared_ptr<Drawing::ColorFilter> colorFilter =
495             Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF0000, blendMode);
496         auto filter = Drawing::Filter();
497         // 5.设置视效效果CreateBlendModeColorFilter,将效果添加到笔刷
498         filter.SetColorFilter(colorFilter);
499         brush.SetFilter(filter);
500         // 6.绘制结果
501         const void* pixel = pixmap.GetAddr();
502         bitmap1.SetPixels(const_cast<void*>(pixel));
503         playbackCanvas_->AttachBrush(brush);
504         playbackCanvas_->AttachPen(pen);
505         auto p1 = Drawing::Point(
506             800 + (rectPos % VARIATION) * LEFT, 800 + (rectPos / VARIATION) * RIGHT); // point position(800, 800)
507         auto p2 = Drawing::Point(
508             1000 + (rectPos % VARIATION) * LEFT, 1000 + (rectPos / VARIATION) * RIGHT); // point position(1000, 1000)
509         playbackCanvas_->DrawLine(p1, p2);
510         playbackCanvas_->DetachPen();
511         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
512             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
513         rectPos += 1;
514     }
515     playbackCanvas_->DetachBrush();
516 
517     // 7.组合Clip函数ClipRoundRect(非G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
518     TestBase::ClipRoundRectnotG2(true);
519 }
520 
521 // Pixmap_Scene_0130
522 // Pixmap构造接口:Pixmap_ImageInfo_10
523 // Pixmap操作接口:ScalePixels
524 // cilp:null
525 // transform:ConcatMatrix
526 // 抗锯齿:非AA
527 // 透明度:不透明
528 // 视效:CreateBlurImageFilter
529 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 10)
530 {
531     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
532     Drawing::Brush brush;
533     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
534 
535     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
536     auto colorspace = Drawing::ColorSpace::CreateSRGB();
537     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
538         colorspace); // 512 width * 512 height
539     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
540 
541     // 3.Pixmap操作接口ScalePixels,绘制部分放到第6步的绘制结果里
542     ImageInfo imageinfo2 = ImageInfo::MakeN32Premul(4, 4); // pixel row and col(4, 4)
543     uint32_t data[16];
544     Pixmap dst(imageinfo2, data, sizeof(uint32_t) * imageinfo2.GetWidth());
545 
546     Drawing::Bitmap bitmap1;
547     bitmap1.Build(imageInfo);
548     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
549     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
550 
551     // 4.设置视效效果CreateBlurImageFilter,将效果添加到笔刷
552     brush.SetColor(0xFFFF0000);
553     auto filter = Drawing::Filter();
554     filter.SetImageFilter(Drawing::ImageFilter::CreateBlurImageFilter(
555         10.0f, 10.0f, Drawing::TileMode::CLAMP, nullptr, Drawing::ImageBlurType::GAUSS));
556     brush.SetFilter(filter);
557 
558     // 5.组合transform函数ConcatMatrix
559     Drawing::Matrix matrix;
560     matrix.Rotate(15, 10, 10); // 15 angle 10 position
561     playbackCanvas_->ConcatMatrix(matrix);
562 
563     // 6.绘制结果
564     const void* pixel = pixmap.GetAddr();
565     bitmap1.SetPixels(const_cast<void*>(pixel));
566     playbackCanvas_->AttachBrush(brush);
567     if (pixmap.ScalePixels(dst, SamplingOptions())) {
568         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
569     } else {
570         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
571     }
572     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
573     playbackCanvas_->DetachBrush();
574 
575     // 7.无Clip函数
576 }
577 
578 // Pixmap_Scene_0131
579 // Pixmap构造接口:Pixmap_ImageInfo_10
580 // Pixmap操作接口:ScalePixels
581 // cilp:null
582 // transform:Scale(极大值)
583 // 抗锯齿:非AA
584 // 透明度:不透明
585 // 视效:CreateComposeColorFilter
586 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 11)
587 {
588     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
589     Drawing::Brush brush;
590     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
591 
592     // 2.Pixmap构造接口,Pixmap_ImageInfo_10
593     auto colorspace = Drawing::ColorSpace::CreateSRGB();
594     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGB_565, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
595         colorspace); // 512 width * 512 height
596     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
597 
598     // 3.Pixmap操作接口ScalePixels,绘制部分放到第6步的绘制结果里
599     ImageInfo imageinfo2 = ImageInfo::MakeN32Premul(4, 4); // pixel row and col(4, 4)
600     uint32_t data[16];
601     Pixmap dst(imageinfo2, data, sizeof(uint32_t) * imageinfo2.GetWidth());
602 
603     Drawing::Bitmap bitmap1;
604     bitmap1.Build(imageInfo);
605     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
606     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
607 
608     // 4.设置视效效果CreateComposeColorFilter,将效果添加到笔刷
609     brush.SetColor(0xFFFF0000);
610     std::shared_ptr<Drawing::ColorFilter> colorFilter1 =
611         Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF0000, Drawing::BlendMode::SRC_IN);
612     std::shared_ptr<Drawing::ColorFilter> colorFilter2 =
613         Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF00FF, Drawing::BlendMode::MODULATE);
614     std::shared_ptr<Drawing::ColorFilter> colorFilter3 =
615         Drawing::ColorFilter::CreateComposeColorFilter(*colorFilter1, *colorFilter2);
616     auto filter = Drawing::Filter();
617     filter.SetColorFilter(colorFilter3);
618     brush.SetFilter(filter);
619 
620     // 5.组合transform函数Scale(极大值)
621     playbackCanvas_->Scale(1.0f, 10100.0f); // ratio
622 
623     // 6.绘制结果
624     const void* pixel = pixmap.GetAddr();
625     bitmap1.SetPixels(const_cast<void*>(pixel));
626     playbackCanvas_->AttachBrush(brush);
627     if (pixmap.ScalePixels(dst, SamplingOptions())) {
628         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
629     } else {
630         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
631     }
632     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
633     playbackCanvas_->DetachBrush();
634 
635     // 7.无Clip函数
636 }
637 
638 // Pixmap_Scene_0132
639 // Pixmap构造接口:Pixmap_ImageInfo_11
640 // Pixmap操作接口:GetWidth
641 // cilp:ClipRoundRect(G2)
642 // transform:Scale(极小值)
643 // 抗锯齿:AA
644 // 透明度:不透明
645 // 视效:null
646 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 12)
647 {
648     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
649     Drawing::Brush brush;
650     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
651 
652     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
653     auto colorspace = Drawing::ColorSpace::CreateSRGB();
654     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
655         colorspace); // 512 width * 512 height
656     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
657 
658     // 3.Pixmap操作接口GetWidth,绘制部分放到第6步的绘制结果里
659     auto width = pixmap.GetWidth();
660 
661     Drawing::Bitmap bitmap1;
662     bitmap1.Build(imageInfo);
663     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
664     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
665 
666     // 4.无视效效果函数
667     // 5.组合transform函数Scale(极小值)
668     playbackCanvas_->Scale(10100.0f, 1.0f); // ratio
669 
670     // 6.绘制结果
671     const void* pixel = pixmap.GetAddr();
672     bitmap1.SetPixels(const_cast<void*>(pixel));
673     playbackCanvas_->AttachBrush(brush);
674     playbackCanvas_->DrawRect(Rect(0, 0, width, 500)); // width * 500 height
675     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);    // 250,300 is bitmap position
676     playbackCanvas_->DetachBrush();
677 
678     // 7.组合Clip函数ClipRoundRect(G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
679     TestBase::ClipRoundRectG2(true);
680 }
681 
682 // Pixmap_Scene_0133
683 // Pixmap构造接口:Pixmap_ImageInfo_11
684 // Pixmap操作接口:GetHeight
685 // cilp:ClipRoundRect(G2_capsule)
686 // transform:Translate
687 // 抗锯齿:非AA
688 // 透明度:透明
689 // 视效:CreateBlurImageFilter
690 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 13)
691 {
692     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
693     Drawing::Brush brush;
694     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
695 
696     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
697     auto colorspace = Drawing::ColorSpace::CreateSRGB();
698     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
699         colorspace); // 512 width * 512 height
700     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
701 
702     // 3.Pixmap操作接口GetHeight,绘制部分放到第6步的绘制结果里
703     auto height = pixmap.GetHeight();
704 
705     Drawing::Bitmap bitmap1;
706     bitmap1.Build(imageInfo);
707     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
708     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
709 
710     // 4.设置视效效果CreateBlurImageFilter,将效果添加到笔刷
711     brush.SetColor(0xFFFF0000);
712     auto filter = Drawing::Filter();
713     filter.SetImageFilter(Drawing::ImageFilter::CreateBlurImageFilter(
714         10.0f, 10.0f, Drawing::TileMode::CLAMP, nullptr, Drawing::ImageBlurType::GAUSS));
715     brush.SetFilter(filter);
716 
717     // 5.组合transform函数Translate
718     playbackCanvas_->Translate(200, 200); // 200 distance
719 
720     // 6.绘制结果
721     const void* pixel = pixmap.GetAddr();
722     bitmap1.SetPixels(const_cast<void*>(pixel));
723     playbackCanvas_->AttachBrush(brush);
724     playbackCanvas_->DrawRect(Rect(0, 0, 500, height)); // 500 width * height
725     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);     // 250,300 is bitmap position
726     playbackCanvas_->DetachBrush();
727 
728     // 7.组合Clip函数ClipRoundRect(G2_capsule),cilp也有抗锯齿效果,默认和笔刷效果保持一致
729     TestBase::ClipRoundRectG2capsule(false);
730 }
731 
732 // Pixmap_Scene_0134
733 // Pixmap构造接口:Pixmap_ImageInfo_11
734 // Pixmap操作接口:GetColorType
735 // cilp:ClipRoundRect(非G2)
736 // transform:Shear
737 // 抗锯齿:AA
738 // 透明度:半透明
739 // 视效:CreateSrgbGammaToLinear
740 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 14)
741 {
742     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
743     Drawing::Brush brush;
744     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
745 
746     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
747     auto colorspace = Drawing::ColorSpace::CreateSRGB();
748     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
749         colorspace); // 512 width * 512 height
750     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
751 
752     // 3.Pixmap操作接口GetColorType,绘制部分放到第6步的绘制结果里
753 
754     Drawing::Bitmap bitmap1;
755     bitmap1.Build(imageInfo);
756     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
757     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
758 
759     // 4.设置视效效果CreateSrgbGammaToLinear,将效果添加到笔刷
760     brush.SetColor(0xFF4F7091);
761     auto filter = Drawing::Filter();
762     filter.SetColorFilter(Drawing::ColorFilter::CreateSrgbGammaToLinear());
763     brush.SetFilter(filter);
764 
765     // 5.组合transform函数Shear
766     playbackCanvas_->Shear(10.0f, 10.0f); // slope
767 
768     // 6.绘制结果
769     const void* pixel = pixmap.GetAddr();
770     bitmap1.SetPixels(const_cast<void*>(pixel));
771     playbackCanvas_->AttachBrush(brush);
772     if (pixmap.GetColorType() == Drawing::ColorType::COLORTYPE_ARGB_4444) {
773         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
774     } else {
775         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
776     }
777     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
778     playbackCanvas_->DetachBrush();
779 
780     // 7.组合Clip函数ClipRoundRect(非G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
781     TestBase::ClipRoundRectnotG2(true);
782 }
783 
784 // Pixmap_Scene_0135
785 // Pixmap构造接口:Pixmap_ImageInfo_11
786 // Pixmap操作接口:GetAlphaType
787 // cilp:ClipRoundRect(G2_capsule)
788 // transform:null
789 // 抗锯齿:非AA
790 // 透明度:透明
791 // 视效:CreateBlendModeColorFilter
792 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 15)
793 {
794     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
795     Drawing::Brush brush;
796     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
797 
798     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
799     auto colorspace = Drawing::ColorSpace::CreateSRGB();
800     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
801         colorspace); // 512 width * 512 height
802     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
803 
804     // 3.Pixmap操作接口GetAlphaType,绘制部分放到第6步的绘制结果里
805 
806     Drawing::Bitmap bitmap1;
807     bitmap1.Build(imageInfo);
808     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
809     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
810 
811     // 4.无transform函数
812 
813     brush.SetColor(0xFFFF0000);
814 
815     int rectPos = 0;
816     for (auto blendMode : blendModes) {
817         std::shared_ptr<Drawing::ColorFilter> colorFilter =
818             Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF0000, blendMode);
819         auto filter = Drawing::Filter();
820         // 5.设置视效效果CreateBlendModeColorFilter,将效果添加到笔刷
821         filter.SetColorFilter(colorFilter);
822         brush.SetFilter(filter);
823         // 6.绘制结果
824         const void* pixel = pixmap.GetAddr();
825         bitmap1.SetPixels(const_cast<void*>(pixel));
826         playbackCanvas_->AttachBrush(brush);
827         if (pixmap.GetAlphaType() == Drawing::AlphaType::ALPHATYPE_UNKNOWN) {
828             playbackCanvas_->DrawRect(Drawing::Rect(800 + (rectPos % VARIATION) * LEFT,
829                 800 + (rectPos / VARIATION) * LEFT, 1000 + (rectPos % VARIATION) * LEFT,
830                 1000 + (rectPos / VARIATION) * LEFT)); // rect region(800, 800, 1000, 1000)
831         } else {
832             playbackCanvas_->DrawRect(Drawing::Rect(1000 + (rectPos % VARIATION) * LEFT,
833                 1000 + (rectPos / VARIATION) * LEFT, 1200 + (rectPos % VARIATION) * LEFT,
834                 1200 + (rectPos / VARIATION) * LEFT)); // rect region(1000, 1000, 1200, 1200)
835         }
836         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
837             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
838         rectPos += 1;
839     }
840     playbackCanvas_->DetachBrush();
841 
842     // 7.组合Clip函数ClipRoundRect(G2_capsule),cilp也有抗锯齿效果,默认和笔刷效果保持一致
843     TestBase::ClipRoundRectG2capsule(false);
844 }
845 
846 // Pixmap_Scene_0136
847 // Pixmap构造接口:Pixmap_ImageInfo_11
848 // Pixmap操作接口:GetAlphaType
849 // cilp:null
850 // transform:null
851 // 抗锯齿:非AA
852 // 透明度:透明
853 // 视效:CreateLinearToSrgbGamma
854 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 16)
855 {
856     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
857     Drawing::Brush brush;
858     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
859 
860     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
861     auto colorspace = Drawing::ColorSpace::CreateSRGB();
862     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
863         colorspace); // 512 width * 512 height
864     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
865 
866     // 3.Pixmap操作接口GetAlphaType,绘制部分放到第6步的绘制结果里
867 
868     Drawing::Bitmap bitmap1;
869     bitmap1.Build(imageInfo);
870     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
871     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
872 
873     // 4.设置视效效果CreateLinearToSrgbGamma,将效果添加到笔刷
874     brush.SetColor(0xFF4F7091);
875     auto filter = Drawing::Filter();
876     filter.SetColorFilter(Drawing::ColorFilter::CreateLinearToSrgbGamma());
877     brush.SetFilter(filter);
878 
879     // 5.无transform函数
880 
881     // 6.绘制结果
882     const void* pixel = pixmap.GetAddr();
883     bitmap1.SetPixels(const_cast<void*>(pixel));
884     playbackCanvas_->AttachBrush(brush);
885     if (pixmap.GetAlphaType() == Drawing::AlphaType::ALPHATYPE_UNKNOWN) {
886         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
887     } else {
888         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
889     }
890     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
891     playbackCanvas_->DetachBrush();
892 
893     // 7.无Clip函数
894 }
895 
896 // Pixmap_Scene_0137
897 // Pixmap构造接口:Pixmap_ImageInfo_11
898 // Pixmap操作接口:GetColorSpace
899 // cilp:ClipPath
900 // transform:ConcatMatrix
901 // 抗锯齿:AA
902 // 透明度:半透明
903 // 视效:CreateMatrixColorFilter
904 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 17)
905 {
906     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
907     Drawing::Brush brush;
908     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
909 
910     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
911     auto colorspace = Drawing::ColorSpace::CreateSRGB();
912     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
913         colorspace); // 512 width * 512 height
914     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
915 
916     // 3.Pixmap操作接口GetColorSpace,绘制部分放到第6步的绘制结果里
917 
918     Drawing::Bitmap bitmap1;
919     bitmap1.Build(imageInfo);
920     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
921     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
922 
923     // 4.设置视效效果CreateMatrixColorFilter,将效果添加到笔刷
924     Drawing::ColorMatrix matrix;
925     matrix.SetArray(ARR);
926     auto cf = Drawing::ColorFilter::CreateMatrixColorFilter(matrix);
927     auto filter = Drawing::Filter();
928     filter.SetImageFilter(Drawing::ImageFilter::CreateColorFilterImageFilter(*cf, nullptr));
929     brush.SetFilter(filter);
930 
931     // 5.组合transform函数ConcatMatrix
932     Drawing::Matrix matrix1;
933     matrix1.Rotate(15, 10, 10); // 15 angle 10 position
934     playbackCanvas_->ConcatMatrix(matrix1);
935 
936     // 6.绘制结果
937     const void* pixel = pixmap.GetAddr();
938     bitmap1.SetPixels(const_cast<void*>(pixel));
939     playbackCanvas_->AttachBrush(brush);
940     if (pixmap.GetColorSpace() == colorspace) {
941         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
942     } else {
943         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
944     }
945     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
946     playbackCanvas_->DetachBrush();
947 
948     // 7.组合Clip函数ClipPath,cilp也有抗锯齿效果,默认和笔刷效果保持一致
949     TestBase::ClipPath(true);
950 }
951 
952 // Pixmap_Scene_0138
953 // Pixmap构造接口:Pixmap_ImageInfo_11
954 // Pixmap操作接口:GetColorSpace
955 // cilp:ClipRoundRect(非G2)
956 // transform:ConcatMatrix
957 // 抗锯齿:AA
958 // 透明度:半透明
959 // 视效:CreateLumaColorFilter
960 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 18)
961 {
962     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
963     Drawing::Brush brush;
964     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
965 
966     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
967     auto colorspace = Drawing::ColorSpace::CreateSRGB();
968     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
969         colorspace); // 512 width * 512 height
970     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
971 
972     // 3.Pixmap操作接口GetColorSpace,绘制部分放到第6步的绘制结果里
973 
974     Drawing::Bitmap bitmap1;
975     bitmap1.Build(imageInfo);
976     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
977     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
978 
979     // 4.设置视效效果CreateLumaColorFilter,将效果添加到笔刷
980     brush.SetColor(0xFF0000FF);
981     auto filter = Drawing::Filter();
982     filter.SetColorFilter(Drawing::ColorFilter::CreateLumaColorFilter());
983     brush.SetFilter(filter);
984 
985     // 5.组合transform函数ConcatMatrix
986     Drawing::Matrix matrix;
987     matrix.Rotate(15, 10, 10); // 15 angle 10 position
988     playbackCanvas_->ConcatMatrix(matrix);
989 
990     // 6.绘制结果
991     const void* pixel = pixmap.GetAddr();
992     bitmap1.SetPixels(const_cast<void*>(pixel));
993     playbackCanvas_->AttachBrush(brush);
994     if (pixmap.GetColorSpace() == colorspace) {
995         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
996     } else {
997         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
998     }
999     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
1000     playbackCanvas_->DetachBrush();
1001 
1002     // 7.组合Clip函数ClipRoundRect(非G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
1003     TestBase::ClipRoundRectnotG2(true);
1004 }
1005 
1006 // Pixmap_Scene_0139
1007 // Pixmap构造接口:Pixmap_ImageInfo_11
1008 // Pixmap操作接口:GetRowBytes
1009 // cilp:ClipRect
1010 // transform:Rotate
1011 // 抗锯齿:非AA
1012 // 透明度:不透明
1013 // 视效:CreateComposeColorFilter
1014 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 19)
1015 {
1016     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1017     Drawing::Brush brush;
1018     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1019 
1020     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1021     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1022     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1023         colorspace); // 512 width * 512 height
1024     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1025 
1026     // 3.Pixmap操作接口GetRowBytes,绘制部分放到第6步的绘制结果里
1027     ImageInfo imageInfo1(1, 1, COLORTYPE_RGBA_8888, ALPHATYPE_PREMUL);
1028     uint32_t pixel[] = { 0xFF123456 };
1029     Pixmap pixmap1(imageInfo1, pixel, sizeof(pixel));
1030     std::shared_ptr<Data> data = std::make_shared<Data>();
1031     data->BuildWithCopy(pixmap1.GetAddr(), pixmap1.GetRowBytes() * pixmap1.GetHeight());
1032     auto image = Image::MakeRasterData(imageInfo1, data, pixmap1.GetRowBytes());
1033 
1034     Drawing::Bitmap bitmap1;
1035     bitmap1.Build(imageInfo);
1036     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1037     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
1038 
1039     // 4.设置视效效果CreateComposeColorFilter,将效果添加到笔刷
1040     brush.SetColor(0xFFFF0000);
1041     std::shared_ptr<Drawing::ColorFilter> colorFilter1 =
1042         Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF0000, Drawing::BlendMode::SRC_IN);
1043     std::shared_ptr<Drawing::ColorFilter> colorFilter2 =
1044         Drawing::ColorFilter::CreateBlendModeColorFilter(0xFFFF00FF, Drawing::BlendMode::MODULATE);
1045     std::shared_ptr<Drawing::ColorFilter> colorFilter3 =
1046         Drawing::ColorFilter::CreateComposeColorFilter(*colorFilter1, *colorFilter2);
1047     auto filter = Drawing::Filter();
1048     filter.SetColorFilter(colorFilter3);
1049     brush.SetFilter(filter);
1050 
1051     // 5.组合transform函数Rotate
1052     playbackCanvas_->Rotate(30, 10, 10); // 30 angle 10 position
1053 
1054     // 6.绘制结果
1055     const void* pixel1 = pixmap.GetAddr();
1056     bitmap1.SetPixels(const_cast<void*>(pixel1));
1057     playbackCanvas_->AttachBrush(brush);
1058     playbackCanvas_->DrawImageNine(image.get(), Drawing::RectI(0, 0, 1, 1),
1059         Rect(100, 100, 500, 500), // Rect(100, 100, 500, 500) & RectI(0, 0, 1, 1)
1060         FilterMode::NEAREST);
1061     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
1062     playbackCanvas_->DetachBrush();
1063 
1064     // 7.组合Clip函数ClipRect,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1065     TestBase::ClipRect(false);
1066 }
1067 
1068 // Pixmap_Scene_0140
1069 // Pixmap构造接口:Pixmap_ImageInfo_11
1070 // Pixmap操作接口:GetRowBytes
1071 // cilp:null
1072 // transform:Rotate
1073 // 抗锯齿:非AA
1074 // 透明度:不透明
1075 // 视效:CreateBlendShader
1076 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 20)
1077 {
1078     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1079     Drawing::Brush brush;
1080     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1081 
1082     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1083     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1084     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1085         colorspace); // 512 width * 512 height
1086     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1087 
1088     // 3.Pixmap操作接口GetRowBytes,绘制部分放到第6步的绘制结果里
1089     ImageInfo imageInfo1(1, 1, COLORTYPE_RGBA_8888, ALPHATYPE_PREMUL);
1090     uint32_t pixel[] = { 0xFF123456 };
1091     Pixmap pixmap1(imageInfo1, pixel, sizeof(pixel));
1092     std::shared_ptr<Data> data = std::make_shared<Data>();
1093     data->BuildWithCopy(pixmap1.GetAddr(), pixmap1.GetRowBytes() * pixmap1.GetHeight());
1094     auto image = Image::MakeRasterData(imageInfo1, data, pixmap1.GetRowBytes());
1095 
1096     Drawing::Bitmap bitmap1;
1097     bitmap1.Build(imageInfo);
1098     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1099     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
1100 
1101     // 4.组合transform函数Rotate
1102     playbackCanvas_->Rotate(30, 10, 10); // 30 angle 10 position
1103 
1104     brush.SetColor(0xFFFF0000);
1105     int rectPos = 0;
1106     auto dst = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_RED);
1107     auto src = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_GREEN);
1108     for (auto BlendMode : blendModes) {
1109         auto blendShader = Drawing::ShaderEffect::CreateBlendShader(*dst, *src, BlendMode);
1110         // 5.设置视效效果CreateBlendShader,将效果添加到笔刷
1111         brush.SetShaderEffect(blendShader);
1112         // 6.绘制结果
1113         const void* pixel = pixmap.GetAddr();
1114         bitmap1.SetPixels(const_cast<void*>(pixel));
1115         playbackCanvas_->AttachBrush(brush);
1116         playbackCanvas_->DrawImageNine(image.get(),
1117             Drawing::RectI(0 + (rectPos % VARIATION) * LEFT, 0 + (rectPos / VARIATION) * LEFT,
1118                 1 + (rectPos % VARIATION) * LEFT, 1 + (rectPos / VARIATION) * LEFT),
1119             Rect(100 + (rectPos % VARIATION) * LEFT, 100 + (rectPos / VARIATION) * LEFT,
1120                 500 + (rectPos % VARIATION) * LEFT,
1121                 500 + (rectPos / VARIATION) * LEFT), // Rect(100, 100, 500, 500) & RectI(0, 0, 1, 1)
1122             FilterMode::NEAREST);
1123         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
1124             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
1125         rectPos += 1;
1126     }
1127     playbackCanvas_->DetachBrush();
1128 
1129     // 7.无Clip函数
1130 }
1131 
1132 // Pixmap_Scene_0141
1133 // Pixmap构造接口:Pixmap_ImageInfo_11
1134 // Pixmap操作接口:GetAddr
1135 // cilp:ClipPath
1136 // transform:Scale(正常值)
1137 // 抗锯齿:AA
1138 // 透明度:透明
1139 // 视效:CreateBlendImageFilter
1140 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 21)
1141 {
1142     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
1143     Drawing::Brush brush;
1144     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1145 
1146     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1147     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1148     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1149         colorspace); // 512 width * 512 height
1150     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1151 
1152     // 3.Pixmap操作接口GetAddr,绘制部分放到第6步的绘制结果里
1153 
1154     Drawing::Bitmap bitmap1;
1155     bitmap1.Build(imageInfo);
1156     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1157     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
1158 
1159     // 4.组合transform函数Scale(正常值)
1160     playbackCanvas_->Scale(2.0f, 2.0f); // ratio
1161 
1162     brush.SetColor(0x4CB21933);
1163     int rectPos = 0;
1164     for (auto blendMode : blendModes) {
1165         auto background = Drawing::ImageFilter::CreateBlurImageFilter(
1166             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
1167         auto foreground = Drawing::ImageFilter::CreateBlurImageFilter(
1168             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
1169         auto filter = Drawing::Filter();
1170         // 5.设置视效效果CreateBlendImageFilter,将效果添加到笔刷
1171         filter.SetImageFilter(Drawing::ImageFilter::CreateBlendImageFilter(blendMode, background, foreground));
1172         brush.SetFilter(filter);
1173 
1174         // 6.绘制结果
1175         const void* pixel = pixmap.GetAddr();
1176         bitmap1.SetPixels(const_cast<void*>(pixel));
1177         playbackCanvas_->Save();
1178         playbackCanvas_->AttachBrush(brush);
1179         playbackCanvas_->DrawBitmap(bitmap1, 300 + (rectPos % VARIATION) * LEFT,
1180             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
1181         playbackCanvas_->Restore();
1182         rectPos += 1;
1183     }
1184     playbackCanvas_->DetachBrush();
1185 
1186     // 7.组合Clip函数ClipPath,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1187     TestBase::ClipPath(true);
1188 }
1189 
1190 // Pixmap_Scene_0142
1191 // Pixmap构造接口:Pixmap_ImageInfo_11
1192 // Pixmap操作接口:GetAddr
1193 // cilp:ClipPath
1194 // transform:Scale(正常值)
1195 // 抗锯齿:AA
1196 // 透明度:透明
1197 // 视效:CreateBlurMaskFilter
1198 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 22)
1199 {
1200     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
1201     Drawing::Brush brush;
1202     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1203 
1204     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1205     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1206     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1207         colorspace); // 512 width * 512 height
1208     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1209 
1210     // 3.Pixmap操作接口GetAddr,绘制部分放到第6步的绘制结果里
1211 
1212     Drawing::Bitmap bitmap1;
1213     bitmap1.Build(imageInfo);
1214     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1215     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
1216 
1217     // 4.组合transform函数Scale(正常值)
1218     playbackCanvas_->Scale(2.0f, 2.0f); // ratio
1219 
1220     brush.SetColor(0xFFFF0000);
1221     int rectPos = 0;
1222     for (auto& blurType : blurTypes) {
1223         auto filter = Drawing::Filter();
1224         // 5.设置视效效果CreateBlurMaskFilter,将效果添加到笔刷
1225         filter.SetMaskFilter(Drawing::MaskFilter::CreateBlurMaskFilter(blurType, 10.0f, true));
1226         brush.SetFilter(filter);
1227         // 6.绘制结果
1228         const void* pixel = pixmap.GetAddr();
1229         bitmap1.SetPixels(const_cast<void*>(pixel));
1230         playbackCanvas_->AttachBrush(brush);
1231         playbackCanvas_->DrawBitmap(bitmap1, 300 + (rectPos % VARIATION) * LEFT,
1232             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
1233         rectPos += 200;
1234     }
1235     playbackCanvas_->DetachBrush();
1236 
1237     // 7.组合Clip函数ClipPath,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1238     TestBase::ClipPath(true);
1239 }
1240 
1241 // Pixmap_Scene_0143
1242 // Pixmap构造接口:Pixmap_ImageInfo_11
1243 // Pixmap操作接口:GetColor
1244 // cilp:ClipRect
1245 // transform:Scale(极大值)
1246 // 抗锯齿:非AA
1247 // 透明度:半透明
1248 // 视效:CreateColorShader
1249 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 23)
1250 {
1251     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1252     Drawing::Brush brush;
1253     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1254 
1255     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1256     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1257     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1258         colorspace); // 512 width * 512 height
1259     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1260 
1261     // 3.Pixmap操作接口GetColor,绘制部分放到第6步的绘制结果里
1262     Drawing::Pen pen;
1263     pen.SetWidth(8.5f);
1264     pen.SetColor(pixmap.GetColor(imageInfo.GetWidth() / 2, imageInfo.GetHeight() / 2));
1265 
1266     Drawing::Bitmap bitmap1;
1267     bitmap1.Build(imageInfo);
1268     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1269     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
1270 
1271     // 4.设置视效效果CreateColorShader,将效果添加到笔刷
1272     brush.SetColor(0xFFFF0000);
1273     auto colorShader = Drawing::ShaderEffect::CreateColorShader(Drawing::Color::COLOR_RED);
1274     brush.SetShaderEffect(colorShader);
1275 
1276     // 5.组合transform函数Scale(极大值)
1277     playbackCanvas_->Scale(1.0f, 10100.0f); // ratio
1278 
1279     // 6.绘制结果
1280     const void* pixel = pixmap.GetAddr();
1281     bitmap1.SetPixels(const_cast<void*>(pixel));
1282     playbackCanvas_->AttachBrush(brush);
1283     playbackCanvas_->AttachPen(pen);
1284     auto p1 = Drawing::Point(800, 800);   // point position(800, 800)
1285     auto p2 = Drawing::Point(1000, 1000); // point position(1000, 1000)
1286     playbackCanvas_->DrawLine(p1, p2);
1287     playbackCanvas_->DetachPen();
1288     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
1289     playbackCanvas_->DetachBrush();
1290 
1291     // 7.组合Clip函数ClipRect,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1292     TestBase::ClipRect(false);
1293 }
1294 
1295 // Pixmap_Scene_0144
1296 // Pixmap构造接口:Pixmap_ImageInfo_11
1297 // Pixmap操作接口:ScalePixels
1298 // cilp:ClipRoundRect(G2)
1299 // transform:Rotate
1300 // 抗锯齿:AA
1301 // 透明度:不透明
1302 // 视效:CreateLinearGradient
1303 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 24)
1304 {
1305     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
1306     Drawing::Brush brush;
1307     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1308 
1309     // 2.Pixmap构造接口,Pixmap_ImageInfo_11
1310     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1311     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_ARGB_4444, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1312         colorspace); // 512 width * 512 height
1313     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1314 
1315     // 3.Pixmap操作接口ScalePixels,绘制部分放到第6步的绘制结果里
1316     ImageInfo imageinfo2 = ImageInfo::MakeN32Premul(4, 4); // pixel row and col(4, 4)
1317     uint32_t data[16];
1318     Pixmap dst(imageinfo2, data, sizeof(uint32_t) * imageinfo2.GetWidth());
1319 
1320     Drawing::Bitmap bitmap1;
1321     bitmap1.Build(imageInfo);
1322     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1323     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
1324 
1325     // 4.设置视效效果CreateLinearGradient,将效果添加到笔刷
1326     std::vector<Drawing::ColorQuad> colors = { Drawing::Color::COLOR_RED, Drawing::Color::COLOR_GREEN,
1327         Drawing::Color::COLOR_BLUE };
1328     std::vector<Drawing::scalar> pos = { 0.00f, 0.50f, 1.00f };
1329     auto linearGradient = Drawing::ShaderEffect::CreateLinearGradient(
1330         { 0, 0 }, { 1000, 1000 }, colors, pos, Drawing::TileMode::CLAMP); // 0 start pos & 1000 end pos
1331     brush.SetShaderEffect(linearGradient);
1332 
1333     // 5.组合transform函数Rotate
1334     playbackCanvas_->Rotate(30, 10, 10); // 30 angle 10 position
1335 
1336     // 6.绘制结果
1337     const void* pixel = pixmap.GetAddr();
1338     bitmap1.SetPixels(const_cast<void*>(pixel));
1339     playbackCanvas_->AttachBrush(brush);
1340     if (pixmap.ScalePixels(dst, SamplingOptions())) {
1341         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
1342     } else {
1343         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
1344     }
1345     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
1346     playbackCanvas_->DetachBrush();
1347 
1348     // 7.组合Clip函数ClipRoundRect(G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
1349     TestBase::ClipRoundRectG2(true);
1350 }
1351 
1352 // Pixmap_Scene_0145
1353 // Pixmap构造接口:Pixmap_ImageInfo_12
1354 // Pixmap操作接口:GetWidth
1355 // cilp:ClipRoundRect(G2_capsule)
1356 // transform:Translate
1357 // 抗锯齿:非AA
1358 // 透明度:透明
1359 // 视效:CreateSrgbGammaToLinear
1360 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 25)
1361 {
1362     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1363     Drawing::Brush brush;
1364     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1365 
1366     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1367     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1368     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1369         colorspace); // 512 width * 512 height
1370     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1371 
1372     // 3.Pixmap操作接口GetWidth,绘制部分放到第6步的绘制结果里
1373     auto width = pixmap.GetWidth();
1374 
1375     Drawing::Bitmap bitmap1;
1376     bitmap1.Build(imageInfo);
1377     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1378     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
1379 
1380     // 4.设置视效效果CreateSrgbGammaToLinear,将效果添加到笔刷
1381     brush.SetColor(0xFF4F7091);
1382     auto filter = Drawing::Filter();
1383     filter.SetColorFilter(Drawing::ColorFilter::CreateSrgbGammaToLinear());
1384     brush.SetFilter(filter);
1385 
1386     // 5.组合transform函数Translate
1387     playbackCanvas_->Translate(200, 200); // 200 distance
1388 
1389     // 6.绘制结果
1390     const void* pixel = pixmap.GetAddr();
1391     bitmap1.SetPixels(const_cast<void*>(pixel));
1392     playbackCanvas_->AttachBrush(brush);
1393     playbackCanvas_->DrawRect(Rect(0, 0, width, 500)); // width * 500 height
1394     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);    // 250,300 is bitmap position
1395     playbackCanvas_->DetachBrush();
1396 
1397     // 7.组合Clip函数ClipRoundRect(G2_capsule),cilp也有抗锯齿效果,默认和笔刷效果保持一致
1398     TestBase::ClipRoundRectG2capsule(false);
1399 }
1400 
1401 // Pixmap_Scene_0146
1402 // Pixmap构造接口:Pixmap_ImageInfo_12
1403 // Pixmap操作接口:GetWidth
1404 // cilp:null
1405 // transform:Translate
1406 // 抗锯齿:非AA
1407 // 透明度:不透明
1408 // 视效:CreateLinearGradient
1409 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 26)
1410 {
1411     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1412     Drawing::Brush brush;
1413     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1414 
1415     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1416     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1417     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1418         colorspace); // 512 width * 512 height
1419     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1420 
1421     // 3.Pixmap操作接口GetWidth,绘制部分放到第6步的绘制结果里
1422     auto width = pixmap.GetWidth();
1423 
1424     Drawing::Bitmap bitmap1;
1425     bitmap1.Build(imageInfo);
1426     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1427     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
1428 
1429     // 4.设置视效效果CreateLinearGradient,将效果添加到笔刷
1430     std::vector<Drawing::ColorQuad> colors = { Drawing::Color::COLOR_RED, Drawing::Color::COLOR_GREEN,
1431         Drawing::Color::COLOR_BLUE };
1432     std::vector<Drawing::scalar> pos = { 0.00f, 0.50f, 1.00f };
1433     auto linearGradient = Drawing::ShaderEffect::CreateLinearGradient(
1434         { 0, 0 }, { 1000, 1000 }, colors, pos, Drawing::TileMode::CLAMP); // 0 start pos & 1000 end pos
1435     brush.SetShaderEffect(linearGradient);
1436 
1437     // 5.组合transform函数Translate
1438     playbackCanvas_->Translate(200, 200); // 200 distance
1439 
1440     // 6.绘制结果
1441     const void* pixel = pixmap.GetAddr();
1442     bitmap1.SetPixels(const_cast<void*>(pixel));
1443     playbackCanvas_->AttachBrush(brush);
1444     playbackCanvas_->DrawRect(Rect(0, 0, width, 500)); // width * 500 height
1445     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);    // 250,300 is bitmap position
1446     playbackCanvas_->DetachBrush();
1447 
1448     // 7.无Clip函数
1449 }
1450 
1451 // Pixmap_Scene_0147
1452 // Pixmap构造接口:Pixmap_ImageInfo_12
1453 // Pixmap操作接口:GetHeight
1454 // cilp:ClipPath
1455 // transform:Shear
1456 // 抗锯齿:AA
1457 // 透明度:透明
1458 // 视效:CreateBlurMaskFilter
1459 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 27)
1460 {
1461     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
1462     Drawing::Brush brush;
1463     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1464 
1465     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1466     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1467     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1468         colorspace); // 512 width * 512 height
1469     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1470 
1471     // 3.Pixmap操作接口GetHeight,绘制部分放到第6步的绘制结果里
1472     auto height = pixmap.GetHeight();
1473 
1474     Drawing::Bitmap bitmap1;
1475     bitmap1.Build(imageInfo);
1476     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1477     bitmap1.ClearWithColor(0x004567FA); // 透明效果,粉蓝色
1478 
1479     // 4.组合transform函数Shear
1480     playbackCanvas_->Shear(10.0f, 10.0f); // slope
1481 
1482     brush.SetColor(0xFFFF0000);
1483     int rectPos = 0;
1484     for (auto& blurType : blurTypes) {
1485         auto filter = Drawing::Filter();
1486         // 5.设置视效效果CreateBlurMaskFilter,将效果添加到笔刷
1487         filter.SetMaskFilter(Drawing::MaskFilter::CreateBlurMaskFilter(blurType, 10.0f, true));
1488         brush.SetFilter(filter);
1489         // 6.绘制结果
1490         const void* pixel = pixmap.GetAddr();
1491         bitmap1.SetPixels(const_cast<void*>(pixel));
1492         playbackCanvas_->AttachBrush(brush);
1493         playbackCanvas_->DrawRect(Rect(0 + (rectPos % VARIATION) * LEFT, 0 + (rectPos / VARIATION) * LEFT,
1494             500 + (rectPos % VARIATION) * LEFT, height + (rectPos / VARIATION) * LEFT)); // 500 width * height
1495         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
1496             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
1497         rectPos += 200;
1498     }
1499     playbackCanvas_->DetachBrush();
1500 
1501     // 7.组合Clip函数ClipPath,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1502     TestBase::ClipPath(true);
1503 }
1504 
1505 // Pixmap_Scene_0148
1506 // Pixmap构造接口:Pixmap_ImageInfo_12
1507 // Pixmap操作接口:GetHeight
1508 // cilp:ClipRoundRect(非G2)
1509 // transform:Shear
1510 // 抗锯齿:AA
1511 // 透明度:半透明
1512 // 视效:CreateLumaColorFilter
1513 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 28)
1514 {
1515     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:AA
1516     Drawing::Brush brush;
1517     brush.SetAntiAlias(true); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1518 
1519     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1520     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1521     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1522         colorspace); // 512 width * 512 height
1523     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1524 
1525     // 3.Pixmap操作接口GetHeight,绘制部分放到第6步的绘制结果里
1526     auto height = pixmap.GetHeight();
1527 
1528     Drawing::Bitmap bitmap1;
1529     bitmap1.Build(imageInfo);
1530     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1531     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
1532 
1533     // 4.设置视效效果CreateLumaColorFilter,将效果添加到笔刷
1534     brush.SetColor(0xFF0000FF);
1535     auto filter = Drawing::Filter();
1536     filter.SetColorFilter(Drawing::ColorFilter::CreateLumaColorFilter());
1537     brush.SetFilter(filter);
1538 
1539     // 5.组合transform函数Shear
1540     playbackCanvas_->Shear(10.0f, 10.0f); // slope
1541 
1542     // 6.绘制结果
1543     const void* pixel = pixmap.GetAddr();
1544     bitmap1.SetPixels(const_cast<void*>(pixel));
1545     playbackCanvas_->AttachBrush(brush);
1546     playbackCanvas_->DrawRect(Rect(0, 0, 500, height)); // 500 width * height
1547     playbackCanvas_->DrawBitmap(bitmap1, 250, 300);     // 250,300 is bitmap position
1548     playbackCanvas_->DetachBrush();
1549 
1550     // 7.组合Clip函数ClipRoundRect(非G2),cilp也有抗锯齿效果,默认和笔刷效果保持一致
1551     TestBase::ClipRoundRectnotG2(true);
1552 }
1553 
1554 // Pixmap_Scene_0149
1555 // Pixmap构造接口:Pixmap_ImageInfo_12
1556 // Pixmap操作接口:GetColorType
1557 // cilp:ClipRect
1558 // transform:null
1559 // 抗锯齿:非AA
1560 // 透明度:半透明
1561 // 视效:null
1562 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 29)
1563 {
1564     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1565     Drawing::Brush brush;
1566     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1567 
1568     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1569     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1570     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1571         colorspace); // 512 width * 512 height
1572     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1573 
1574     // 3.Pixmap操作接口GetColorType,绘制部分放到第6步的绘制结果里
1575 
1576     Drawing::Bitmap bitmap1;
1577     bitmap1.Build(imageInfo);
1578     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1579     bitmap1.ClearWithColor(0x894567FA); // 半透明效果,粉蓝色
1580 
1581     // 4.无视效效果函数
1582     // 5.无transform函数
1583     // 6.绘制结果
1584     const void* pixel = pixmap.GetAddr();
1585     bitmap1.SetPixels(const_cast<void*>(pixel));
1586     playbackCanvas_->AttachBrush(brush);
1587     if (pixmap.GetColorType() == Drawing::ColorType::COLORTYPE_RGBA_8888) {
1588         playbackCanvas_->DrawRect(Drawing::Rect(800, 800, 1000, 1000)); // rect region(800, 800, 1000, 1000)
1589     } else {
1590         playbackCanvas_->DrawRect(Drawing::Rect(1000, 1000, 1200, 1200)); // rect region(1000, 1000, 1200, 1200)
1591     }
1592     playbackCanvas_->DrawBitmap(bitmap1, 250, 300); // 250,300 is bitmap position
1593     playbackCanvas_->DetachBrush();
1594 
1595     // 7.组合Clip函数ClipRect,cilp也有抗锯齿效果,默认和笔刷效果保持一致
1596     TestBase::ClipRect(false);
1597 }
1598 
1599 // Pixmap_Scene_0150
1600 // Pixmap构造接口:Pixmap_ImageInfo_12
1601 // Pixmap操作接口:GetColorType
1602 // cilp:null
1603 // transform:null
1604 // 抗锯齿:非AA
1605 // 透明度:不透明
1606 // 视效:CreateBlendImageFilter
1607 DEF_DTK(DTK_Pixmap_Scene5, TestLevel::L2, 30)
1608 {
1609     // 1.创建笔刷,设置笔刷是否为抗锯齿效果,抗锯齿:非AA
1610     Drawing::Brush brush;
1611     brush.SetAntiAlias(false); // 设置笔刷抗锯齿,true为AA(抗锯齿),false为非AA(不抗锯齿)
1612 
1613     // 2.Pixmap构造接口,Pixmap_ImageInfo_12
1614     auto colorspace = Drawing::ColorSpace::CreateSRGB();
1615     ImageInfo imageInfo(512, 512, Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::AlphaType::ALPHATYPE_UNKNOWN,
1616         colorspace); // 512 width * 512 height
1617     Pixmap pixmap(imageInfo, nullptr, imageInfo.GetBytesPerPixel() * imageInfo.GetWidth());
1618 
1619     // 3.Pixmap操作接口GetColorType,绘制部分放到第6步的绘制结果里
1620 
1621     Drawing::Bitmap bitmap1;
1622     bitmap1.Build(imageInfo);
1623     // 设置透明度, 由填充的颜色值的前两位控制,00为透明效果,89为半透明,FF为不透明
1624     bitmap1.ClearWithColor(0xFF4567FA); // 不透明效果,粉蓝色
1625 
1626     // 4.无transform函数
1627 
1628     brush.SetColor(0x4CB21933);
1629     int rectPos = 0;
1630     for (auto blendMode : blendModes) {
1631         auto background = Drawing::ImageFilter::CreateBlurImageFilter(
1632             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
1633         auto foreground = Drawing::ImageFilter::CreateBlurImageFilter(
1634             1.0f, 1.0f, Drawing::TileMode::REPEAT, nullptr, Drawing::ImageBlurType::GAUSS);
1635         auto filter = Drawing::Filter();
1636         // 5.设置视效效果CreateBlendImageFilter,将效果添加到笔刷
1637         filter.SetImageFilter(Drawing::ImageFilter::CreateBlendImageFilter(blendMode, background, foreground));
1638         brush.SetFilter(filter);
1639 
1640         // 6.绘制结果
1641         const void* pixel = pixmap.GetAddr();
1642         bitmap1.SetPixels(const_cast<void*>(pixel));
1643         playbackCanvas_->Save();
1644         playbackCanvas_->AttachBrush(brush);
1645         if (pixmap.GetColorType() == Drawing::ColorType::COLORTYPE_RGBA_8888) {
1646             playbackCanvas_->DrawRect(Drawing::Rect(800 + (rectPos % VARIATION) * LEFT,
1647                 800 + (rectPos / VARIATION) * LEFT, 1000 + (rectPos % VARIATION) * LEFT,
1648                 1000 + (rectPos / VARIATION) * LEFT)); // rect region(800, 800, 1000, 1000)
1649         } else {
1650             playbackCanvas_->DrawRect(Drawing::Rect(1000 + (rectPos % VARIATION) * LEFT,
1651                 1000 + (rectPos / VARIATION) * LEFT, 1200 + (rectPos % VARIATION) * LEFT,
1652                 1200 + (rectPos / VARIATION) * LEFT)); // rect region(1000, 1000, 1200, 1200)
1653         }
1654         playbackCanvas_->DrawBitmap(bitmap1, 250 + (rectPos % VARIATION) * LEFT,
1655             300 + (rectPos / VARIATION) * RIGHT); // 250,300 is bitmap position
1656         playbackCanvas_->Restore();
1657         rectPos += 1;
1658     }
1659     playbackCanvas_->DetachBrush();
1660 
1661     // 7.无Clip函数
1662 }
1663 
1664 } // namespace Rosen
1665 } // namespace OHOS