forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcel_data.h
More file actions
51 lines (40 loc) · 1.31 KB
/
cel_data.h
File metadata and controls
51 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Aseprite Document Library
// Copyright (c) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef DOC_CEL_DATA_H_INCLUDED
#define DOC_CEL_DATA_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "doc/image_ref.h"
#include "doc/object.h"
#include "doc/with_user_data.h"
namespace doc {
class CelData : public WithUserData {
public:
CelData(const ImageRef& image);
CelData(const CelData& celData);
const gfx::Point& position() const { return m_position; }
int opacity() const { return m_opacity; }
Image* image() const { return const_cast<Image*>(m_image.get()); };
ImageRef imageRef() const { return m_image; }
void setImage(const ImageRef& image);
void setPosition(int x, int y) {
m_position.x = x;
m_position.y = y;
}
void setPosition(const gfx::Point& pos) { m_position = pos; }
void setOpacity(int opacity) { m_opacity = opacity; }
virtual int getMemSize() const override {
ASSERT(m_image);
return sizeof(CelData) + m_image->getMemSize();
}
private:
ImageRef m_image;
gfx::Point m_position; // X/Y screen position
int m_opacity; // Opacity level
};
typedef base::SharedPtr<CelData> CelDataRef;
} // namespace doc
#endif