Mana
Loading...
Searching...
No Matches
imageset.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "resources/resource.h"
25
26#include <vector>
27
28class Image;
29
33class ImageSet : public Resource
34{
35 public:
39 ImageSet(Image *img, int w, int h, int margin = 0, int spacing = 0);
40
41 ImageSet(const ImageSet&) = delete;
42 ImageSet& operator=(const ImageSet&) = delete;
43
44 ~ImageSet() override;
45
49 int getWidth() const { return mWidth; }
50
54 int getHeight() const { return mHeight; }
55
56 Image *get(size_t i) const;
57
58 size_t size() const { return mImages.size(); }
59
60 int getOffsetX() const
61 { return mOffsetX; }
62
63 void setOffsetX(int n)
64 { mOffsetX = n; }
65
66 int getOffsetY() const
67 { return mOffsetY; }
68
69 void setOffsetY(int n)
70 { mOffsetY = n; }
71
72 private:
73 std::vector<Image*> mImages;
74
75 int mWidth;
76 int mHeight;
77 int mOffsetX = 0;
78 int mOffsetY = 0;
79};
Stores a set of subimages originating from a single image.
Definition imageset.h:34
int getWidth() const
Returns the width of the images in the image set.
Definition imageset.h:49
ImageSet(const ImageSet &)=delete
ImageSet & operator=(const ImageSet &)=delete
std::vector< Image * > mImages
Definition imageset.h:73
int mOffsetY
Definition imageset.h:78
void setOffsetY(int n)
Definition imageset.h:69
int mWidth
Width of the images in the image set.
Definition imageset.h:75
void setOffsetX(int n)
Definition imageset.h:63
int getOffsetY() const
Definition imageset.h:66
int mOffsetX
Definition imageset.h:77
~ImageSet() override
Definition imageset.cpp:44
Image * get(size_t i) const
Definition imageset.cpp:49
int getOffsetX() const
Definition imageset.h:60
int mHeight
Height of the images in the image set.
Definition imageset.h:76
size_t size() const
Definition imageset.h:58
int getHeight() const
Returns the height of the images in the image set.
Definition imageset.h:54
Defines a class for loading and storing images.
Definition image.h:45
A generic reference counted resource object.
Definition resource.h:31