Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » image drawn in Paint(Draw &w) does not stay when refereshed
Re: image drawn in Paint(Draw &w) does not stay when refereshed [message #12962 is a reply to message #12952] Fri, 30 November 2007 15:31 Go to previous messageGo to previous message
amit is currently offline  amit
Messages: 17
Registered: November 2007
Promising Member
mrjt wrote on Fri, 30 November 2007 15:03

You are correct in that it is a performance feature. ImageBuffers are only designed to be used for image processing, then converted to Images for storage. When you do Image = ImageBuffer, instead of using memcpy to duplicate the pixel data the ownership of the memory is just transfered.

The problem occurred in this case because the parameters for Draw::DrawImage are all something like:
void DrawImage(const Rect& r, const Image& img);

so that if you pass in an ImageBuffer it is implicitly converted to a temporary Image (because it has operator Image), loosing ownership of the pixel data. The Image is passed to DrawImage and then destroyed, deleting the pixel data. Viola! The Image no longer exists Smile

Glad I could help.



ahaa ... thats it, thanks again



 
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Read Message
Previous Topic: Display bug in ArrayCtrl
Next Topic: Why BMPEncoder::NewBmp() doesn´t exists anymoe?
Goto Forum:
  


Current Time: Wed May 15 11:42:29 CEST 2024

Total time taken to generate the page: 0.02395 seconds