OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
11 #include "SkAlpha.h" | 11 #include "SkImageInfo.h" |
12 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 #include "SkScalar.h" | 14 #include "SkScalar.h" |
15 | 15 |
16 class SkData; | 16 class SkData; |
17 class SkCanvas; | 17 class SkCanvas; |
18 class SkPaint; | 18 class SkPaint; |
19 class SkShader; | 19 class SkShader; |
20 class GrContext; | 20 class GrContext; |
21 class GrTexture; | 21 class GrTexture; |
22 | 22 |
23 // need for TileMode | 23 // need for TileMode |
24 #include "SkShader.h" | 24 #include "SkShader.h" |
25 | 25 |
26 enum SkColorType { | |
27 kAlpha_8_SkColorType, | |
28 kRGB_565_SkColorType, | |
29 kRGBA_8888_SkColorType, | |
30 kBGRA_8888_SkColorType, | |
31 | |
32 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) | |
33 kPMColor_SkColorType = kBGRA_8888_SkColorType, | |
34 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) | |
35 kPMColor_SkColorType = kRGBA_8888_SkColorType, | |
36 #else | |
37 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order" | |
38 #endif | |
39 | |
40 kIndex8_SkColorType, | |
41 kLastEnum_SkColorType = kIndex8_SkColorType | |
42 }; | |
43 | |
44 struct SkImageInfo { | |
45 int fWidth; | |
46 int fHeight; | |
47 SkColorType fColorType; | |
48 SkAlphaType fAlphaType; | |
49 }; | |
50 | |
51 bool operator==(const SkImageInfo& lhs, const SkImageInfo& rhs); | |
52 bool operator!=(const SkImageInfo& lhs, const SkImageInfo& rhs); | |
53 | |
54 /** | 26 /** |
55 * SkImage is an abstraction for drawing a rectagle of pixels, though the | 27 * SkImage is an abstraction for drawing a rectagle of pixels, though the |
56 * particular type of image could be actually storing its data on the GPU, or | 28 * particular type of image could be actually storing its data on the GPU, or |
57 * as drawing commands (picture or PDF or otherwise), ready to be played back | 29 * as drawing commands (picture or PDF or otherwise), ready to be played back |
58 * into another canvas. | 30 * into another canvas. |
59 * | 31 * |
60 * The content of SkImage is always immutable, though the actual storage may | 32 * The content of SkImage is always immutable, though the actual storage may |
61 * change, if for example that image can be re-created via encoded data or | 33 * change, if for example that image can be re-created via encoded data or |
62 * other means. | 34 * other means. |
63 */ | 35 */ |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const int fWidth; | 119 const int fWidth; |
148 const int fHeight; | 120 const int fHeight; |
149 const uint32_t fUniqueID; | 121 const uint32_t fUniqueID; |
150 | 122 |
151 static uint32_t NextUniqueID(); | 123 static uint32_t NextUniqueID(); |
152 | 124 |
153 typedef SkRefCnt INHERITED; | 125 typedef SkRefCnt INHERITED; |
154 }; | 126 }; |
155 | 127 |
156 #endif | 128 #endif |
OLD | NEW |