Annotation of OpenXM_contrib/gnuplot/beos/GPBitmap.h, Revision 1.1.1.1
1.1 ohara 1: /*[
2: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
3: *
4: * Permission to use, copy, and distribute this software and its
5: * documentation for any purpose with or without fee is hereby granted,
6: * provided that the above copyright notice appear in all copies and
7: * that both that copyright notice and this permission notice appear
8: * in supporting documentation.
9: *
10: * Permission to modify the software is granted, but not the right to
11: * distribute the complete modified source code. Modifications are to
12: * be distributed as patches to the released version. Permission to
13: * distribute binaries produced by compiling modified sources is granted,
14: * provided you
15: * 1. distribute the corresponding source modifications from the
16: * released version in the form of a patch file along with the binaries,
17: * 2. add special version identification to distinguish your version
18: * in addition to the base release version number,
19: * 3. provide your name and address as the primary contact for the
20: * support of your modified version, and
21: * 4. retain our contact information in regard to use of the base
22: * software.
23: * Permission to distribute the released version of the source code along
24: * with corresponding source modifications in the form of a patch file is
25: * granted with same provisions 2 through 4 for binary distributions.
26: *
27: * This software is provided "as is" without express or implied warranty
28: * to the extent permitted by applicable law.
29: ]*/
30:
31: #ifndef GPBitmap_h
32: #define GPBitmap_h
33:
34: #include <SupportDefs.h>
35: #include <GraphicsDefs.h>
36: #include <List.h>
37: #include <Bitmap.h>
38: #include <Rect.h>
39:
40: #define bmsgZoomIn 'zmin'
41: #define bmsgZoomOut 'zmot'
42: #define bmsgSetScale 'zset'
43:
44: class GPBitmap {
45:
46: protected:
47:
48: BView * m_view;
49: BList m_editors;
50: BBitmap * m_bitmap;
51: BBitmap * m_bufbitmap;
52: sem_id m_readerLock;
53: rgb_color colors[16];
54: bool m_needRedraw;
55: bool m_redrawing;
56: thread_id drawing_thread;
57:
58: public:
59: float width, height, nwidth, nheight, pointsize, xscale, yscale;
60: int32 ncommands, max_commands;
61: int cx, cy;
62: char ** commands;
63:
64: //int gX = 100, gY = 100;
65: //unsigned int gW = 640, gH = 450;
66:
67: GPBitmap(float width, float height);
68: GPBitmap(float width, float height, char **cmds);
69: ~GPBitmap();
70:
71: BBitmap * RealBitmap() { return m_bitmap; };
72:
73: void Lock() { m_bitmap->Lock(); };
74: void Unlock() { m_bitmap->Unlock(); };
75:
76: BRect Bounds() { return m_bitmap->Bounds(); };
77: void * Bits() { return m_bitmap->Bits(); };
78: color_space ColorSpace() { return m_bitmap->ColorSpace(); };
79: int32 BitsLength() { return m_bitmap->BitsLength(); };
80: int32 BytesPerRow() { return m_bitmap->BytesPerRow(); };
81:
82: BView * View() { return m_view; };
83: void SetDirty(BRegion *r);
84:
85: void ResizeTo(float width, float height, uint32 btns);
86:
87: rgb_color PixelAtRGB(int x, int y) {
88: rgb_color c = *((rgb_color*)(((char*)Bits()) + x*4 + y*BytesPerRow()));
89: return c;
90: };
91:
92: int32 drawing_loop(void *data);
93: void addCommand(char *cmd);
94: void addCommands(BMessage *msg, int32 numCmds);
95: void clearCommands();
96: void display(float v_width, float v_height);
97: void doDiamond(int x, int y, int px, int py);
98: void doPlus(int x, int y, int px, int py);
99: void doBox(int x, int y, int px, int py);
100: void doCross(int x, int y, int px, int py);
101: void doTriangle(int x, int y, int px, int py);
102: void doStar(int x, int y, int px, int py);
103: void doDot(int x, int y);
104:
105: inline float X(int x) { return x * xscale; };
106: inline float Y(int y) { return (4095-(y)) * yscale; }
107: };
108:
109: #ifndef LEFT
110: #define LEFT 0
111: #endif
112: #ifndef CENTRE
113: #define CENTRE 1
114: #endif
115: #ifndef RIGHT
116: #define RIGHT 2
117: #endif
118:
119: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>