PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 1ms

/binding/win32/gdipluscachedbitmap.d

http://github.com/wilkie/djehuty
D | 78 lines | 42 code | 9 blank | 27 comment | 0 complexity | 11c1ec84d7c2efcddf440f9057f6b0da MD5 | raw file
 1/*
 2 * gdipluscachedbitmap.d
 3 *
 4 * This module implements GdiPlusCachedBitmap.h for D. The original
 5 * copyright info is given below.
 6 *
 7 * Author: Dave Wilkinson
 8 * Originated: November 25th, 2009
 9 *
10 */
11
12module binding.win32.gdipluscachedbitmap;
13
14import binding.win32.windef;
15import binding.win32.winbase;
16import binding.win32.winnt;
17import binding.win32.wingdi;
18import binding.win32.guiddef;
19import binding.win32.gdiplusbase;
20import binding.win32.gdiplustypes;
21import binding.win32.gdiplusenums;
22import binding.win32.gdipluspixelformats;
23import binding.win32.gdiplusgpstubs;
24import binding.win32.gdiplusmetaheader;
25import binding.win32.gdipluspixelformats;
26import binding.win32.gdipluscolor;
27import binding.win32.gdipluscolormatrix;
28import binding.win32.gdiplusflat;
29import binding.win32.gdiplusimaging;
30import binding.win32.gdiplusbitmap;
31import binding.win32.gdiplusimageattributes;
32import binding.win32.gdiplusmatrix;
33import binding.win32.gdiplusgraphics;
34
35/**************************************************************************
36*
37* Copyright (c) 2000 Microsoft Corporation
38*
39* Module Name:
40*
41*   CachedBitmap class definition
42*
43* Abstract:
44*
45*   GDI+ CachedBitmap is a representation of an accelerated drawing
46*   that has restrictions on what operations are allowed in order
47*   to accelerate the drawing to the destination.
48*
49*   Look for class definition in GdiplusHeaders.h
50*
51**************************************************************************/
52
53class CachedBitmap : GdiplusBase {
54    this(in Bitmap bitmap, in Graphics graphics) {
55        nativeCachedBitmap = null;    
56    
57        lastResult = GdipCreateCachedBitmap(
58            bitmap.nativeImage,
59            graphics.nativeGraphics,
60            &nativeCachedBitmap
61        );
62    }
63    
64    ~this() {
65        GdipDeleteCachedBitmap(nativeCachedBitmap);
66    }
67
68    Status GetLastStatus() {
69        Status lastStatus = lastResult;
70        lastResult = Status.Ok;    
71        return (lastStatus);
72    }
73
74protected:
75    package GpCachedBitmap *nativeCachedBitmap;
76    package Status lastResult;
77}
78