Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / docs / examples / skpaint_color_table_filter.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(skpaint_color_table_filter, 256, 256, false, 3) {
5 void draw(SkCanvas* canvas) {
6     canvas->scale(0.5, 0.5);
7     uint8_t ct[256];
8     for (int i = 0; i < 256; ++i) {
9         int x = (i - 96) * 255 / 64;
10         ct[i] = x < 0 ? 0 : x > 255 ? 255 : x;
11     }
12     SkPaint paint;
13     paint.setColorFilter(SkTableColorFilter::MakeARGB(nullptr, ct, ct, ct));
14     canvas->drawImage(image, 0, 0, SkSamplingOptions(), &paint);
15 }
16 }  // END FIDDLE