source: trunk/src/image/image.cpp @ 981

Last change on this file since 981 was 981, checked in by sam, 9 years ago

image: add a GDI+ loader.

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cmath>
16
17#include "core.h"
18#include "image-private.h"
19
20using namespace std;
21
22namespace lol
23{
24
25bool ImageLoader::RegisterAllLoaders()
26{
27#if defined __ANDROID__
28    REGISTER_IMAGE_LOADER(AndroidImageData)
29#endif
30    REGISTER_IMAGE_LOADER(DummyImageData)
31#if defined USE_GDIPLUS
32    REGISTER_IMAGE_LOADER(GdiPlusImageData)
33#endif
34#if defined __APPLE__ && defined __MACH__ && defined __arm__
35    REGISTER_IMAGE_LOADER(IosImageData)
36#endif
37#if defined __CELLOS_LV2__
38    REGISTER_IMAGE_LOADER(Ps3ImageData)
39#endif
40#if defined USE_SDL_IMAGE
41    REGISTER_IMAGE_LOADER(SdlImageData)
42#endif
43
44    return true;
45}
46
47/*
48 * Public Image class
49 */
50
51Image::Image(char const *path)
52{
53    static bool unused = ImageLoader::RegisterAllLoaders();
54
55    data = ImageLoader::Load(path);
56}
57
58ivec2 Image::GetSize() const
59{
60    return data->size;
61}
62
63Image::format_t Image::GetFormat() const
64{
65    return data->format;
66}
67
68void * Image::GetData() const
69{
70    return data->GetData();
71}
72
73Image::~Image()
74{
75    data->Close();
76    delete data;
77}
78
79} /* namespace lol */
80
Note: See TracBrowser for help on using the repository browser.