OLD | NEW |
(Empty) | |
| 1 #include "SkCanvas.h" |
| 2 #include "SkGraphics.h" |
| 3 #include "SkImageEncoder.h" |
| 4 #include "SkImageInfo.h" |
| 5 #include "SkForceLinking.h" |
| 6 |
| 7 int main() { |
| 8 SkForceLinking(false); |
| 9 SkGraphics::Init(); |
| 10 |
| 11 SkImageInfo info = SkImageInfo::MakeN32(300, 300, kPremul_SkAlphaType); |
| 12 SkBitmap bitmap; |
| 13 bitmap.setConfig(info); |
| 14 bitmap.allocPixels(); |
| 15 SkCanvas c(bitmap); |
| 16 c.drawColor(SK_ColorWHITE); |
| 17 |
| 18 $usercode |
| 19 |
| 20 if (!SkImageEncoder::EncodeFile("foo.png", bitmap, SkImageEncoder::kPNG_Type
, 100)) { |
| 21 printf("Failed to encode\n"); |
| 22 } |
| 23 } |
OLD | NEW |