Home | History | Annotate | Download | only in c
      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 #ifndef sk_types_DEFINED
     12 #define sk_types_DEFINED
     13 
     14 #include <stdint.h>
     15 #include <stddef.h>
     16 
     17 #ifdef __cplusplus
     18     #define SK_C_PLUS_PLUS_BEGIN_GUARD    extern "C" {
     19     #define SK_C_PLUS_PLUS_END_GUARD      }
     20 #else
     21     #include <stdbool.h>
     22     #define SK_C_PLUS_PLUS_BEGIN_GUARD
     23     #define SK_C_PLUS_PLUS_END_GUARD
     24 #endif
     25 
     26 ///////////////////////////////////////////////////////////////////////////////////////
     27 
     28 SK_C_PLUS_PLUS_BEGIN_GUARD
     29 
     30 typedef uint32_t sk_color_t;
     31 
     32 #define sk_color_set_argb(a, r, g, b)   (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
     33 #define sk_color_get_a(c)               (((c) >> 24) & 0xFF)
     34 #define sk_color_get_r(c)               (((c) >> 16) & 0xFF)
     35 #define sk_color_get_g(c)               (((c) >>  8) & 0xFF)
     36 #define sk_color_get_b(c)               (((c) >>  0) & 0xFF)
     37 
     38 typedef enum {
     39     UNKNOWN_SK_COLORTYPE,
     40     RGBA_8888_SK_COLORTYPE,
     41     BGRA_8888_SK_COLORTYPE,
     42     ALPHA_8_SK_COLORTYPE,
     43 } sk_colortype_t;
     44 
     45 typedef enum {
     46     OPAQUE_SK_ALPHATYPE,
     47     PREMUL_SK_ALPHATYPE,
     48     UNPREMUL_SK_ALPHATYPE,
     49 } sk_alphatype_t;
     50 
     51 typedef enum {
     52     INTERSECT_SK_CLIPTYPE,
     53     DIFFERENCE_SK_CLIPTYPE,
     54 } sk_cliptype_t;
     55 
     56 sk_colortype_t sk_colortype_get_default_8888();
     57 
     58 typedef struct {
     59     int32_t         width;
     60     int32_t         height;
     61     sk_colortype_t  colorType;
     62     sk_alphatype_t  alphaType;
     63 } sk_imageinfo_t;
     64 
     65 typedef struct {
     66     float   x;
     67     float   y;
     68 } sk_point_t;
     69 
     70 typedef struct {
     71     float   left;
     72     float   top;
     73     float   right;
     74     float   bottom;
     75 } sk_rect_t;
     76 
     77 typedef struct {
     78     float   mat[9];
     79 } sk_matrix_t;
     80 
     81 typedef struct sk_canvas_t sk_canvas_t;
     82 typedef struct sk_data_t sk_data_t;
     83 typedef struct sk_image_t sk_image_t;
     84 typedef struct sk_maskfilter_t sk_maskfilter_t;
     85 typedef struct sk_paint_t sk_paint_t;
     86 typedef struct sk_path_t sk_path_t;
     87 typedef struct sk_picture_t sk_picture_t;
     88 typedef struct sk_picture_recorder_t sk_picture_recorder_t;
     89 typedef struct sk_shader_t sk_shader_t;
     90 typedef struct sk_surface_t sk_surface_t;
     91 
     92 //////////////////////////////////////////////////////////////////////////////////////////
     93 
     94 #ifdef __cplusplus
     95     class SkCanvas;
     96     void sk_test_capi(SkCanvas*);
     97 #endif
     98 
     99 SK_C_PLUS_PLUS_END_GUARD
    100 
    101 #endif
    102