Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / docs / examples / f16to8888busted.cpp
1 // Copyright 2020 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(f16to8888busted, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6     // Create the linear-rgb color space and the image info
7     sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGBLinear();
8     SkImageInfo info = SkImageInfo::Make(100, 100, SkColorType::kRGBA_F16_SkColorType,
9                                          SkAlphaType::kPremul_SkAlphaType, colorSpace);
10
11     sk_sp<SkSurface> offscreen = SkSurface::MakeRaster(info);
12     SkPaint paint;
13     offscreen->getCanvas()->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), paint);
14
15     // Take a snapshot from surface and draw it on the canvas
16     sk_sp<SkImage> img = offscreen->makeImageSnapshot();
17     canvas->drawImageRect(img, SkRect::MakeWH(100, 100), SkSamplingOptions());
18 }
19 }  // END FIDDLE