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 #12952 is a reply to message #12943] Fri, 30 November 2007 10:33 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
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.

[Updated on: Fri, 30 November 2007 10:36]

Report message to a moderator

 
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: Sat May 04 04:26:03 CEST 2024

Total time taken to generate the page: 0.02089 seconds