@@ -71,6 +71,19 @@ void D1GfxFrame::setFrameType(D1CEL_FRAME_TYPE type)
71
71
this ->frameType = type;
72
72
}
73
73
74
+ void D1GfxFrame::addPixelLine (QList<D1GfxPixel> &pixelLine)
75
+ {
76
+ this ->pixels .append (pixelLine);
77
+ this ->height ++;
78
+ /* if (this->width != pixelLine.size()) {
79
+ if (this->width != 0) {
80
+ dProgressErr() << QString("Mismatching lines.");
81
+ }*/
82
+ if (this ->width == 0 ) {
83
+ this ->width = pixelLine.size ();
84
+ }
85
+ }
86
+
74
87
bool D1Gfx::isFrameSizeConstant ()
75
88
{
76
89
if (this ->frames .isEmpty ()) {
@@ -119,20 +132,26 @@ QImage D1Gfx::getFrameImage(quint16 frameIndex)
119
132
return image;
120
133
}
121
134
122
- D1GfxFrame *D1Gfx::insertFrame (int idx, const QImage &image )
135
+ D1GfxFrame *D1Gfx::insertFrame (int idx, bool *clipped )
123
136
{
124
- bool clipped;
125
-
126
137
if (!this ->frames .isEmpty ()) {
127
- clipped = this ->frames [0 ].isClipped ();
138
+ * clipped = this ->frames [0 ].isClipped ();
128
139
} else {
129
- clipped = this ->type == D1CEL_TYPE::V2_MONO_GROUP || this ->type == D1CEL_TYPE::V2_MULTIPLE_GROUPS;
140
+ * clipped = this ->type == D1CEL_TYPE::V2_MONO_GROUP || this ->type == D1CEL_TYPE::V2_MULTIPLE_GROUPS;
130
141
}
131
142
132
- D1GfxFrame frame;
133
- D1ImageFrame::load (frame, image, clipped, this ->palette );
134
- this ->frames .insert (idx, frame);
143
+ this ->frames .insert (idx, D1GfxFrame ());
135
144
this ->modified = true ;
145
+ return &this ->frames [idx];
146
+ }
147
+
148
+ D1GfxFrame *D1Gfx::insertFrame (int idx, const QImage &image)
149
+ {
150
+ bool clipped;
151
+
152
+ D1GfxFrame *frame = this ->insertFrame (idx, &clipped);
153
+ D1ImageFrame::load (*frame, image, clipped, this ->palette );
154
+ // this->modified = true;
136
155
137
156
if (this ->groupFrameIndices .isEmpty ()) {
138
157
// create new group if this is the first frame
@@ -213,9 +232,9 @@ bool D1Gfx::isModified() const
213
232
return this ->modified ;
214
233
}
215
234
216
- void D1Gfx::setModified ()
235
+ void D1Gfx::setModified (bool modified )
217
236
{
218
- this ->modified = true ;
237
+ this ->modified = modified ;
219
238
}
220
239
221
240
bool D1Gfx::isUpscaled () const
@@ -234,6 +253,11 @@ QString D1Gfx::getFilePath() const
234
253
return this ->gfxFilePath ;
235
254
}
236
255
256
+ D1Pal *D1Gfx::getPalette ()
257
+ {
258
+ return this ->palette ;
259
+ }
260
+
237
261
void D1Gfx::setPalette (D1Pal *pal)
238
262
{
239
263
this ->palette = pal;
@@ -265,6 +289,12 @@ D1GfxFrame *D1Gfx::getFrame(int frameIndex) const
265
289
return const_cast <D1GfxFrame *>(&this ->frames [frameIndex]);
266
290
}
267
291
292
+ void D1Gfx::setFrame (int frameIndex, const D1GfxFrame &frame)
293
+ {
294
+ this ->frames [frameIndex] = frame;
295
+ this ->modified = true ;
296
+ }
297
+
268
298
int D1Gfx::getFrameWidth (int frameIndex) const
269
299
{
270
300
if (frameIndex < 0 || frameIndex >= this ->frames .count ())
0 commit comments