blob: b79d18b211758cfb35dfeccdcac1a2078faefe52 [file] [log] [blame]
tfarinabcbc1782014-06-18 14:32:48 -07001/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef Resources_DEFINED
9#define Resources_DEFINED
10
Kevin Lubick8b741882023-10-06 11:41:38 -040011#include "include/core/SkData.h" // IWYU pragma: keep
12#include "include/core/SkRefCnt.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "include/core/SkString.h"
tfarinabcbc1782014-06-18 14:32:48 -070014
Kevin Lubick8b741882023-10-06 11:41:38 -040015#include <memory>
Kevin Lubick225d5102023-05-23 07:04:53 -040016#include <string>
17
bungeman3ffa1262015-04-30 17:12:58 -040018class SkStreamAsset;
halcanary30b83d42014-10-26 05:23:53 -070019
tfarinabcbc1782014-06-18 14:32:48 -070020SkString GetResourcePath(const char* resource = "");
Mike Reed0933bc92017-12-09 01:27:41 +000021
Kevin Lubick8b741882023-10-06 11:41:38 -040022void SetResourcePath(const char*);
Mike Reed0933bc92017-12-09 01:27:41 +000023
Mike Reedcca23002017-12-08 21:09:12 +000024sk_sp<SkData> GetResourceAsData(const char* resource);
Mike Reed0933bc92017-12-09 01:27:41 +000025
John Stiles26bf5222023-10-17 10:29:41 -040026inline sk_sp<SkData> GetResourceAsData(const std::string& resource) {
Kevin Lubick225d5102023-05-23 07:04:53 -040027 return GetResourceAsData(resource.c_str());
28}
29
Brian Osman2f160c22023-01-23 09:32:29 -050030std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource,
31 bool useFileStream = false);
Mike Reed0933bc92017-12-09 01:27:41 +000032
tfarinabcbc1782014-06-18 14:32:48 -070033#endif // Resources_DEFINED