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

Last change on this file since 958 was 958, checked in by sam, 11 years ago

osx: automake does not support .mm files yet, so rename ios-image.mm back
to ios-image.cpp, but disable it on OS X because UIKit isn't available.

  • Property svn:keywords set to Id
File size: 1.3 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 __APPLE__ && defined __MACH__ && defined __arm__
32    REGISTER_IMAGE_LOADER(IosImageData)
33#endif
34#if defined __CELLOS_LV2__
35    REGISTER_IMAGE_LOADER(Ps3ImageData)
36#endif
37#if defined USE_SDL_IMAGE
38    REGISTER_IMAGE_LOADER(SdlImageData)
39#endif
40
41    return true;
42}
43
44/*
45 * Public Image class
46 */
47
48Image::Image(char const *path)
49{
50    static bool unused = ImageLoader::RegisterAllLoaders();
51
52    data = ImageLoader::Load(path);
53}
54
55ivec2 Image::GetSize() const
56{
57    return data->size;
58}
59
60Image::format_t Image::GetFormat() const
61{
62    return data->format;
63}
64
65void * Image::GetData() const
66{
67    return data->GetData();
68}
69
70Image::~Image()
71{
72    data->Close();
73    delete data;
74}
75
76} /* namespace lol */
77
Note: See TracBrowser for help on using the repository browser.