OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 265 matching lines...) Loading... | |
276 * will determines how the pixel valuess are intepreted. If the bitmap is | 276 * will determines how the pixel valuess are intepreted. If the bitmap is |
277 * not kARGB_8888_Config then this parameter is ignored. | 277 * not kARGB_8888_Config then this parameter is ignored. |
278 * | 278 * |
279 * Note: If you are recording drawing commands on this canvas to | 279 * Note: If you are recording drawing commands on this canvas to |
280 * SkPicture, writePixels() is ignored! | 280 * SkPicture, writePixels() is ignored! |
281 */ | 281 */ |
282 void writePixels(const SkBitmap& bitmap, | 282 void writePixels(const SkBitmap& bitmap, |
283 int x, int y, | 283 int x, int y, |
284 Config8888 config8888 = kNative_Premul_Config8888); | 284 Config8888 config8888 = kNative_Premul_Config8888); |
285 | 285 |
286 /** | |
287 * This method affects the pixels in the base-layer, and operates in pixel coordinates, | |
288 * ignoring the matrix and clip. | |
289 * | |
290 * The specified ImageInfo and (x,y) offset specifies a rectangle: target. | |
291 * | |
292 * target.setXYWH(x, y, info.width(), info.height()); | |
293 * | |
294 * Target is intersected with the bounds of the base-layer. If this interse ction is not empty, | |
295 * then we have two sets of pixels (of equal size), the "src" specified by info+pixels+rowBytes | |
296 * and the "dst" by the canvas' backend. Replace the dst pixels with the co rresponding src | |
297 * pixels, performing any colortype/alphatype transformations needed (in th e case where the | |
robertphillips
2014/03/05 23:19:19
missing ')'
reed1
2014/03/06 16:49:48
Done.
| |
298 * src and dst have different colortypes or alphatypes. | |
299 * | |
300 * This call can fail, returning false, for several reasons: | |
301 * - If the src colortype/alphatype cannot be converted to the canvas' type s | |
302 * - If this canvas is not backed by pixels (e.g. picture or PDF) | |
303 */ | |
304 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); | |
305 | |
306 bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowByte s) { | |
bsalomon
2014/03/05 21:08:32
is this one useful?
reed1
2014/03/06 16:49:48
No. Removed.
| |
307 return this->writePixels(info, pixels, rowBytes, 0, 0); | |
308 } | |
309 | |
286 /////////////////////////////////////////////////////////////////////////// | 310 /////////////////////////////////////////////////////////////////////////// |
287 | 311 |
288 enum SaveFlags { | 312 enum SaveFlags { |
289 /** save the matrix state, restoring it on restore() */ | 313 /** save the matrix state, restoring it on restore() */ |
290 kMatrix_SaveFlag = 0x01, | 314 kMatrix_SaveFlag = 0x01, |
291 /** save the clip state, restoring it on restore() */ | 315 /** save the clip state, restoring it on restore() */ |
292 kClip_SaveFlag = 0x02, | 316 kClip_SaveFlag = 0x02, |
293 /** the layer needs to support per-pixel alpha */ | 317 /** the layer needs to support per-pixel alpha */ |
294 kHasAlphaLayer_SaveFlag = 0x04, | 318 kHasAlphaLayer_SaveFlag = 0x04, |
295 /** the layer needs to support 8-bits per color component */ | 319 /** the layer needs to support 8-bits per color component */ |
(...skipping 1076 matching lines...) Loading... | |
1372 bool asROBitmap(SkBitmap*) const; | 1396 bool asROBitmap(SkBitmap*) const; |
1373 | 1397 |
1374 private: | 1398 private: |
1375 SkBitmap fBitmap; // used if peekPixels() fails | 1399 SkBitmap fBitmap; // used if peekPixels() fails |
1376 const void* fAddr; // NULL on failure | 1400 const void* fAddr; // NULL on failure |
1377 SkImageInfo fInfo; | 1401 SkImageInfo fInfo; |
1378 size_t fRowBytes; | 1402 size_t fRowBytes; |
1379 }; | 1403 }; |
1380 | 1404 |
1381 #endif | 1405 #endif |
OLD | NEW |