skia2/tools/Resources.h
Mike Reed 271d1d9001 Change SkTypeface::MakeFromStream to take unique_ptr
Also, add MakeFromData variant, which matches SkFontMgr

Bug: skia:8350
Change-Id: Ia220496bab8ecf0e7eefaf0c8b62d88ea1394a17
Reviewed-on: https://skia-review.googlesource.com/150969
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-09-04 15:24:12 +00:00

40 lines
980 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef Resources_DEFINED
#define Resources_DEFINED
#include "SkImage.h"
#include "SkString.h"
class SkBitmap;
class SkData;
class SkStreamAsset;
class SkTypeface;
SkString GetResourcePath(const char* resource = "");
void SetResourcePath(const char* );
bool DecodeDataToBitmap(sk_sp<SkData> data, SkBitmap* dst);
sk_sp<SkData> GetResourceAsData(const char* resource);
inline bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) {
return DecodeDataToBitmap(GetResourceAsData(resource), dst);
}
inline sk_sp<SkImage> GetResourceAsImage(const char* resource) {
return SkImage::MakeFromEncoded(GetResourceAsData(resource));
}
std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource);
sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource, int ttcIndex = 0);
#endif // Resources_DEFINED