--Boundary-00=_Fdz9H7CSHOnWacX Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline I wrote a simple (not optimized) version of the algorithm. It takes as input a set of rects from command line (x,y,w,h) and calculates the non overlapping regions of them. This solves one of the two problems in my idea, the second being the difficulty of finding "visible" layers. Even without a solution to this second problem, I think that this way to do layer updating is very clear, linear, without strange recursive needs of visitors and the like. And it works directly as a bottom-up update strategy, so that adj. layers as well as alpha blending can be easily taken into account. The executable is in: www.valinor.it/test2 --Boundary-00=_Fdz9H7CSHOnWacX Content-Type: text/x-c++src; charset="iso-8859-1"; name="main.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="main.cpp" #include #include #include using namespace std; QVector findNonOverlapping(QVector list) { if (list.size() <= 1) { if (list.size() == 1 && list[0].isEmpty()) list.clear(); return list; } else { QVector list1; QVector list2; list1.append(list[1]); list2.append(list[0] ^ list[1]); for (int i = 2; i < list.size(); i++) { list1.append(list[i] & list1[0]); list2.append(list[i] & list2[0]); } return findNonOverlapping(list1) + findNonOverlapping(list2); } } int main(int argc, char *argv[]) { QVector starting; int x,y,w,h; char c = 'c'; cout << "Base rect: "; cin >> x >> y >> w >> h; starting.append(QRegion(x,y,w,h)); // QRegion base = QRegion(x,y,w,h); while (c == 'c') { cout << "New rect: "; cin >> x >> y >> w >> h >> c; starting.append(QRegion(x,y,w,h) & starting[0]); } QVector final = findNonOverlapping(starting); qDebug() << final; return 0; } --Boundary-00=_Fdz9H7CSHOnWacX Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kimageshop mailing list kimageshop@kde.org https://mail.kde.org/mailman/listinfo/kimageshop --Boundary-00=_Fdz9H7CSHOnWacX--