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

Side by Side Diff: include/utils/mac/SkCGUtils.h

Issue 243463005: expose CGImage -> SkBitmap (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | src/ports/SkImageDecoder_CG.cpp » ('j') | src/ports/SkImageDecoder_CG.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SkCGUtils_DEFINED 8 #ifndef SkCGUtils_DEFINED
9 #define SkCGUtils_DEFINED 9 #define SkCGUtils_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkSize.h"
12 #include "SkImageInfo.h"
12 13
13 #ifdef SK_BUILD_FOR_MAC 14 #ifdef SK_BUILD_FOR_MAC
14 #include <ApplicationServices/ApplicationServices.h> 15 #include <ApplicationServices/ApplicationServices.h>
15 #endif 16 #endif
16 17
17 #ifdef SK_BUILD_FOR_IOS 18 #ifdef SK_BUILD_FOR_IOS
18 #include <CoreGraphics/CoreGraphics.h> 19 #include <CoreGraphics/CoreGraphics.h>
19 #endif 20 #endif
20 21
21 class SkBitmap; 22 class SkBitmap;
22 class SkData; 23 class SkData;
23 class SkStream; 24 class SkStream;
24 25
25 /** 26 /**
27 * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. I f scaleToFit is not
scroggo 2014/04/21 20:18:44 nit: an SkBitmap nit: image's
reed1 2014/04/21 20:44:41 Done.
28 * null, use it to determine the size of the bitmap, and scale the image to fil l the bitmap.
29 * Otherwise use the image's width/height.
30 *
31 * On failure, return false, and leave bitmap unchanged.
32 */
33 SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* sc aleToFit = NULL);
scroggo 2014/04/21 20:18:44 This version is unused. Does Chrome want it?
reed1 2014/04/21 20:44:41 Yes, this is explicit added for chrome!
34
35 /**
36 * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. I f scaleToFit is not
hal.canary 2014/04/21 20:15:51 that's now what this does.
scroggo 2014/04/21 20:18:44 This comment describes the other function, not thi
reed1 2014/04/21 20:44:41 You caught me copy-pasting. Done.
37 * null, use it to determine the size of the bitmap, and scale the image to fil l the bitmap.
38 * Otherwise use the image's width/height.
39 *
40 * On failure, return false, and leave bitmap unchanged.
41 */
42 SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, vo id* pixels,
43 CGImageRef src);
44
45 /**
26 * Create an imageref from the specified bitmap using the specified colorspace. 46 * Create an imageref from the specified bitmap using the specified colorspace.
27 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. 47 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
28 */ 48 */
29 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, 49 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
30 CGColorSpaceRef space); 50 CGColorSpaceRef space);
31 51
32 /** 52 /**
33 * Create an imageref from the specified bitmap using the colorspace returned 53 * Create an imageref from the specified bitmap using the colorspace returned
34 * by CGColorSpaceCreateDeviceRGB() 54 * by CGColorSpaceCreateDeviceRGB()
35 */ 55 */
(...skipping 22 matching lines...) Expand all
58 * CGDataProviderRef provider = SkStreamToDataProvider(stream); 78 * CGDataProviderRef provider = SkStreamToDataProvider(stream);
59 * stream->unref(); 79 * stream->unref();
60 * 80 *
61 * Now when the provider is finally deleted, it will delete the stream. 81 * Now when the provider is finally deleted, it will delete the stream.
62 */ 82 */
63 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); 83 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*);
64 84
65 CGDataProviderRef SkCreateDataProviderFromData(SkData*); 85 CGDataProviderRef SkCreateDataProviderFromData(SkData*);
66 86
67 #endif 87 #endif
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkImageDecoder_CG.cpp » ('j') | src/ports/SkImageDecoder_CG.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698