@@ -36,8 +36,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromNpArray(
36
36
int width,
37
37
int height,
38
38
const Enum::BlendMode blend_mode,
39
- int pos_x,
40
- int pos_y,
39
+ float pos_x,
40
+ float pos_y,
41
41
float opacity,
42
42
const Enum::Compression compression,
43
43
const Enum::ColorMode color_mode,
@@ -48,10 +48,6 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromNpArray(
48
48
typename Layer<T>::Params params;
49
49
// Do some preliminary checks since python has no concept of e.g. unsigned integers (without ctypes)
50
50
// so we must ensure the range ourselves
51
- if (layer_name.size () > 255 )
52
- {
53
- throw py::value_error (" layer_name parameter cannot exceed a length of 255" );
54
- }
55
51
if (layer_mask.has_value ())
56
52
{
57
53
if (static_cast <uint64_t >(width) * height != layer_mask.value ().size ())
@@ -79,8 +75,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromNpArray(
79
75
80
76
params.name = layer_name;
81
77
params.blendmode = blend_mode;
82
- params.center_x = pos_x;
83
- params.center_y = pos_y;
78
+ params.center_x = static_cast < int32_t >( pos_x) ;
79
+ params.center_y = static_cast < int32_t >( pos_y) ;
84
80
params.width = width;
85
81
params.height = height;
86
82
params.opacity = static_cast <uint8_t >(opacity * 255 );
@@ -104,8 +100,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIDMapping(
104
100
int width,
105
101
int height,
106
102
const Enum::BlendMode blend_mode,
107
- int pos_x,
108
- int pos_y,
103
+ float pos_x,
104
+ float pos_y,
109
105
float opacity,
110
106
const Enum::Compression compression,
111
107
const Enum::ColorMode color_mode,
@@ -116,10 +112,6 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIDMapping(
116
112
typename Layer<T>::Params params;
117
113
// Do some preliminary checks since python has no concept of e.g. unsigned integers (without ctypes)
118
114
// so we must ensure the range ourselves
119
- if (layer_name.size () > 255 )
120
- {
121
- throw py::value_error (" layer_name parameter cannot exceed a length of 255" );
122
- }
123
115
if (layer_mask.has_value ())
124
116
{
125
117
if (static_cast <uint64_t >(width) * height != layer_mask.value ().size ())
@@ -150,8 +142,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIDMapping(
150
142
151
143
params.name = layer_name;
152
144
params.blendmode = blend_mode;
153
- params.center_x = pos_x;
154
- params.center_y = pos_y;
145
+ params.center_x = static_cast < int32_t >( pos_x) ;
146
+ params.center_y = static_cast < int32_t >( pos_y) ;
155
147
params.width = width;
156
148
params.height = height;
157
149
params.opacity = static_cast <uint8_t >(opacity * 255 );
@@ -175,8 +167,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIntMapping(
175
167
int width,
176
168
int height,
177
169
const Enum::BlendMode blend_mode,
178
- int pos_x,
179
- int pos_y,
170
+ float pos_x,
171
+ float pos_y,
180
172
float opacity,
181
173
const Enum::Compression compression,
182
174
const Enum::ColorMode color_mode,
@@ -187,10 +179,6 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIntMapping(
187
179
typename Layer<T>::Params params;
188
180
// Do some preliminary checks since python has no concept of e.g. unsigned integers (without ctypes)
189
181
// so we must ensure the range ourselves
190
- if (layer_name.size () > 255 )
191
- {
192
- throw py::value_error (" layer_name parameter cannot exceed a length of 255" );
193
- }
194
182
if (layer_mask.has_value ())
195
183
{
196
184
if (static_cast <uint64_t >(width) * height != layer_mask.value ().size ())
@@ -220,8 +208,8 @@ std::shared_ptr<ImageLayer<T>> createImageLayerFromIntMapping(
220
208
221
209
params.name = layer_name;
222
210
params.blendmode = blend_mode;
223
- params.center_x = pos_x;
224
- params.center_y = pos_y;
211
+ params.center_x = static_cast < int32_t >( pos_x) ;
212
+ params.center_y = static_cast < int32_t >( pos_y) ;
225
213
params.width = width;
226
214
params.height = height;
227
215
params.opacity = static_cast <uint8_t >(opacity * 255 );
0 commit comments