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

Side by Side Diff: include/images/SkImageEncoder.h

Issue 15002004: add encodeData() to SkImageEncoder, and add encoding to SkImage (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef SkImageEncoder_DEFINED 8 #ifndef SkImageEncoder_DEFINED
9 #define SkImageEncoder_DEFINED 9 #define SkImageEncoder_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 class SkBitmap; 13 class SkBitmap;
14 class SkData;
14 class SkWStream; 15 class SkWStream;
15 16
16 class SkImageEncoder { 17 class SkImageEncoder {
17 public: 18 public:
18 enum Type { 19 enum Type {
19 kUnknown_Type, 20 kUnknown_Type,
20 kBMP_Type, 21 kBMP_Type,
21 kGIF_Type, 22 kGIF_Type,
22 kICO_Type, 23 kICO_Type,
23 kJPEG_Type, 24 kJPEG_Type,
24 kPNG_Type, 25 kPNG_Type,
25 kWBMP_Type, 26 kWBMP_Type,
26 kWEBP_Type, 27 kWEBP_Type,
27 }; 28 };
28 static SkImageEncoder* Create(Type); 29 static SkImageEncoder* Create(Type);
29 30
30 virtual ~SkImageEncoder(); 31 virtual ~SkImageEncoder();
31 32
32 /* Quality ranges from 0..100 */ 33 /* Quality ranges from 0..100 */
33 enum { 34 enum {
34 kDefaultQuality = 80 35 kDefaultQuality = 80
35 }; 36 };
36 37
37 /** 38 /**
38 * Encode bitmap 'bm' in the desired format, writing results to 39 * Encode bitmap 'bm' in the desired format, writing results to
39 * file 'file', at quality level 'quality' (which can be in range 40 * file 'file', at quality level 'quality' (which can be in range
scroggo 2013/05/16 17:34:41 This comment is no longer correct. It does not wri
reed1 2013/05/16 17:55:02 Done.
40 * 0-100). 41 * 0-100).
41 * 42 *
42 * Calls the particular implementation's onEncode() method to 43 * Calls the particular implementation's onEncode() method to
43 * actually do the encoding. 44 * actually do the encoding.
44 */ 45 */
46 SkData* encodeData(const SkBitmap&, int quality);
47
48 /**
49 * Encode bitmap 'bm' in the desired format, writing results to
50 * file 'file', at quality level 'quality' (which can be in range
51 * 0-100).
52 *
53 * Calls the particular implementation's onEncode() method to
54 * actually do the encoding.
55 */
45 bool encodeFile(const char file[], const SkBitmap& bm, int quality); 56 bool encodeFile(const char file[], const SkBitmap& bm, int quality);
46 57
47 /** 58 /**
48 * Encode bitmap 'bm' in the desired format, writing results to 59 * Encode bitmap 'bm' in the desired format, writing results to
49 * stream 'stream', at quality level 'quality' (which can be in 60 * stream 'stream', at quality level 'quality' (which can be in
50 * range 0-100). 61 * range 0-100).
51 * 62 *
52 * Calls the particular implementation's onEncode() method to 63 * Calls the particular implementation's onEncode() method to
53 * actually do the encoding. 64 * actually do the encoding.
54 */ 65 */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 /** An ARGBImageEncoder will always write out 98 /** An ARGBImageEncoder will always write out
88 * bitmap.width() * bitmap.height() * 4 99 * bitmap.width() * bitmap.height() * 4
89 * bytes. 100 * bytes.
90 */ 101 */
91 DECLARE_ENCODER_CREATOR(ARGBImageEncoder); 102 DECLARE_ENCODER_CREATOR(ARGBImageEncoder);
92 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); 103 DECLARE_ENCODER_CREATOR(JPEGImageEncoder);
93 DECLARE_ENCODER_CREATOR(PNGImageEncoder); 104 DECLARE_ENCODER_CREATOR(PNGImageEncoder);
94 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); 105 DECLARE_ENCODER_CREATOR(WEBPImageEncoder);
95 106
96 #endif 107 #endif
OLDNEW
« include/core/SkImage.h ('K') | « include/core/SkImage.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698