newqtuser
18th July 2008, 06:12
Qt folks
Im trying to open a image file and display it line by line, after i get this working i want the line by line image data to be sent over the network to another system and have a qt app display this image data line by line on a QGraphicsScene. I think im almost there as far as showing the image data line by line, im just not sure if im getting the correct values in my test app, this is a small application can anyone tell me if im on the right track here?
I dont think this example is correct. At this point i just want line by line image data. Im not to worried about how to transfer it over the network yet, but i will need to send it in chunks of like 20 lines at a time over a socket. Here is a small example using a qt4 image.
#include <QApplication>
#include <QtGui>
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
QApplication app (argc, argv);
QImage* pImage = new QImage("/images/qt4.jpg");
for ( int line = 0; line < pImage->height(); line++ )
{
for ( int pos = 0; pos < pImage->width(); pos++ )
{
cout << pImage->scanLine(line) << endl;
cout << pImage->scanLine(pos) << endl;
}
}
return app.exec ();
}
Im trying to open a image file and display it line by line, after i get this working i want the line by line image data to be sent over the network to another system and have a qt app display this image data line by line on a QGraphicsScene. I think im almost there as far as showing the image data line by line, im just not sure if im getting the correct values in my test app, this is a small application can anyone tell me if im on the right track here?
I dont think this example is correct. At this point i just want line by line image data. Im not to worried about how to transfer it over the network yet, but i will need to send it in chunks of like 20 lines at a time over a socket. Here is a small example using a qt4 image.
#include <QApplication>
#include <QtGui>
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
QApplication app (argc, argv);
QImage* pImage = new QImage("/images/qt4.jpg");
for ( int line = 0; line < pImage->height(); line++ )
{
for ( int pos = 0; pos < pImage->width(); pos++ )
{
cout << pImage->scanLine(line) << endl;
cout << pImage->scanLine(pos) << endl;
}
}
return app.exec ();
}