|
|
|
|
127
|
|
127
|
|
128
|
The project which you will be working on today contains the `cropSwap` function that implements the functionality of exchanging the pixels contains in two congruent rectangles within an image. Its prototype is:
|
128
|
The project which you will be working on today contains the `cropSwap` function that implements the functionality of exchanging the pixels contains in two congruent rectangles within an image. Its prototype is:
|
129
|
|
129
|
|
130
|
-```
|
|
|
131
|
-void ImageScrambler::cropSwap(QImage &img, int x0, int y0, int x1, int y1, int width, int height );
|
|
|
132
|
-```
|
|
|
|
|
130
|
+`void ImageScrambler::cropSwap(QImage &img, int x0, int y0, int x1, int y1, int width, int height );`
|
|
|
131
|
+
|
133
|
|
132
|
|
134
|
Its parameters are:
|
133
|
Its parameters are:
|
135
|
* `img`: reference to the image that we wish to modify (an object of the `QImage` class)
|
134
|
* `img`: reference to the image that we wish to modify (an object of the `QImage` class)
|
|
|
|
|
138
|
|
137
|
|
139
|
For example, if we wish to exchange the pixels of the upper and lower halves of an image *P* with width 100 and height 150, we invoke the function:
|
138
|
For example, if we wish to exchange the pixels of the upper and lower halves of an image *P* with width 100 and height 150, we invoke the function:
|
140
|
|
139
|
|
141
|
-```
|
|
|
142
|
-cropSwap(P, 0, 0, 0, 75, 100, 75 );
|
|
|
143
|
-```
|
|
|
|
|
140
|
+`cropSwap(P, 0, 0, 0, 75, 100, 75 );`
|
144
|
|
141
|
|
145
|
|
142
|
|
146
|
----
|
143
|
----
|