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

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 | « gm/aaclip.cpp ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
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 an SkBitmap and copy the image's pixels into it. I f scaleToFit is not
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);
34
35 /**
36 * Copy the pixels from src into the memory specified by info/rowBytes/dstPixel s. On failure,
37 * return false (e.g. ImageInfo incompatible with src).
38 */
39 SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, vo id* dstPixels,
40 CGImageRef src);
41
42 /**
26 * Create an imageref from the specified bitmap using the specified colorspace. 43 * Create an imageref from the specified bitmap using the specified colorspace.
27 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. 44 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
28 */ 45 */
29 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, 46 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
30 CGColorSpaceRef space); 47 CGColorSpaceRef space);
31 48
32 /** 49 /**
33 * Create an imageref from the specified bitmap using the colorspace returned 50 * Create an imageref from the specified bitmap using the colorspace returned
34 * by CGColorSpaceCreateDeviceRGB() 51 * by CGColorSpaceCreateDeviceRGB()
35 */ 52 */
(...skipping 22 matching lines...) Expand all
58 * CGDataProviderRef provider = SkStreamToDataProvider(stream); 75 * CGDataProviderRef provider = SkStreamToDataProvider(stream);
59 * stream->unref(); 76 * stream->unref();
60 * 77 *
61 * Now when the provider is finally deleted, it will delete the stream. 78 * Now when the provider is finally deleted, it will delete the stream.
62 */ 79 */
63 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); 80 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*);
64 81
65 CGDataProviderRef SkCreateDataProviderFromData(SkData*); 82 CGDataProviderRef SkCreateDataProviderFromData(SkData*);
66 83
67 #endif 84 #endif
OLDNEW
« no previous file with comments | « gm/aaclip.cpp ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698