diff --git a/openbr/plugins/gallery/vec.cpp b/openbr/plugins/gallery/vec.cpp index 2b96aa5..77766f8 100644 --- a/openbr/plugins/gallery/vec.cpp +++ b/openbr/plugins/gallery/vec.cpp @@ -9,7 +9,7 @@ namespace br * \author Scott Klum \cite sklum */ -class vecGallery : public Gallery +class vecGallery : public FileGallery { Q_OBJECT @@ -18,27 +18,56 @@ class vecGallery : public Gallery BR_PROPERTY(int, width, 24) BR_PROPERTY(int, height, 24) - TemplateList readBlock(bool *done) + QList mats; + + ~vecGallery() { - *done = true; + if (mats.isEmpty()) + return; + + writeOpen(); + + // Write header + int count = mats.size(); + int size = width*height; + short temp = 0; + + const size_t write1 = f.write((char*)&count,sizeof(count)); + const size_t write2 = f.write((char*)&size,sizeof(size)); + const size_t write3 = f.write((char*)&temp,sizeof(temp)); + const size_t write4 = f.write((char*)&temp,sizeof(temp)); + + if (write1 != sizeof(count) || write2 != sizeof(size) || write3 != sizeof(temp) || write4 != sizeof(temp)) + qFatal("Failed to write header."); + + for (int i=0; i