1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
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">
12 <span style=
"font-weight: bold; text-decoration: underline;"></span>Author:
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>
19 The data of a BPicture is composed of instructions.
<br>
21 These instructions have a small header, which looks as follows:
<br>
23 <table cellpadding=
"2" cellspacing=
"2" border=
"1"
24 style=
"text-align: left;">
28 <td valign=
"top">id
</td>
29 <td valign=
"top">The instruction id
</td>
32 <td valign=
"top">int32
</td>
33 <td valign=
"top">size
</td>
34 <td valign=
"top">The size of the data
</td>
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>
45 These are the known instructions at the moment:
<br>
47 <table cellpadding=
"2" cellspacing=
"2" border=
"1"
48 style=
"text-align: left; width: 100%;">
51 <th valign=
"top">Id
<br>
53 <th valign=
"top">Name
<br>
55 <th valign=
"top">Size
<br>
57 <th valign=
"top">Data
<br>
61 <td valign=
"top">0x0010<br>
63 <td valign=
"top">MovePenBy
<br>
65 <td valign=
"top">4<br>
67 <td valign=
"top">BPoint where
<br>
71 <td valign=
"top">0x0100<br>
73 <td valign=
"top">StrokeLine
<br>
75 <td valign=
"top">16<br>
77 <td valign=
"top">BPoint start
<br>
82 <td valign=
"top">0x0101<br>
84 <td valign=
"top">StrokeRect
<br>
86 <td valign=
"top">16<br>
88 <td valign=
"top">BRect rect
<br>
92 <td valign=
"top">0x0102<br>
94 <td valign=
"top">FillRect
<br>
96 <td valign=
"top">16<br>
98 <td valign=
"top">BRect rect
<br>
102 <td valign=
"top">0x0103<br>
104 <td valign=
"top">StrokeRoundRect
<br>
106 <td valign=
"top">24</td>
107 <td valign=
"top">BRect rect
<br>
112 <td valign=
"top">0x0104<br>
114 <td valign=
"top">FillRoundRect
</td>
115 <td valign=
"top">24<br>
117 <td valign=
"top">BRect rect
<br>
121 <td valign=
"top">0x0105<br>
123 <td valign=
"top">StrokeBezier
<br>
125 <td valign=
"top">32<br>
127 <td valign=
"top">BPoint[
4] control
</td>
130 <td valign=
"top">0x0106<br>
132 <td valign=
"top">FillBezier
<br>
134 <td valign=
"top">32<br>
136 <td valign=
"top">BPoint[
4] control
</td>
139 <td valign=
"top">0x010B<br>
141 <td valign=
"top">StrokePolygon
<br>
143 <td valign=
"top">4 + point data size +
1<br>
145 <td valign=
"top">int32 numPoints
<br>
151 <td valign=
"top">0x010C<br>
153 <td valign=
"top">FillPolygon
<br>
155 <td valign=
"top">4 + point data size
</td>
156 <td valign=
"top">int32 numPoints
<br>
161 <td valign=
"top">0x010D<br>
163 <td valign=
"top">StrokeShape
<br>
165 <td valign=
"top">shape data size
<br>
167 <td valign=
"top">shape data, see below
</td>
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>
176 <td valign=
"top">0x010F<br>
178 <td valign=
"top">DrawString
<br>
180 <td valign=
"top">4 + string data size +
8<br>
182 <td valign=
"top">strlen
<br>
189 <td valign=
"top">0x0110 </td>
190 <td valign=
"top">DrawPixels
<br>
192 <td valign=
"top">56 + pixel data size
<br>
194 <td valign=
"top">BRect src
<br>
198 int32 bytesPerRow
<br>
199 int32 pixelFormat
<br>
201 int32 length of pixel data
<br>
206 <td valign=
"top">0x0112<br>
208 <td valign=
"top">DrawPicture
<br>
210 <td valign=
"top">12<br>
212 <td valign=
"top">BPoint where?
<br>
217 <td valign=
"top">0x0113</td>
218 <td valign=
"top">StrokeArc
<br>
220 <td valign=
"top">24<br>
222 <td valign=
"top">BPoint center
<br>
229 <td valign=
"top">0x0114<br>
231 <td valign=
"top">FillArc
<br>
233 <td valign=
"top">24<br>
235 <td valign=
"top">BPoint center
<br>
241 <td valign=
"top">0x0115<br>
243 <td valign=
"top">StrokeEllipse
<br>
245 <td valign=
"top">16<br>
247 <td valign=
"top">BRect rect
<br>
251 <td valign=
"top">0x0116</td>
252 <td valign=
"top">FillEllipse
</td>
253 <td valign=
"top">16<br>
255 <td valign=
"top">BRect rect
</td>
258 <td valign=
"top">0x0200<br>
260 <td valign=
"top">EnterStateChange
<br>
262 <td valign=
"top">size of state instructions
<br>
264 <td valign=
"top">state instructions
</td>
267 <td valign=
"top">0x0201</td>
268 <td valign=
"top">SetClippingRects
</td>
269 <td valign=
"top">16 + size of rects
<br>
271 <td valign=
"top">clipping_rect bound
<br>
272 clipping_rect *rect
</td>
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>
280 bool clip_to_inverse_picture
<br>
284 <td valign=
"top">0x0203<br>
286 <td valign=
"top">PushState
<br>
288 <td valign=
"top">0<br>
290 <td valign=
"top"><br>
294 <td valign=
"top">0x0204</td>
295 <td valign=
"top">PopState
</td>
296 <td valign=
"top">0<br>
298 <td valign=
"top"><br>
302 <td valign=
"top">0x0205<br>
304 <td valign=
"top">SetClippingRects
</td>
305 <td valign=
"top">0 </td>
306 <td valign=
"top">This is a shorter instruction for
0 clipping
311 <td valign=
"top">0x0300<br>
313 <td valign=
"top">SetOrigin
<br>
315 <td valign=
"top">8<br>
317 <td valign=
"top">BPoint pt
<br>
321 <td valign=
"top">0x0301<br>
323 <td valign=
"top">SetPenLocation
<br>
325 <td valign=
"top">8<br>
327 <td valign=
"top">BPoint pt
<br>
331 <td valign=
"top">0x0302<br>
333 <td valign=
"top">SetDrawingMode
<br>
335 <td valign=
"top">2<br>
337 <td valign=
"top">drawing_mode mode
<br>
341 <td valign=
"top">0x0303</td>
342 <td valign=
"top">SetLineMode
<br>
344 <td valign=
"top">2 +
2 +
4<br>
346 <td valign=
"top">cap_mode capMode
<br>
347 join_mode joinMode
<br>
352 <td valign=
"top">0x0304<br>
354 <td valign=
"top">SetPenSize
</td>
355 <td valign=
"top">4<br>
357 <td valign=
"top">float size
<br>
361 <td valign=
"top">0x0305<br>
363 <td valign=
"top">SetScale
<br>
365 <td valign=
"top">4<br>
367 <td valign=
"top">float scale
</td>
370 <td valign=
"top">0x0306<br>
372 <td valign=
"top">SetForeColor
<br>
374 <td valign=
"top">4<br>
376 <td valign=
"top">rgb_color color
<br>
380 <td valign=
"top">0x0307<br>
382 <td valign=
"top">SetBackColor
<br>
384 <td valign=
"top">4<br>
386 <td valign=
"top">rgb_color color
</td>
389 <td valign=
"top">0x0308<br>
391 <td valign=
"top">SetStipplePattern
<br>
393 <td valign=
"top">8<br>
395 <td valign=
"top">pattern p
<br>
399 <td valign=
"top">0x0309<br>
401 <td valign=
"top">EnterFontState
<br>
403 <td valign=
"top">size of font instructions
</td>
404 <td valign=
"top">font instructions
</td>
407 <td valign=
"top">0x030A<br>
409 <td valign=
"top">SetBlendingMode
<br>
411 <td valign=
"top">4<br>
413 <td valign=
"top">source_alpha alphaSrcMode
<br>
414 alpha_function alphaFncMode
<br>
418 <td valign=
"top">0x0380<br>
420 <td valign=
"top">SetFontFamily
<br>
422 <td valign=
"top">4 + string data size
</td>
423 <td valign=
"top">strlen
<br>
428 <td valign=
"top">0x0381<br>
430 <td valign=
"top">SetFontStyle
<br>
432 <td valign=
"top">4 + string data size
</td>
433 <td valign=
"top">strlen
<br>
437 <td valign=
"top">0x0382<br>
439 <td valign=
"top">SetFontSpacing
<br>
441 <td valign=
"top">4<br>
443 <td valign=
"top">int32 spacing
<br>
447 <td valign=
"top">0x0383<br>
449 <td valign=
"top">SetFontEncoding
<br>
451 <td valign=
"top">4<br>
453 <td valign=
"top">int32 encoding
<br>
457 <td valign=
"top">0x0384<br>
459 <td valign=
"top">SetFontFlags
<br>
461 <td valign=
"top">4<br>
463 <td valign=
"top">int32 flags
<br>
467 <td valign=
"top">0x0385<br>
469 <td valign=
"top">SetFontSize
<br>
471 <td valign=
"top">4<br>
473 <td valign=
"top">float size
<br>
477 <td valign=
"top">0x0386<br>
479 <td valign=
"top">SetFontRotate
<br>
481 <td valign=
"top">4<br>
483 <td valign=
"top">float rotation
<br>
487 <td valign=
"top">0x0387<br>
489 <td valign=
"top">SetFontShear
<br>
491 <td valign=
"top">4<br>
493 <td valign=
"top">float shear(is
0 instead of
90?)
<br>
497 <td valign=
"top">0x0389<br>
499 <td valign=
"top">SetFontFace
<br>
501 <td valign=
"top">4<br>
503 <td valign=
"top">int32 flags
<br>
509 There are a few undocumented instructions:
<br>
511 <table cellpadding=
"2" cellspacing=
"2" border=
"1"
512 style=
"text-align: left;" width=
"100%">
515 <td valign=
"top">0x0388<br>
517 <td valign=
"top">SetFontBPP
</td>
518 <td valign=
"top">4<br>
520 <td valign=
"top"> int32 bpp (default
8)
<br>
526 Not all instructions where checked yet. The SetClippingRects has still
527 to be documented.
<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>
534 <span style=
"font-weight: bold; text-decoration: underline;">Shape data
</span><br>
536 The shape data contained in a BPicture is stored as follows:
<br>
538 <table cellpadding=
"2" cellspacing=
"2" border=
"1"
539 style=
"text-align: left;" width=
"100%">
542 <td valign=
"top">int32
<br>
544 <td valign=
"top">instruction count
<br>
548 <td valign=
"top" rowspan=
"1" colspan=
"1">uint32 *instructions
<br>
550 <td valign=
"top" rowspan=
"1" colspan=
"1">Each instruction looks
552 First byte is the instruction id
<br>
553 The next three bytes is the amount of points used*
<br>
559 <td valign=
"top">int32
<br>
561 <td valign=
"top">point count
<br>
565 <td valign=
"top">BPoint *points
</td>
566 <td valign=
"top">points
<br>
572 <table cellpadding=
"2" cellspacing=
"2" border=
"1"
573 style=
"text-align: left; width: 100%;">
576 <th valign=
"top">Id
<br>
578 <th valign=
"top">Name
<br>
580 <th valign=
"top">Points*
<br>
582 <th valign=
"top">Notes
<br>
586 <td valign=
"top">0x80</td>
587 <td valign=
"top">MoveTo
</td>
588 <td valign=
"top"><br>
592 <li>A
"MoveTo" instruction doesn't stand alone, but is OR-ed
593 with a
"LineTo" or
"BezierTo" instruction
<br>
599 <td valign=
"top">0x10 </td>
600 <td valign=
"top">LineTo
</td>
601 <td valign=
"top">point count in instruction
<br>
605 <li>One
"LineTo" instruction draws
"count" lines
</li>
610 <td valign=
"top">0x90 </td>
611 <td valign=
"top">MoveTo LineTo
</td>
612 <td valign=
"top">point count in instruction +
1</td>
615 <li>There is one extra point for the
"MoveTo", which is not
616 counted in the instruction.
<br>
622 <td valign=
"top">0x20 </td>
623 <td valign=
"top">BezierTo
</td>
624 <td valign=
"top">point count in instruction
</td>
627 <li>One
"BezierTo" instruction draws
"count" lines
</li>
632 <td valign=
"top">0xA0 </td>
633 <td valign=
"top">MoveTo
BezierTo
</td>
634 <td valign=
"top">point count in instruction +
1</td>
637 <li>There is one extra point for the
"MoveTo", which is not
638 counted in the instruction.
<br>
644 <td valign=
"top">0x40 </td>
645 <td valign=
"top">Close
</td>
646 <td valign=
"top">0 </td>
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
shape never starts with
"Close"</li>