|
|
|
|
114
|
|
114
|
|
115
|
2. If the following `4 x 4` image of pixels represents the object `originalImage`,
|
115
|
2. If the following `4 x 4` image of pixels represents the object `originalImage`,
|
116
|
|
116
|
|
117
|
- ![ejemplo.png](images/ejemplo.png)
|
|
|
|
|
117
|
+ ![ejemplo.png](images/ejemplo.png)
|
118
|
|
118
|
|
119
|
- then `originalImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
|
|
|
|
119
|
+ then `originalImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
120
|
|
120
|
|
121
|
3. The following instruction assigns the color red to the pixel in position `(2,3)` in the edited image:
|
121
|
3. The following instruction assigns the color red to the pixel in position `(2,3)` in the edited image:
|
122
|
|
122
|
|
123
|
- `editedImage.setPixel(2,3,qRgb(0xff,0x00,0x00));`.
|
|
|
|
|
123
|
+ `editedImage.setPixel(2,3,qRgb(0xff,0x00,0x00));`.
|
124
|
|
124
|
|
125
|
4. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `originalImage`:
|
125
|
4. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `originalImage`:
|
126
|
|
126
|
|
127
|
- `int greenContent = qGreen(originalImage.pixel(1,1));`.
|
|
|
|
|
127
|
+ `int greenContent = qGreen(originalImage.pixel(1,1));`.
|
128
|
|
128
|
|
129
|
5. The following program creates an object of the `QImage` class and prints the red, green and blue components of the pixel in the center of the image. The image used is the one specified within the parenthesis during the creation of the object, that is, the file `chuck.png`
|
129
|
5. The following program creates an object of the `QImage` class and prints the red, green and blue components of the pixel in the center of the image. The image used is the one specified within the parenthesis during the creation of the object, that is, the file `chuck.png`
|
130
|
|
130
|
|