NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 25 26 27 28 29 … 93 Next »
Freeing up GBPVRUiElement's

 
  • 0 Vote(s) - 0 Average
Freeing up GBPVRUiElement's
InVermont
Offline

Member

Posts: 157
Threads: 10
Joined: Mar 2007
#1
2009-01-22, 01:44 AM
This is the gist of what I am trying

//class member vars
private Bitmap screenBitmap;
private GBPVRUiElement screenBitmapElement;

//in Activate, first run through
screenBitmap = new Bitmap(bWidth, bheight);
//draw on bitmap, add text, whatever
screenBitmapElement = new GBPVRUiElement("screenBitmap", startingLocationRect, screenBitmap );

//in GetRenderList()
renderList.Add(screenBitmapElement)

This all works like expected, displaying the bitmap. However, when I go to change the bitmap

private void changeBitmap()
{
using (Graphics g = Graphics.FromImage(screenBitmap)) {
//draw on it, add text, decide to move it around, whatever

}
screenBitmapElement = new GBPVRUiElement("screenBitmap", NewRect,
screenBitmap );
}

I think this bleeds memory, as I am not cleaning up the original screenBitmapElement, just pointing it to a new one.
I have tried variations along the lines of

using (Graphics g = ...

ArrayList disposeList = new ArrayList()
disposeList.Add( screenBitmapElement );
PluginHelper.DisposeResources(disposeList);

screenBitmapElement = new GBPVRUiElement("screenBitmap", NewLocationRect,
screenBitmap );

and it explodes.
How do I clean up the original
screenBitmapElement ? Do I need to?

Is there a better way of doing it?

thanks
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  GBPVRUiElement loose its alpha herrmannj 3 1,602 2008-11-11, 05:13 PM
Last Post: sub
  Scrollable GBPVRUIElement ? lupus11 7 2,573 2008-02-12, 04:26 PM
Last Post: JavaWiz
  GBPVRUIElement - updating frequently psycik 6 2,295 2008-01-04, 10:16 AM
Last Post: psycik
  Texture locations of GBPVRUiElement on MVP alibert 2 1,491 2007-10-02, 04:29 AM
Last Post: alibert

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode