Results 1 to 1 of 1

Thread: Anyone know about CachedBitmap?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member aewarnick's Avatar
    Join Date
    Dec 2002
    Posts
    1,037

    Anyone know about CachedBitmap?

    I have been trying to make it work but am having weird unconsistant problems and cannot find any useful documentation on the CachedBitmap. Can someone point me to a site or something that teaches about this?
    Code:
    [DllImport("gdiplus.dll")]
    			public static extern int GdipCreateCachedBitmap(IntPtr pBmp, IntPtr pGraphics, ref IntPtr pCatchedBmp);
    			[DllImport("gdiplus.dll")]
    			public static extern int GdipDrawCachedBitmap(IntPtr pGraphics, IntPtr pCatchedBmp, int x, int y);
    			[DllImport("gdiplus.dll")]
    			public static extern int GdipDeleteCachedBitmap(IntPtr pCatchedBmp);
    
    			public class CachedBmp
    			{
    				Bitmap cachedBmp;
    				IntPtr pCachedBmp;
    				IntPtr pGrfi;
    
    				public CachedBmp(Bitmap b, Graphics g)
    				{
    					this.cachedBmp= b;
    					FieldInfo Bmpfi= typeof(Bitmap).GetField("nativeImage", BindingFlags.Instance | BindingFlags.NonPublic);
    					IntPtr pBmpfi= (IntPtr)Bmpfi.GetValue(this.cachedBmp);
    					FieldInfo Grfi= typeof(Graphics).GetField("nativeGraphics", BindingFlags.Instance | BindingFlags.NonPublic);
    					pGrfi= (IntPtr)Grfi.GetValue(g);
    					GdipCreateCachedBitmap(pBmpfi, pGrfi, ref pCachedBmp);
    				}
    
    				public int Draw(int x, int y)
    				{
    					return GdipDrawCachedBitmap(this.pGrfi, this.pCachedBmp, x, y);
    				}
    
    				public void Delete()
    				{
    					GdipDeleteCachedBitmap(this.pCachedBmp);
    				}
    			}
    Last edited by aewarnick; Nov 7th, 2003 at 07:39 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width