Quoted
Originally posted by spent
I am trying to read the first pixel(90,90) and set its color to the 20,20 pixel but it's not working.
This post has been edited 1 times, last edit by "spent" (Jun 29th 2005, 9:31am)
Quoted
Originally posted by spent
Do I have to do something like repaining or refreshing the image ?
Quoted
bool ImageViewer::loadImage( const QString& fileName )
{
filename = fileName;
bool ok = FALSE;
if ( !filename.isEmpty() ) {
QApplication::setOverrideCursor( waitCursor ); // this might take time
ok = image.load(filename, 0);
pickx = -1;
clickx = -1;
if ( ok )
ok = reconvertImage();
if ( ok ) {
setCaption( filename ); // set window caption
int w = pm.width();
int h = pm.height();
const int reasonable_width = 128;
if ( w < reasonable_width ) {
// Integer scale up to something reasonable
int multiply = ( reasonable_width + w - 1 ) / w;
w *= multiply;
h *= multiply;
}
h += menubar->heightForWidth(w) + status->height();
resize( w, h ); // we resize to fit image
} else {
pm.resize(0,0); // couldn't load image
update();
}
QApplication::restoreOverrideCursor(); // restore original cursor
}
updateStatus();
setMenuItemFlags();
return ok;
}
Quoted
Originally posted by spent
Here is the LoadImage function
...
This is the code I use the existing project in Examples/showimg to learn and practice on it
|
|
Source code |
1 2 |
reconvertImage(); repaint( image.hasAlphaBuffer() ); |