ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Image.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for SDL3 and 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 <SDL3/SDL_video.h>
21
22#include <Objectively/Resource.h>
23
25
31typedef struct Image Image;
32typedef struct ImageInterface ImageInterface;
33
41struct Image {
42
46 Object object;
47
52 ImageInterface *interface[0];
53
57 float scale;
58
62 SDL_Surface *surface;
63
67 const char *type;
68};
69
73struct ImageInterface {
74
78 ObjectInterface objectInterface;
79
90 Image *(*imageWithBytes)(const uint8_t *bytes, size_t length, float pixelDensity);
91
101 Image *(*imageWithData)(const Data *data, float pixelDensity);
102
112 Image *(*imageWithResource)(const Resource *resource, float pixelDensity);
113
123 Image *(*imageWithResourceName)(const char *name, float pixelDensity);
124
135 Image *(*imageWithSVG)(const uint8_t *bytes, size_t length, float scale);
136
145 Image *(*imageWithSurface)(SDL_Surface *surface);
146
157 Image *(*initWithBytes)(Image *self, const uint8_t *bytes, size_t length, float pixelDensity);
158
168 Image *(*initWithData)(Image *self, const Data *data, float pixelDensity);
169
179 Image *(*initWithResource)(Image *self, const Resource *resource, float pixelDensity);
180
197 Image *(*initWithResourceName)(Image *self, const char *name, float pixelDensity);
198
210 Image *(*initWithSVG)(Image *self, const uint8_t *bytes, size_t length, float scale);
211
224 Image *(*initWithSVGSize)(Image *self, const uint8_t *bytes, size_t length, SDL_Size points, float pixelDensity);
225
238 Image *(*initWithSurface)(Image *self, SDL_Surface *surface);
239
246 SDL_Size (*size)(const Image *self);
247};
248
255OBJECTIVELYMVC_EXPORT Class *_Image(void);
static String * name(const Font *self)
Definition Font.c:303
OBJECTIVELYMVC_EXPORT Class * _Image(void)
Definition Image.c:452
ObjectivelyMVC base types.
#define OBJECTIVELYMVC_EXPORT
Definition Types.h:40
Image loading.
Definition Image.h:41
const char * type
The image type, inferred if instantiated with a Resource.
Definition Image.h:67
float scale
Pixels of surface per point: 1 for raster images, the requested scale for SVG.
Definition Image.h:57
SDL_Surface * surface
The backing surface.
Definition Image.h:62
Object object
The superclass.
Definition Image.h:46
ImageInterface * interface[0]
The interface type.
Definition Image.h:52