[Qt-interest] paint one image over other continously
Ulf-Alexander v. Ceumern-Lindenstjerna
ceumern at vrmagic.com
Fri Sep 25 15:00:50 CEST 2009
Hi,
> >I suggest you rewrite the client app to pass along the coordinates
and
> >only use rectangles.
>
> I cannot pick the first option as code is freezed on client side.
Okay.
> > If that is not an option you might try to use a mask to filter out
> the
> >white parts (have not tried that yet)
>
>
> I tried masking but it's not working for me. May be I am doing it
> correctly.
> If you can manage some time can you try?
Take a look at
http://doc.trolltech.com/4.5/qimage.html#createMaskFromColor
I have not tried this myself, but it sounds promising.
> >or overwrite all white parts in the source image with transparent
> color (Qt::transparent) and then paint
> >the entire source image above the target image.
> I thought in this case this could be possible solution, but I wonder
> how to do that?
I guess you have to iterate manually over all pixels, get the color of
each pixel and check if the color is white.
If it is white, replace the pixel color with a transparent one. This
would be the straight-forwards approach. There might be a more elegant
way, but I am just guessing here.
Regards, Ulf
> -----Original Message-----
> From: Ulf-Alexander v. Ceumern-Lindenstjerna
> [mailto:ceumern at vrmagic.com]
> Sent: Friday, September 25, 2009 3:18 PM
> To: Rahulkumar Tibdewal
> Cc: qt-interest at trolltech.com
> Subject: RE: [Qt-interest] paint one image over other continously
>
> Oh, tricky.
>
> I suggest you rewrite the client app to pass along the coordinates and
> only use rectangles. It seems the relevant regions of your images are
> not always rectangular which makes image processing harder. Also you
> would only need to transfer the regions and not the entire image (?).
>
> If that is not an option you might try to use a mask to filter out the
> white parts (have not tried that yet) or overwrite all white parts in
> the source image with transparent color (Qt::transparent) and then
> paint
> the entire source image above the target image. However this might not
> be the most efficient solution.
>
> Regards, Ulf
>
> > -----Original Message-----
> > From: Rahulkumar Tibdewal
> [mailto:rahulkumar_tibdewal at persistent.co.in]
> > Sent: Friday, September 25, 2009 11:41 AM
> > To: Ulf-Alexander v. Ceumern-Lindenstjerna
> > Cc: qt-interest at trolltech.com
> > Subject: RE: [Qt-interest] paint one image over other continously
> >
> > Thanks Ulf,
> >
> > I think I don't have Original coordinates. I have only the images as
> > attached from client. And only part of it is actually useful enough.
> > I guess we need those useful part coordinates. Can you have a look
at
> > mages and help me get those coordinates so that exactly pasting is
> > possible.
> >
> >
> > Thank you very much
> > Rahul
> >
> > Hi,
> >
> > I assume that you only transfer the partial images from the client
to
> > the server and that you get the original coordinates
> > (originalCoordinates) of the image from the client.
> > And I assume that you assemble the images (pixmapFromClient) to a
new
> > image on the server (serverPixmap).
> >
> > QPoint originalCoordinates; // get from client QPixmap
> > pixmap(pixmapFromClient);
> >
> > QPainter(&serverPixmap); // you could also paint directly on your
> > widget by overriding paintEvent!
> > painter.drawPixmap(originalCoordinates, pixmapFromClient);
> >
> > This way you only overwrite a certain part of the serverImage.
> >
> > Look at it this way: only update the regions of the images that have
> > changed and leave the rest intact.
> >
> > About the flickering: Qt has double buffering enabled, so you should
> > not see any flicker if you paint your widget with a QPainter.
> >
> > Regards, Ulf
> >
> > > -----Original Message-----
> > > From: Rahulkumar Tibdewal
> > [mailto:rahulkumar_tibdewal at persistent.co.in]
> > > Sent: Friday, September 25, 2009 11:11 AM
> > > To: Ulf-Alexander v. Ceumern-Lindenstjerna
> > > Cc: qt-interest at trolltech.com
> > > Subject: RE: [Qt-interest] paint one image over other continously
> > >
> > >
> > > Thanks.
> > >
> > > I also don't intend to overwrite the original image.
> > > I am getting pieces of images from client machine and I want to
> > > display them on server machine.
> > > On server machine I need to put all pieces in place so that It
> appear
> > > as a continuous non flickering image of client desktop.
> > >
> > > I tried your method but it's not working for me. Can you please
> help
> > me
> > > with some written sample code.
> > >
> > > Thanks
> > > Rahul
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Ulf-Alexander v. Ceumern-Lindenstjerna
> > > [mailto:ceumern at vrmagic.com]
> > > Sent: Friday, September 25, 2009 2:11 PM
> > > To: Rahulkumar Tibdewal
> > > Cc: qt-interest at trolltech.com
> > > Subject: RE: [Qt-interest] paint one image over other continously
> > >
> > >
> > > Well then don't overwrite the image data ?!
> > >
> > > Here is what I would do:
> > >
> > > Open a QPainter on the target image and use
> > > QPainter::drawPixmap(...sourceImage...)
> > > (http://doc.trolltech.com/4.5/qpainter.html#drawPixmap)
> > >
> > > If you could provide more information about how exactly you are
> > drawing
> > > the image, more people would be able to help.
> > >
> > > HTH, Ulf
> > >
> > > > -----Original Message-----
> > > > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> > > > bounces at trolltech.com] On Behalf Of Rahulkumar Tibdewal
> > > > Sent: Friday, September 25, 2009 10:29 AM
> > > > To: John McClurkin; qt-interest at trolltech.com
> > > > Subject: Re: [Qt-interest] paint one image over other
continously
> > > >
> > > > It's not a question of calling update(). Update will simply
> invoke
> > > > paint event again. I want my previous image should not get
> > > overwritten.
> > > >
> > > > Thanks
> > > > Rahul
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> > > > bounces at trolltech.com] On Behalf Of John McClurkin
> > > > Sent: Thursday, September 24, 2009 8:45 PM
> > > > To: qt-interest at trolltech.com
> > > > Subject: Re: [Qt-interest] paint one image over other
continously
> > > >
> > > > Rahulkumar Tibdewal wrote:
> > > > > Hello All,
> > > > >
> > > > >
> > > > >
> > > > > I am developing the application where server can monitor the
> > client
> > > > > desktop. I am sending the images continuously from client to
> > server
> > > > so
> > > > > that server can see client desktop.
> > > > >
> > > > > Images are sent whenever there is any change on client
desktop.
> > > i.e.
> > > > > only changing rectangle images are sent for performance
> reasons.
> > > > >
> > > > >
> > > > >
> > > > > My Question is how can I paint continuously appearing images
> from
> > > > client.
> > > > >
> > > > > I want to paint one image over other to its proper location
> > > > continuously
> > > > > so that it appear and continuous visualization of desktop, I
am
> > not
> > > > sure
> > > > > how's that possible.
> > > > >
> > > > By calling update() on the server widget that displays the
client
> > > > desktop whenever a new image is received? Really, this question
> is
> > > too
> > > > vague to allow people to help you.
> > > > _______________________________________________
> > > > Qt-interest mailing list
> > > > Qt-interest at trolltech.com
> > > > http://lists.trolltech.com/mailman/listinfo/qt-interest
> > > >
> > > > DISCLAIMER
> > > > ==========
> > > > This e-mail may contain privileged and confidential information
> > which
> > > > is the property of Persistent Systems Ltd. It is intended only
> for
> > > the
> > > > use of the individual or entity to which it is addressed. If you
> > are
> > > > not the intended recipient, you are not authorized to read,
> retain,
> > > > copy, print, distribute or use this message. If you have
received
> > > this
> > > > communication in error, please notify the sender and delete all
> > > copies
> > > > of this message. Persistent Systems Ltd. does not accept any
> > > liability
> > > > for virus infected mails.
> > > >
> > > > _______________________________________________
> > > > Qt-interest mailing list
> > > > Qt-interest at trolltech.com
> > > > http://lists.trolltech.com/mailman/listinfo/qt-interest
> > >
> > > DISCLAIMER
> > > ==========
> > > This e-mail may contain privileged and confidential information
> which
> > > is the property of Persistent Systems Ltd. It is intended only for
> > the
> > > use of the individual or entity to which it is addressed. If you
> are
> > > not the intended recipient, you are not authorized to read,
retain,
> > > copy, print, distribute or use this message. If you have received
> > this
> > > communication in error, please notify the sender and delete all
> > copies
> > > of this message. Persistent Systems Ltd. does not accept any
> > liability
> > > for virus infected mails.
> >
> > DISCLAIMER
> > ==========
> > This e-mail may contain privileged and confidential information
which
> > is the property of Persistent Systems Ltd. It is intended only for
> the
> > use of the individual or entity to which it is addressed. If you are
> > not the intended recipient, you are not authorized to read, retain,
> > copy, print, distribute or use this message. If you have received
> this
> > communication in error, please notify the sender and delete all
> copies
> > of this message. Persistent Systems Ltd. does not accept any
> liability
> > for virus infected mails.
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which
> is the property of Persistent Systems Ltd. It is intended only for the
> use of the individual or entity to which it is addressed. If you are
> not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies
> of this message. Persistent Systems Ltd. does not accept any liability
> for virus infected mails.
More information about the Qt-interest-old
mailing list