5 QFile openFile(filePath);
7 if(openFile.open(QIODevice::WriteOnly)) {
9 QTextStream out(&openFile);
11 size_t numberOfLayers = layerBundle->size();
15 out << numberOfLayers << endl;
16 for(
size_t i = 0; i<numberOfLayers; i++) {
17 int width = layerBundle->at(i).width;
18 int height = layerBundle->at(i).height;
20 out << height << endl;
21 out << layerBundle->at(i).widthOffset << endl;
22 out << layerBundle->at(i).heightOffset << endl;
23 out << layerBundle->at(i).alpha << endl;
29 std::vector<QPoint> points = layerBundle->at(i).image->getPolygonData();
30 out << points.size() <<
" ";
31 for(
size_t j = 0; j<points.size(); j++) {
32 out << points.at(j).x() <<
" " << points.at(j).y() <<
" ";
34 for(
int j = 0; j<height; j++) {
35 for(
int k = 0; k<width; k++) {
36 QColor pixColor = layerBundle->at(i).image->getImageData().pixelColor(j,k);
37 out << pixColor.red() <<
" " << pixColor.green() <<
" " << pixColor.blue() <<
" " << pixColor.alpha() <<
" ";
42 out <<
"\nFormat designed and approved by IntelliPhoto Team 7. All rigths reserved.";
51 QFile openFile(filePath);
53 if(openFile.open(QIODevice::ReadOnly)) {
54 QTextStream in(&openFile);
58 int widthCanvas, heightCanvas, numberOffLayers;
61 in >> widthCanvas >> heightCanvas;
62 in >> numberOffLayers;
65 for(
int i = 0; i<numberOffLayers; i++) {
66 int width, height, widthOffset, heightOffset, alpha;
67 in >> width >> height >> widthOffset >> heightOffset >> alpha;
70 size_t numberOfPoints;
71 std::vector<QPoint> polyPoints;
73 in >> typeFlag >> numberOfPoints;
79 polyPoints.reserve(numberOfPoints);
80 for(
size_t j = 0; j<numberOfPoints; j++) {
83 polyPoints.push_back(QPoint(x,y));
87 for(
int j = 0; j<height; j++) {
88 for(
int k = 0; k<width; k++) {
89 int red, green, blue, alpha;
90 in >> red >> green >> blue >> alpha;