2014-06-18 21:32:48 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkImage.h"
|
|
|
|
#include "include/core/SkString.h"
|
2014-06-18 21:32:48 +00:00
|
|
|
|
2014-10-26 12:23:53 +00:00
|
|
|
class SkBitmap;
|
2016-12-21 17:01:12 +00:00
|
|
|
class SkData;
|
2015-04-30 21:12:58 +00:00
|
|
|
class SkStreamAsset;
|
|
|
|
class SkTypeface;
|
2014-10-26 12:23:53 +00:00
|
|
|
|
2014-06-18 21:32:48 +00:00
|
|
|
SkString GetResourcePath(const char* resource = "");
|
2017-12-09 01:27:41 +00:00
|
|
|
|
2014-07-11 19:14:51 +00:00
|
|
|
void SetResourcePath(const char* );
|
2014-06-18 21:32:48 +00:00
|
|
|
|
2017-12-09 01:27:41 +00:00
|
|
|
bool DecodeDataToBitmap(sk_sp<SkData> data, SkBitmap* dst);
|
|
|
|
|
2017-12-08 21:09:12 +00:00
|
|
|
sk_sp<SkData> GetResourceAsData(const char* resource);
|
2017-12-09 01:27:41 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-09-04 01:10:10 +00:00
|
|
|
sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource, int ttcIndex = 0);
|
2014-10-26 12:23:53 +00:00
|
|
|
|
2014-06-18 21:32:48 +00:00
|
|
|
#endif // Resources_DEFINED
|