Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: experimental/sk_surface.h

Issue 665203004: move c api into include (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | experimental/sk_surface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef sk_types_DEFINED
9 #define sk_types_DEFINED
10
11 #include <stdint.h>
12 #include <stddef.h>
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 typedef uint32_t sk_color_t;
19
20 #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
21 #define sk_color_get_a(c) (((c) >> 24) & 0xFF)
22 #define sk_color_get_r(c) (((c) >> 16) & 0xFF)
23 #define sk_color_get_g(c) (((c) >> 8) & 0xFF)
24 #define sk_color_get_b(c) (((c) >> 0) & 0xFF)
25
26 typedef enum {
27 UNKNOWN_SK_COLORTYPE,
28 RGBA_8888_SK_COLORTYPE,
29 BGRA_8888_SK_COLORTYPE,
30 ALPHA_8_SK_COLORTYPE,
31 } sk_colortype_t;
32
33 typedef enum {
34 PREMUL_SK_ALPHATYPE,
35 UNPREMUL_SK_ALPHATYPE,
36 } sk_alphatype_t;
37
38 typedef struct {
39 int32_t width;
40 int32_t height;
41 sk_colortype_t colorType;
42 sk_alphatype_t alphaType;
43 } sk_imageinfo_t;
44
45 typedef struct {
46 float left;
47 float top;
48 float right;
49 float bottom;
50 } sk_rect_t;
51
52 typedef struct sk_path_t sk_path_t;
53
54 sk_path_t* sk_path_new();
55 void sk_path_delete(sk_path_t*);
56 void sk_path_move_to(sk_path_t*, float x, float y);
57 void sk_path_line_to(sk_path_t*, float x, float y);
58 void sk_path_quad_to(sk_path_t*, float x0, float y0, float x1, float y1);
59 void sk_path_close(sk_path_t*);
60
61 typedef struct sk_paint_t sk_paint_t;
62
63 sk_paint_t* sk_paint_new();
64 void sk_paint_delete(sk_paint_t*);
65 bool sk_paint_is_antialias(const sk_paint_t*);
66 void sk_paint_set_antialias(sk_paint_t*, bool);
67 sk_color_t sk_paint_get_color(const sk_paint_t*);
68 void sk_paint_set_color(sk_paint_t*, sk_color_t);
69
70 typedef struct sk_canvas_t sk_canvas_t;
71 typedef struct sk_image_t sk_image_t;
72
73 void sk_canvas_save(sk_canvas_t*);
74 void sk_canvas_save_layer(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
75 void sk_canvas_restore(sk_canvas_t*);
76
77 void sk_canvas_translate(sk_canvas_t*, float dx, float dy);
78 void sk_canvas_scale(sk_canvas_t*, float sx, float sy);
79
80 void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*);
81 void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
82 void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
83 void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*);
84 void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y, con st sk_paint_t*);
85
86 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels, size_t rowBytes);
87 void sk_image_ref(const sk_image_t*);
88 void sk_image_unref(const sk_image_t*);
89 int sk_image_get_width(const sk_image_t*);
90 int sk_image_get_height(const sk_image_t*);
91 uint32_t sk_image_get_unique_id(const sk_image_t*);
92
93 typedef struct sk_surface_t sk_surface_t;
94
95 sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*);
96 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels, size_t rowBytes);
97 void sk_surface_delete(sk_surface_t*);
98 sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
99 sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
100
101 #ifdef __cplusplus
102 class SkCanvas;
103 void sk_test_capi(SkCanvas*);
104 }
105 #endif
106
107 #endif
OLDNEW
« no previous file with comments | « no previous file | experimental/sk_surface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698