|
|
|
|
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)
|
|
|
118
|
-
|
|
|
|
|
117
|
+ ![ejemplo.png](images/ejemplo.png)
|
119
|
then `originalImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
118
|
then `originalImage.pixel(2,1)` returns the `rgb` value that represents the color blue ( `0x0000ff`).
|
120
|
|
119
|
|
121
|
3. The following instruction assigns the color red to the pixel in position `(2,3)` in the edited image:
|
120
|
3. The following instruction assigns the color red to the pixel in position `(2,3)` in the edited image:
|
122
|
-
|
|
|
123
|
`editedImage.setPixel(2,3,qRgb(0xff,0x00,0x00));`.
|
121
|
`editedImage.setPixel(2,3,qRgb(0xff,0x00,0x00));`.
|
124
|
|
122
|
|
125
|
4. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `originalImage`:
|
123
|
4. The following instruction assigns to `greenContent` the value of the green tone that is contained in the pixel `(1,1)` of `originalImage`:
|
126
|
-
|
|
|
127
|
- `int greenContent = qGreen(originalImage.pixel(1,1));`.
|
|
|
|
|
124
|
+ `int greenContent = qGreen(originalImage.pixel(1,1));`.
|
128
|
|
125
|
|
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`
|
126
|
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
|
|
127
|
|