OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2014 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL |
| 9 // DO NOT USE -- FOR INTERNAL TESTING ONLY |
| 10 |
| 11 #include "sk_canvas.h" |
| 12 #include "sk_paint.h" |
| 13 #include "sk_shader.h" |
| 14 #include "sk_surface.h" |
| 15 |
| 16 extern void sk_test_c_api(sk_canvas_t*); |
| 17 |
| 18 #define W 256 |
| 19 #define H 256 |
| 20 |
| 21 static sk_shader_t* make_shader() { |
| 22 sk_point_t pts[] = { { 0, 0 }, { W, H } }; |
| 23 sk_color_t colors[] = { 0xFF00FF00, 0xFF0000FF }; |
| 24 return sk_shader_new_linear_gradient(pts, colors, NULL, 2, CLAMP_SK_SHADER_T
ILEMODE, NULL); |
| 25 } |
| 26 |
| 27 void sk_test_c_api(sk_canvas_t* canvas) { |
| 28 sk_paint_t* paint = sk_paint_new(); |
| 29 sk_paint_set_antialias(paint, true); |
| 30 |
| 31 sk_paint_set_color(paint, 0xFFFFFFFF); |
| 32 sk_canvas_draw_paint(canvas, paint); |
| 33 |
| 34 sk_rect_t r = { 10, 10, W - 10, H - 10 }; |
| 35 |
| 36 sk_paint_set_color(paint, 0xFFFF0000); |
| 37 sk_canvas_draw_rect(canvas, &r, paint); |
| 38 |
| 39 sk_shader_t* shader = make_shader(); |
| 40 sk_paint_set_shader(paint, shader); |
| 41 sk_shader_unref(shader); |
| 42 |
| 43 sk_canvas_draw_oval(canvas, &r, paint); |
| 44 |
| 45 sk_paint_delete(paint); |
| 46 } |
| 47 |
| 48 |
OLD | NEW |