provider_factory.h Source File - ClanLib SDK
Description: provider_factory.h Source File

provider_factory.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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*/
29
30#pragma once
31
32#include <map>
33#include "../../Core/IOData/file_system.h"
34
35namespace clan
36{
39
40 class PixelBuffer;
41 class ImageProviderType;
42
44 class ImageProviderFactory
45 {
46 public:
53 static PixelBuffer try_load(
54 const std::string &filename,
55 const std::string &type = std::string(),
56 const FileSystem &fs = FileSystem(),
57 std::string *out_failure_reason = nullptr,
58 bool srgb = false);
59
62
65 static PixelBuffer load(
66 const std::string &filename,
67 const FileSystem &fs,
68 const std::string &type = std::string(),
69 bool srgb = false);
70
71 static PixelBuffer load(
72 const std::string &fullname,
73 const std::string &type = std::string(),
74 bool srgb = false);
75
76 static PixelBuffer load(
77 IODevice &file,
78 const std::string &type,
79 bool srgb = false);
80
82
84 static void save(
85 PixelBuffer buffer,
86 const std::string &filename,
87 FileSystem &fs,
88 const std::string &type = std::string());
89
90 static void save(
91 PixelBuffer buffer,
92 const std::string &fullname,
93 const std::string &type = std::string());
94
95 static void save(
96 PixelBuffer buffer,
97 IODevice &file,
98 const std::string &type);
99 };
100
102}
clan::FileSystem
Virtual File System (VFS).
Definition file_system.h:47
clan::IODevice
I/O Device interface.
Definition iodevice.h:50
clan::ImageProviderFactory
Image Provider factory.
Definition provider_factory.h:45
clan::ImageProviderFactory::save
static void save(PixelBuffer buffer, IODevice &file, const std::string &type)
clan::ImageProviderFactory::load
static PixelBuffer load(const std::string &fullname, const std::string &type=std::string(), bool srgb=false)
clan::ImageProviderFactory::load
static PixelBuffer load(IODevice &file, const std::string &type, bool srgb=false)
clan::ImageProviderFactory::try_load
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'.
clan::ImageProviderFactory::save
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'.
clan::ImageProviderFactory::load
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.
clan::ImageProviderFactory::save
static void save(PixelBuffer buffer, const std::string &fullname, const std::string &type=std::string())
clan::PixelBuffer
Pixel data container.
Definition pixel_buffer.h:68
clan
Definition clanapp.h:36