File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
// Aseprite
2
+ // Copyright (c) 2018 Igara Studio S.A.
2
3
// Copyright (C) 2018 David Capello
3
4
//
4
5
// This program is distributed under the terms of
@@ -56,6 +57,14 @@ int ImageSpec_gc(lua_State* L)
56
57
return 0 ;
57
58
}
58
59
60
+ int ImageSpec_eq (lua_State* L)
61
+ {
62
+ auto a = get_obj<doc::ImageSpec>(L, 1 );
63
+ auto b = get_obj<doc::ImageSpec>(L, 2 );
64
+ lua_pushboolean (L, *a == *b);
65
+ return 1 ;
66
+ }
67
+
59
68
int ImageSpec_get_colorMode (lua_State* L)
60
69
{
61
70
const auto spec = get_obj<doc::ImageSpec>(L, 1 );
@@ -114,6 +123,7 @@ int ImageSpec_set_transparentColor(lua_State* L)
114
123
115
124
const luaL_Reg ImageSpec_methods[] = {
116
125
{ " __gc" , ImageSpec_gc },
126
+ { " __eq" , ImageSpec_eq },
117
127
{ nullptr , nullptr }
118
128
};
119
129
Original file line number Diff line number Diff line change @@ -60,6 +60,19 @@ namespace doc {
60
60
m_height = sz.h ;
61
61
}
62
62
63
+ bool operator ==(const ImageSpec& that) const {
64
+ return (m_colorMode == that.m_colorMode &&
65
+ m_width == that.m_width &&
66
+ m_height == that.m_height &&
67
+ m_maskColor == that.m_maskColor &&
68
+ ((!m_colorSpace && !that.m_colorSpace ) ||
69
+ (m_colorSpace && that.m_colorSpace &&
70
+ m_colorSpace->nearlyEqual (*that.m_colorSpace ))));
71
+ }
72
+ bool operator !=(const ImageSpec& that) const {
73
+ return !operator ==(that);
74
+ }
75
+
63
76
private:
64
77
ColorMode m_colorMode;
65
78
int m_width;
You can’t perform that action at this time.
0 commit comments