#include <assert.h>
#include "AtlasImage.h"
#include "ImageAtlas.h"
Go to the source code of this file.
◆ _Class
◆ _AtlasImage()
| Class * _AtlasImage |
( |
void |
| ) |
|
Definition at line 84 of file AtlasImage.c.
84 {
85 static Class *clazz;
86 static Once once;
87
88 do_once(&once, {
89 clazz = _initialize(&(const ClassDef) {
90 .name = "AtlasImage",
93 .interfaceSize = sizeof(AtlasImageInterface),
95 });
96 });
97
98 return clazz;
99}
static void initialize(Class *clazz)
An Image packed into an ImageAtlas.
◆ initialize()
| static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 74 of file AtlasImage.c.
74 {
75
76 ((AtlasImageInterface *) clazz->interface)->initWithImage =
initWithImage;
78}
static AtlasImage * initWithImage(AtlasImage *self, ImageAtlas *atlas, Image *image)
static SDL_FRect texcoords(const AtlasImage *self)
SDL_FRect texcoords(const AtlasImage *self)
Resolves this AtlasImage's normalized texture coordinates within the atlas Texture.
◆ initWithImage()
Definition at line 32 of file AtlasImage.c.
32 {
33
34 assert(atlas);
37
39 if (self) {
42 self->
rect = (SDL_Rect) { 0, 0, 0, 0 };
43 }
44
45 return self;
46}
static Image * initWithSurface(Image *self, SDL_Surface *surface)
static Image * image(Theme *self, const char *name, float pixelDensity)
SDL_Rect rect
This AtlasImage's rectangle within the atlas sheet, in texels.
Image image
The superclass.
ImageAtlas * atlas
The ImageAtlas this AtlasImage belongs to, or NULL once that atlas has been released,...
float scale
Pixels of surface per point: 1 for raster images, the requested scale for SVG.
SDL_Surface * surface
The backing surface.
◆ texcoords()
| static SDL_FRect texcoords |
( |
const AtlasImage * |
self | ) |
|
|
static |
Definition at line 52 of file AtlasImage.c.
52 {
53
55 if (sheet == NULL) {
56 return (SDL_FRect) { 0.f, 0.f, 0.f, 0.f };
57 }
58
59 const float w = (float) sheet->
surface->w, h = (
float) sheet->
surface->h;
60
61 return (SDL_FRect) {
66 };
67}
Image * image
The compiled sheet, or NULL until ImageAtlas::compile.