The docs say:Also if you check the declaration, you will see that this method is marked as "const", so it can't modify the object it is being invoked on.Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.
If you add these two together, you will know that image1 remains unchanged and image2 is a scaled copy of image1.
First of all QRgb * is a pointer, so it can't perform any actions when it is created --- it doesn't have a constructor.
The docs say:So you get a pointer that points to internal QImage data. No copy is created.Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.
If the image is in an indexed format, the colors are stored in color table and image data (the one you can access with scanLine()) doesn't contain QRgb values, but indices.
For example if scanLine(x)[y] is 0, it means that given pixel has the same color as the first color in the color table. If scanLine(x)[y] is 42, it means that the color of the pixel is color(42) (or colorTable()[42]).
If you change a color at given index in color table, all pixels that refer to that index will change their colors.
Remember that his is only valid for indexed images.
Bookmarks