xref: /haiku/src/servers/app/CursorData.cpp (revision 239222b2369c39dc52df52b0a7cdd6cc0a91bc92)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, Haiku, Inc.
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		CursorData.cpp
23 //	Author:			DarkWyrm <bpmagic@columbus.rr.com>
24 //	Description:	File containing default cursor data
25 //
26 //------------------------------------------------------------------------------
27 #include <SupportDefs.h>
28 
29 /*
30 The first four bytes of cursor data give information about the cursor:
31 
32 Byte 1: Size in pixels-per-side. Cursors are always square; currently, only 16-by-16
33 cursors are allowed.
34 Byte 2: Color depth in bits-per-pixel. Currently, only one-bit monochrome is allowed.
35 Bytes 3&4: Hot spot coordinates. Given in "cursor coordinates" where (0,0) is the upper
36 left corner of the cursor grid, byte 3 is the hot spot's y coordinate, and byte 4 is its x
37 coordinate. The hot spot is a single pixel that's "activated" when the user clicks the mouse.
38 To push a button, for example, the hot spot must be within the button's bounds.
39 
40 Next comes an array of pixel color data. Pixels are specified from left to right in rows starting at
41 the top of the image and working downward. The size of an array element is the depth of the
42 image. In one-bit depth...
43 
44 the 16x16 array fits in 32 bytes.
45 1 is black and 0 is white.
46 
47 Then comes the pixel transparency bitmask, given left-to-right and top-to-bottom. 1 is opaque, 0 is
48 transparent. Transparency only applies to white pixels—black pixels are always opaque.
49 */
50 
51 
52 // Impressive ASCII art, eh?
53 
54 uint8 default_cursor_data[] = {
55 16,1,0,0,
56 255,224,	// ***********-----
57 128,16,		// *----------*----
58 128,16,		// *----------*----
59 128,96,		// *--------**-----
60 128,16,		// *----------*----
61 128,8,		// *-----------*---
62 128,8,		// *-----------*---
63 128,16,		// *----------*----
64 128,32,		// *---------*-----
65 144,64,		// *--*-----*------
66 144,128,	// *--*----*-------
67 105,0,		// -**-*--*--------
68 6,0,		// -----**---------
69 
70 0,0,		// ----------------
71 0,0,		// ----------------
72 0,0,		// ----------------
73 
74 // default_cursor mask - black pixels are always opaque
75 255,224,
76 255,240,
77 255,240,
78 255,224,
79 255,240,
80 255,248,
81 255,248,
82 255,240,
83 255,224,
84 255,192,
85 255,128,
86 111,0,
87 6,0,
88 
89 0,0,
90 0,0,
91 0,0
92 };
93 
94 uint8 default_text_data[] = {
95 	0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x06, 0xC0, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
96 	0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xC0, 0x0F, 0xE0, 0x07, 0xC0, 0x03, 0x80,
97 	0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x07, 0xC0, 0x0F, 0xE0,
98 	0x06, 0xC0
99 };
100 
101 uint8 default_move_data[] = {
102 	0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x03, 0x80, 0x07, 0xC0, 0x00, 0x00, 0x10, 0x10, 0x30, 0x18, 0x71, 0x1C, 0x30, 0x18,
103 	0x10, 0x10, 0x00, 0x00, 0x07, 0xC0, 0x03, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x80, 0x07, 0xC0, 0x0F, 0xE0,
104 	0x1F, 0xF0, 0x38, 0x38, 0x7B, 0xBC, 0xFB, 0xBE, 0x7B, 0xBC, 0x38, 0x38, 0x1F, 0xF0, 0x0F, 0xE0, 0x07, 0xC0, 0x03, 0x80, 0x01, 0x00,
105 	0x00, 0x00
106 };
107 
108 uint8 default_drag_data[] = {
109 	0x10, 0x01, 0x00, 0x00, 0xFF, 0x00, 0x81, 0x00, 0x82, 0x00, 0x82, 0x00, 0x81, 0xFF, 0x80, 0x81, 0xB0, 0x41, 0xC8, 0x41, 0x04, 0x81,
110 	0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x03, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFE, 0x00, 0xFE, 0x00,
111 	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0x07, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF,
112 	0x03, 0xFF
113 };
114 
115 uint8 default_resize_data[] = {
116 	0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x3E, 0x78, 0x1E, 0x70, 0x0E, 0x68, 0x16, 0x44, 0x22, 0x02, 0x40, 0x01, 0x80, 0x01, 0x80,
117 	0x02, 0x40, 0x44, 0x22, 0x68, 0x16, 0x70, 0x0E, 0x78, 0x1E, 0x7C, 0x3E, 0x00, 0x00, 0xFE, 0x7F, 0xFE, 0x7F, 0xFC, 0x3F, 0xF8, 0x1F,
118 	0xFC, 0x3F, 0xEE, 0x77, 0xC7, 0xE3, 0x03, 0xC0, 0x03, 0xC0, 0xC7, 0xE3, 0xEE, 0x77, 0xFC, 0x3F, 0xF8, 0x1F, 0xFC, 0x3F, 0xFE, 0x7F,
119 	0xFE, 0x7F
120 };
121 
122 uint8 default_resize_ew_data[] = {
123 	0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x11, 0x10, 0x31, 0x18, 0x71, 0x1C, 0x71, 0x1C,
124 	0x31, 0x18, 0x11, 0x10, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x80, 0x03, 0x80, 0x0B, 0xA0,
125 	0x1B, 0xB0, 0x3B, 0xB8, 0x7B, 0xBC, 0xFB, 0xBE, 0xFB, 0xBE, 0x7B, 0xBC, 0x3B, 0xB8, 0x1B, 0xB0, 0x0B, 0xA0, 0x03, 0x80, 0x03, 0x80,
126 	0x01, 0x00
127 };
128 
129 uint8 default_resize_ns_data[] = {
130 	0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFE, 0x00, 0x00,
131 	0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0xE0, 0x0F, 0xF0,
132 	0x1F, 0xF8, 0x00, 0x00, 0x7F, 0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0x00, 0x00, 0x1F, 0xF8, 0x0F, 0xF0, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80,
133 	0x00, 0x00
134 };
135 
136 uint8 default_resize_nwse_data[] = {
137 	0x10, 0x01, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x08, 0x1E, 0x10, 0x1C, 0x20, 0x18, 0x40, 0x10, 0x80, 0x01, 0x08,
138 	0x02, 0x18, 0x04, 0x38, 0x08, 0x78, 0x10, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xCC, 0x3F, 0x9C,
139 	0x3F, 0x38, 0x3E, 0x70, 0x3C, 0xE4, 0x39, 0xCC, 0x33, 0x9C, 0x27, 0x3C, 0x0E, 0x7C, 0x1C, 0xFC, 0x39, 0xFC, 0x33, 0xFC, 0x00, 0x00,
140 	0x00, 0x00
141 };
142 
143 uint8 default_resize_nesw_data[] = {
144 	0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xF8, 0x08, 0x78, 0x04, 0x38, 0x02, 0x18, 0x01, 0x08, 0x10, 0x80,
145 	0x18, 0x40, 0x1C, 0x20, 0x1E, 0x10, 0x1F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xFC, 0x39, 0xFC,
146 	0x1C, 0xFC, 0x0E, 0x7C, 0x27, 0x3C, 0x33, 0x9C, 0x39, 0xCC, 0x3C, 0xE4, 0x3E, 0x70, 0x3F, 0x38, 0x3F, 0x9C, 0x3F, 0xCC, 0x00, 0x00,
147 	0x00, 0x00
148 };
149 
150 
151 // known good cursor data for testing rest of system
152 uint8 cross_cursor[] = {16,1,5,5,
153 14,0,4,0,4,0,4,0,128,32,241,224,128,32,4,0,
154 4,0,4,0,14,0,0,0,0,0,0,0,0,0,0,0,
155 14,0,4,0,4,0,4,0,128,32,245,224,128,32,4,0,
156 4,0,4,0,14,0,0,0,0,0,0,0,0,0,0,0
157 };
158