BTRFS: Implement some copy relevant helpers.
[haiku.git] / docs / develop / interface / BPicture_specifications.html
bloba2b93b34b6e4ac9e8d8385ad5a0927323916e847
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>BPicture specifications</title>
5 <meta http-equiv="content-type"
6 content="text/html; charset=ISO-8859-1">
7 <meta name="author" content="Marc Flerackers(mflerackers@androme.be)">
8 <meta name="description"
9 content="BPicture specifications for OpenBeOS">
10 </head>
11 <body>
12 <span style="font-weight: bold; text-decoration: underline;"></span>Author:
13 Marc Flerackers<br>
14 Revision: 1.4<br>
15 <span style="font-weight: bold; text-decoration: underline;"></span><span
16 style="font-weight: bold; text-decoration: underline;"><br>
17 Picture data</span><br>
18 <br>
19 The data of a BPicture is composed of instructions.<br>
20 <br>
21 These instructions have a small header, which looks as follows:<br>
22 <br>
23 <table cellpadding="2" cellspacing="2" border="1"
24 style="text-align: left;">
25 <tbody>
26 <tr>
27 <td>int16</td>
28 <td valign="top">id</td>
29 <td valign="top">The instruction id</td>
30 </tr>
31 <tr>
32 <td valign="top">int32</td>
33 <td valign="top">size</td>
34 <td valign="top">The size of the data</td>
35 </tr>
36 </tbody>
37 </table>
38 <br>
39 After this header the data follows. There are two exceptions:
40 EnterStateChange and EnterFontState. These are used to enclose state and
41 font changes. For ExitStateChange and ExitFontState there are no
42 instructions, this is not needed as we know the size of the instruction
43 block in the header of the Enter* functions.<br>
44 <br>
45 These are the known instructions at the moment:<br>
46 <br>
47 <table cellpadding="2" cellspacing="2" border="1"
48 style="text-align: left; width: 100%;">
49 <tbody>
50 <tr>
51 <th valign="top">Id<br>
52 </th>
53 <th valign="top">Name<br>
54 </th>
55 <th valign="top">Size<br>
56 </th>
57 <th valign="top">Data<br>
58 </th>
59 </tr>
60 <tr>
61 <td valign="top">0x0010<br>
62 </td>
63 <td valign="top">MovePenBy<br>
64 </td>
65 <td valign="top">4<br>
66 </td>
67 <td valign="top">BPoint where<br>
68 </td>
69 </tr>
70 <tr>
71 <td valign="top">0x0100<br>
72 </td>
73 <td valign="top">StrokeLine<br>
74 </td>
75 <td valign="top">16<br>
76 </td>
77 <td valign="top">BPoint start<br>
78 BPoint end<br>
79 </td>
80 </tr>
81 <tr>
82 <td valign="top">0x0101<br>
83 </td>
84 <td valign="top">StrokeRect<br>
85 </td>
86 <td valign="top">16<br>
87 </td>
88 <td valign="top">BRect rect<br>
89 </td>
90 </tr>
91 <tr>
92 <td valign="top">0x0102<br>
93 </td>
94 <td valign="top">FillRect<br>
95 </td>
96 <td valign="top">16<br>
97 </td>
98 <td valign="top">BRect rect<br>
99 </td>
100 </tr>
101 <tr>
102 <td valign="top">0x0103<br>
103 </td>
104 <td valign="top">StrokeRoundRect<br>
105 </td>
106 <td valign="top">24</td>
107 <td valign="top">BRect rect<br>
108 BPoint radii<br>
109 </td>
110 </tr>
111 <tr>
112 <td valign="top">0x0104<br>
113 </td>
114 <td valign="top">FillRoundRect</td>
115 <td valign="top">24<br>
116 </td>
117 <td valign="top">BRect rect<br>
118 BPoint radii</td>
119 </tr>
120 <tr>
121 <td valign="top">0x0105<br>
122 </td>
123 <td valign="top">StrokeBezier<br>
124 </td>
125 <td valign="top">32<br>
126 </td>
127 <td valign="top">BPoint[4] control</td>
128 </tr>
129 <tr>
130 <td valign="top">0x0106<br>
131 </td>
132 <td valign="top">FillBezier<br>
133 </td>
134 <td valign="top">32<br>
135 </td>
136 <td valign="top">BPoint[4] control</td>
137 </tr>
138 <tr>
139 <td valign="top">0x010B<br>
140 </td>
141 <td valign="top">StrokePolygon<br>
142 </td>
143 <td valign="top">4 + point data size + 1<br>
144 </td>
145 <td valign="top">int32 numPoints<br>
146 BPoint *points<br>
147 bool isClosed<br>
148 </td>
149 </tr>
150 <tr>
151 <td valign="top">0x010C<br>
152 </td>
153 <td valign="top">FillPolygon<br>
154 </td>
155 <td valign="top">4 + point data size </td>
156 <td valign="top">int32 numPoints<br>
157 BPoint *points<br>
158 </td>
159 </tr>
160 <tr>
161 <td valign="top">0x010D<br>
162 </td>
163 <td valign="top">StrokeShape<br>
164 </td>
165 <td valign="top">shape data size<br>
166 </td>
167 <td valign="top">shape data, see below </td>
168 </tr>
169 <tr>
170 <td valign="top">0x010E </td>
171 <td valign="top">FillShape </td>
172 <td valign="top">shape data size </td>
173 <td valign="top">shape data, see below </td>
174 </tr>
175 <tr>
176 <td valign="top">0x010F<br>
177 </td>
178 <td valign="top">DrawString<br>
179 </td>
180 <td valign="top">4 + string data size + 8<br>
181 </td>
182 <td valign="top">strlen<br>
183 char *string<br>
184 float deltax<br>
185 float deltay<br>
186 </td>
187 </tr>
188 <tr>
189 <td valign="top">0x0110 </td>
190 <td valign="top">DrawPixels<br>
191 </td>
192 <td valign="top">56 + pixel data size<br>
193 </td>
194 <td valign="top">BRect src<br>
195 BRect dest<br>
196 int32 width<br>
197 int32 height<br>
198 int32 bytesPerRow<br>
199 int32 pixelFormat<br>
200 int32 flags<br>
201 int32 length of pixel data<br>
202 pixel data<br>
203 </td>
204 </tr>
205 <tr>
206 <td valign="top">0x0112<br>
207 </td>
208 <td valign="top">DrawPicture<br>
209 </td>
210 <td valign="top">12<br>
211 </td>
212 <td valign="top">BPoint where?<br>
213 ????<br>
214 </td>
215 </tr>
216 <tr>
217 <td valign="top">0x0113</td>
218 <td valign="top">StrokeArc<br>
219 </td>
220 <td valign="top">24<br>
221 </td>
222 <td valign="top">BPoint center<br>
223 BPoint radii<br>
224 float startTheta<br>
225 float arcTheta<br>
226 </td>
227 </tr>
228 <tr>
229 <td valign="top">0x0114<br>
230 </td>
231 <td valign="top">FillArc<br>
232 </td>
233 <td valign="top">24<br>
234 </td>
235 <td valign="top">BPoint center<br>
236 BPoint radii<br>
237 float startTheta<br>
238 float arcTheta</td>
239 </tr>
240 <tr>
241 <td valign="top">0x0115<br>
242 </td>
243 <td valign="top">StrokeEllipse<br>
244 </td>
245 <td valign="top">16<br>
246 </td>
247 <td valign="top">BRect rect<br>
248 </td>
249 </tr>
250 <tr>
251 <td valign="top">0x0116</td>
252 <td valign="top">FillEllipse</td>
253 <td valign="top">16<br>
254 </td>
255 <td valign="top">BRect rect</td>
256 </tr>
257 <tr>
258 <td valign="top">0x0200<br>
259 </td>
260 <td valign="top">EnterStateChange<br>
261 </td>
262 <td valign="top">size of state instructions<br>
263 </td>
264 <td valign="top">state instructions</td>
265 </tr>
266 <tr>
267 <td valign="top">0x0201</td>
268 <td valign="top">SetClippingRects</td>
269 <td valign="top">16 + size of rects<br>
270 </td>
271 <td valign="top">clipping_rect bound<br>
272 clipping_rect *rect</td>
273 </tr>
274 <tr>
275 <td valign="top">0x0202</td>
276 <td valign="top">ClipToPicture</td>
277 <td valign="top">7 + 8 + 1 </td>
278 <td valign="top">zero bytes<br>
279 BPoint pt<br>
280 bool clip_to_inverse_picture<br>
281 </td>
282 </tr>
283 <tr>
284 <td valign="top">0x0203<br>
285 </td>
286 <td valign="top">PushState<br>
287 </td>
288 <td valign="top">0<br>
289 </td>
290 <td valign="top"><br>
291 </td>
292 </tr>
293 <tr>
294 <td valign="top">0x0204</td>
295 <td valign="top">PopState</td>
296 <td valign="top">0<br>
297 </td>
298 <td valign="top"><br>
299 </td>
300 </tr>
301 <tr>
302 <td valign="top">0x0205<br>
303 </td>
304 <td valign="top">SetClippingRects </td>
305 <td valign="top">0 </td>
306 <td valign="top">This is a shorter instruction for 0 clipping
307 rects.<br>
308 </td>
309 </tr>
310 <tr>
311 <td valign="top">0x0300<br>
312 </td>
313 <td valign="top">SetOrigin<br>
314 </td>
315 <td valign="top">8<br>
316 </td>
317 <td valign="top">BPoint pt<br>
318 </td>
319 </tr>
320 <tr>
321 <td valign="top">0x0301<br>
322 </td>
323 <td valign="top">SetPenLocation<br>
324 </td>
325 <td valign="top">8<br>
326 </td>
327 <td valign="top">BPoint pt<br>
328 </td>
329 </tr>
330 <tr>
331 <td valign="top">0x0302<br>
332 </td>
333 <td valign="top">SetDrawingMode<br>
334 </td>
335 <td valign="top">2<br>
336 </td>
337 <td valign="top">drawing_mode mode<br>
338 </td>
339 </tr>
340 <tr>
341 <td valign="top">0x0303</td>
342 <td valign="top">SetLineMode<br>
343 </td>
344 <td valign="top">2 + 2 + 4<br>
345 </td>
346 <td valign="top">cap_mode capMode<br>
347 join_mode joinMode<br>
348 float miterLimit<br>
349 </td>
350 </tr>
351 <tr>
352 <td valign="top">0x0304<br>
353 </td>
354 <td valign="top">SetPenSize</td>
355 <td valign="top">4<br>
356 </td>
357 <td valign="top">float size<br>
358 </td>
359 </tr>
360 <tr>
361 <td valign="top">0x0305<br>
362 </td>
363 <td valign="top">SetScale<br>
364 </td>
365 <td valign="top">4<br>
366 </td>
367 <td valign="top">float scale</td>
368 </tr>
369 <tr>
370 <td valign="top">0x0306<br>
371 </td>
372 <td valign="top">SetForeColor<br>
373 </td>
374 <td valign="top">4<br>
375 </td>
376 <td valign="top">rgb_color color<br>
377 </td>
378 </tr>
379 <tr>
380 <td valign="top">0x0307<br>
381 </td>
382 <td valign="top">SetBackColor<br>
383 </td>
384 <td valign="top">4<br>
385 </td>
386 <td valign="top">rgb_color color</td>
387 </tr>
388 <tr>
389 <td valign="top">0x0308<br>
390 </td>
391 <td valign="top">SetStipplePattern<br>
392 </td>
393 <td valign="top">8<br>
394 </td>
395 <td valign="top">pattern p<br>
396 </td>
397 </tr>
398 <tr>
399 <td valign="top">0x0309<br>
400 </td>
401 <td valign="top">EnterFontState<br>
402 </td>
403 <td valign="top">size of font instructions</td>
404 <td valign="top">font instructions</td>
405 </tr>
406 <tr>
407 <td valign="top">0x030A<br>
408 </td>
409 <td valign="top">SetBlendingMode<br>
410 </td>
411 <td valign="top">4<br>
412 </td>
413 <td valign="top">source_alpha alphaSrcMode<br>
414 alpha_function alphaFncMode<br>
415 </td>
416 </tr>
417 <tr>
418 <td valign="top">0x0380<br>
419 </td>
420 <td valign="top">SetFontFamily<br>
421 </td>
422 <td valign="top">4 + string data size</td>
423 <td valign="top">strlen<br>
424 char *family<br>
425 </td>
426 </tr>
427 <tr>
428 <td valign="top">0x0381<br>
429 </td>
430 <td valign="top">SetFontStyle<br>
431 </td>
432 <td valign="top">4 + string data size</td>
433 <td valign="top">strlen<br>
434 char style</td>
435 </tr>
436 <tr>
437 <td valign="top">0x0382<br>
438 </td>
439 <td valign="top">SetFontSpacing<br>
440 </td>
441 <td valign="top">4<br>
442 </td>
443 <td valign="top">int32 spacing<br>
444 </td>
445 </tr>
446 <tr>
447 <td valign="top">0x0383<br>
448 </td>
449 <td valign="top">SetFontEncoding<br>
450 </td>
451 <td valign="top">4<br>
452 </td>
453 <td valign="top">int32 encoding<br>
454 </td>
455 </tr>
456 <tr>
457 <td valign="top">0x0384<br>
458 </td>
459 <td valign="top">SetFontFlags<br>
460 </td>
461 <td valign="top">4<br>
462 </td>
463 <td valign="top">int32 flags<br>
464 </td>
465 </tr>
466 <tr>
467 <td valign="top">0x0385<br>
468 </td>
469 <td valign="top">SetFontSize<br>
470 </td>
471 <td valign="top">4<br>
472 </td>
473 <td valign="top">float size<br>
474 </td>
475 </tr>
476 <tr>
477 <td valign="top">0x0386<br>
478 </td>
479 <td valign="top">SetFontRotate<br>
480 </td>
481 <td valign="top">4<br>
482 </td>
483 <td valign="top">float rotation<br>
484 </td>
485 </tr>
486 <tr>
487 <td valign="top">0x0387<br>
488 </td>
489 <td valign="top">SetFontShear<br>
490 </td>
491 <td valign="top">4<br>
492 </td>
493 <td valign="top">float shear(is 0 instead of 90?)<br>
494 </td>
495 </tr>
496 <tr>
497 <td valign="top">0x0389<br>
498 </td>
499 <td valign="top">SetFontFace<br>
500 </td>
501 <td valign="top">4<br>
502 </td>
503 <td valign="top">int32 flags<br>
504 </td>
505 </tr>
506 </tbody>
507 </table>
508 <br>
509 There are a few undocumented instructions:<br>
510 <br>
511 <table cellpadding="2" cellspacing="2" border="1"
512 style="text-align: left;" width="100%">
513 <tbody>
514 <tr>
515 <td valign="top">0x0388<br>
516 </td>
517 <td valign="top">SetFontBPP </td>
518 <td valign="top">4<br>
519 </td>
520 <td valign="top"> int32 bpp (default 8)<br>
521 </td>
522 </tr>
523 </tbody>
524 </table>
525 <br>
526 Not all instructions where checked yet. The SetClippingRects has still
527 to be documented.<br>
528 <br>
529 DrawPicture and ClipToPicture have an index to the sub-picture. In
530 flattened data, these sub-pictures are stored in front of the main
531 picture data, when archived to a BMessage, the sub-pictures are
532 contained in a field called "piclib".<br>
533 <br>
534 <span style="font-weight: bold; text-decoration: underline;">Shape data</span><br>
535 <br>
536 The shape data contained in a BPicture is stored as follows:<br>
537 <br>
538 <table cellpadding="2" cellspacing="2" border="1"
539 style="text-align: left;" width="100%">
540 <tbody>
541 <tr>
542 <td valign="top">int32<br>
543 </td>
544 <td valign="top">instruction count<br>
545 </td>
546 </tr>
547 <tr>
548 <td valign="top" rowspan="1" colspan="1">uint32 *instructions<br>
549 </td>
550 <td valign="top" rowspan="1" colspan="1">Each instruction looks
551 like:<br>
552 First byte is the instruction id<br>
553 The next three bytes is the amount of points used*<br>
554 </td>
555 </tr>
556 <tr>
557 </tr>
558 <tr>
559 <td valign="top">int32<br>
560 </td>
561 <td valign="top">point count<br>
562 </td>
563 </tr>
564 <tr>
565 <td valign="top">BPoint *points </td>
566 <td valign="top">points<br>
567 </td>
568 </tr>
569 </tbody>
570 </table>
571 <br>
572 <table cellpadding="2" cellspacing="2" border="1"
573 style="text-align: left; width: 100%;">
574 <tbody>
575 <tr>
576 <th valign="top">Id<br>
577 </th>
578 <th valign="top">Name<br>
579 </th>
580 <th valign="top">Points*<br>
581 </th>
582 <th valign="top">Notes<br>
583 </th>
584 </tr>
585 <tr>
586 <td valign="top">0x80</td>
587 <td valign="top">MoveTo</td>
588 <td valign="top"><br>
589 </td>
590 <td valign="top">
591 <ul>
592 <li>A "MoveTo" instruction doesn't stand alone, but is OR-ed
593 with a "LineTo" or "BezierTo" instruction<br>
594 </li>
595 </ul>
596 </td>
597 </tr>
598 <tr>
599 <td valign="top">0x10 </td>
600 <td valign="top">LineTo</td>
601 <td valign="top">point count in instruction<br>
602 </td>
603 <td valign="top">
604 <ul>
605 <li>One "LineTo" instruction draws "count" lines</li>
606 </ul>
607 </td>
608 </tr>
609 <tr>
610 <td valign="top">0x90 </td>
611 <td valign="top">MoveTo LineTo</td>
612 <td valign="top">point count in instruction + 1</td>
613 <td valign="top">
614 <ul>
615 <li>There is one extra point for the "MoveTo", which is not
616 counted in the instruction.<br>
617 </li>
618 </ul>
619 </td>
620 </tr>
621 <tr>
622 <td valign="top">0x20 </td>
623 <td valign="top">BezierTo</td>
624 <td valign="top">point count in instruction</td>
625 <td valign="top">
626 <ul>
627 <li>One "BezierTo" instruction draws "count" lines</li>
628 </ul>
629 </td>
630 </tr>
631 <tr>
632 <td valign="top">0xA0 </td>
633 <td valign="top">MoveTo&nbsp;BezierTo</td>
634 <td valign="top">point count in instruction + 1</td>
635 <td valign="top">
636 <ul>
637 <li>There is one extra point for the "MoveTo", which is not
638 counted in the instruction.<br>
639 </li>
640 </ul>
641 </td>
642 </tr>
643 <tr>
644 <td valign="top">0x40 </td>
645 <td valign="top">Close</td>
646 <td valign="top">0 </td>
647 <td valign="top">
648 <ul>
649 <li>"Close" can only follow a "LineTo" or "BezierTo" instruction</li>
650 <li>If an instruction follows "Close", the new instruction is
651 OR-ed with "Close" and replaces it instruction</li>
652 <li>A&nbsp;shape never starts with "Close"</li>
653 </ul>
654 </td>
655 </tr>
656 </tbody>
657 </table>
658 <br>
659 </body>
660 </html>