forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskia_utils_ios.h
46 lines (35 loc) · 1.44 KB
/
skia_utils_ios.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKIA_EXT_SKIA_UTILS_IOS_H_
#define SKIA_EXT_SKIA_UTILS_IOS_H_
#include <CoreGraphics/CoreGraphics.h>
#include <vector>
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#ifdef __OBJC__
@class UIColor;
@class UIImage;
@class NSData;
#else
class UIColor;
class UIImage;
class NSData;
#endif
namespace skia {
// Draws a CGImage into an SkBitmap of the given size.
SK_API SkBitmap CGImageToSkBitmap(CGImageRef image,
CGSize size,
bool is_opaque);
// Given an SkBitmap and a color space, return an autoreleased UIImage.
SK_API UIImage* SkBitmapToUIImageWithColorSpace(const SkBitmap& skia_bitmap,
CGFloat scale,
CGColorSpaceRef color_space);
// Decodes all image representations inside the data into a vector of SkBitmaps.
// Returns a vector of all the successfully decoded representations or an empty
// vector if none can be decoded.
SK_API std::vector<SkBitmap> ImageDataToSkBitmaps(NSData* image_data);
// Returns a UIColor for an SKColor. Used by iOS downstream.
SK_API UIColor* UIColorFromSkColor(SkColor color);
} // namespace skia
#endif // SKIA_EXT_SKIA_UTILS_IOS_H_