ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Image.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for OpenGL, SDL2 and GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 */
17
18#pragma once
19
20#include <SDL_video.h>
21
22#include <Objectively/Resource.h>
23
25
31typedef struct Image Image;
32typedef struct ImageInterface ImageInterface;
33
38struct Image {
39
43 Object object;
44
49 ImageInterface *interface;
50
54 SDL_Surface *surface;
55
59 const char *type;
60};
61
65struct ImageInterface {
66
70 ObjectInterface objectInterface;
71
81 Image *(*imageWithBytes)(const uint8_t *bytes, size_t length);
82
91 Image *(*imageWithData)(const Data *data);
92
101 Image *(*imageWithResource)(const Resource *resource);
102
111 Image *(*imageWithResourceName)(const char *name);
112
121 Image *(*imageWithSurface)(SDL_Surface *surface);
122
132 Image *(*initWithBytes)(Image *self, const uint8_t *bytes, size_t length);
133
142 Image *(*initWithData)(Image *self, const Data *data);
143
152 Image *(*initWithResource)(Image *self, const Resource *resource);
153
162 Image *(*initWithResourceName)(Image *self, const char *name);
163
176 Image *(*initWithSurface)(Image *self, SDL_Surface *surface);
177
184 SDL_Size (*size)(const Image *self);
185};
186
193OBJECTIVELYMVC_EXPORT Class *_Image(void);
static SDL_Size size(const Image *self)
Definition: Image.c:181
ObjectivelyMVC base types.
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
Image loading.
Definition: Image.h:38
ImageInterface * interface
The interface.
Definition: Image.h:49
const char * type
The image type, inferred if instantiated with a Resource.
Definition: Image.h:59
Class * _Image(void)
The Image archetype.
Definition: Image.c:211
SDL_Surface * surface
The backing surface.
Definition: Image.h:54
Object object
The superclass.
Definition: Image.h:43
The SDL_Size type.
Definition: Types.h:62