Debian Codegraph @

extern/agg24-svn/include/platform/mac/agg_mac_pmap.h

raw
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.4
3 // Copyright (C) 2002-2005 Maxim Shemanarev (McSeem)
4 // Copyright (C) 2002 Hansruedi Baer (MacOS support)
5 //
6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
10 //
11 //----------------------------------------------------------------------------
12 // Contact: [email protected]
13 // [email protected]
14 // http://www.antigrain.com
15 // [email protected]
16 //----------------------------------------------------------------------------
17 //
18 // class pixel_map
19 //
20 //----------------------------------------------------------------------------
21 #ifndef AGG_MAC_PMAP_INCLUDED
22 #define AGG_MAC_PMAP_INCLUDED
23
24
25 #include <stdio.h>
26 #include <Carbon.h>
27
28
29 namespace agg
30 {
31 enum org_e
32 {
33 org_mono8 = 8,
34 org_color16 = 16,
35 org_color24 = 24,
36 org_color32 = 32
37 };
38
39 class pixel_map
40 {
41 public:
42 ~pixel_map();
43 pixel_map();
44
45 public:
46 void destroy();
47 void create(unsigned width,
48 unsigned height,
49 org_e org,
50 unsigned clear_val=255);
51
52 void clear(unsigned clear_val=255);
53 bool load_from_qt(const char* filename);
54 bool save_as_qt(const char* filename) const;
55
56 void draw(WindowRef window,
57 const Rect* device_rect=0,
58 const Rect* bmp_rect=0) const;
59 void draw(WindowRef window, int x, int y, double scale=1.0) const;
60 void blend(WindowRef window,
61 const Rect* device_rect=0,
62 const Rect* bmp_rect=0) const;
63 void blend(WindowRef window, int x, int y, double scale=1.0) const;
64
65 unsigned char* buf();
66 unsigned width() const;
67 unsigned height() const;
68 int row_bytes() const;
69 unsigned bpp() const { return m_bpp; }
70
71 //Auxiliary static functions
72 static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel);
73 private:
74 pixel_map(const pixel_map&);
75 const pixel_map& operator = (const pixel_map&);
76
77 private:
78 GWorldPtr m_pmap;
79 unsigned char* m_buf;
80 unsigned m_bpp;
81 unsigned m_img_size;
82 };
83
84 }
85
86
87 #endif