provider_factory.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Mark Page
28 ** (if your name is missing here, please add it)
29 */
30 
31 
32 #pragma once
33 
34 #include <map>
35 #include "../../Core/IOData/file_system.h"
36 
37 namespace clan
38 {
41 
42 class PixelBuffer;
43 class ImageProviderType;
44 
47 {
50 
51 public:
52 
56 
57 public:
65  const std::string &filename,
66  const std::string &type = std::string(),
67  const FileSystem &fs = FileSystem(),
68  std::string *out_failure_reason = nullptr,
69  bool srgb = false);
70 
73 
76  static PixelBuffer load(
77  const std::string &filename,
78  const FileSystem &fs,
79  const std::string &type = std::string(),
80  bool srgb = false);
81 
82  static PixelBuffer load(
83  const std::string &fullname,
84  const std::string &type = std::string(),
85  bool srgb = false);
86 
87  static PixelBuffer load(
88  IODevice &file,
89  const std::string &type,
90  bool srgb = false);
91 
93 
95  static void save(
96  PixelBuffer buffer,
97  const std::string &filename,
98  FileSystem &fs,
99  const std::string &type = std::string());
100 
101  static void save(
102  PixelBuffer buffer,
103  const std::string &fullname,
104  const std::string &type = std::string());
105 
106  static void save(
107  PixelBuffer buffer,
108  IODevice &file,
109  const std::string &type);
111 };
112 
113 }
114 
static PixelBuffer load(IODevice &file, const std::string &type, bool srgb=false)
static void save(PixelBuffer buffer, IODevice &file, const std::string &type)
I/O Device interface.
Definition: iodevice.h:51
static void save(PixelBuffer buffer, const std::string &fullname, const std::string &type=std::string())
static PixelBuffer load(const std::string &filename, const FileSystem &fs, const std::string &type=std::string(), bool srgb=false)
Loads an image file from 'filename', using the provider.
static PixelBuffer load(const std::string &fullname, const std::string &type=std::string(), bool srgb=false)
Definition: clanapp.h:36
Virtual File System (VFS).
Definition: file_system.h:48
static void save(PixelBuffer buffer, const std::string &filename, FileSystem &fs, const std::string &type=std::string())
Saves the given PixelBuffer to the file given by 'filename'.
Pixel data container.
Definition: pixel_buffer.h:69
static PixelBuffer try_load(const std::string &filename, const std::string &type=std::string(), const FileSystem &fs=FileSystem(), std::string *out_failure_reason=nullptr, bool srgb=false)
Attempts to load an image file from 'filename', using the provider identified by 'type'.
Image Provider factory.
Definition: provider_factory.h:47