h6. [[Programmer's Reference Manuals (francais)|Documentation de Référence du programmeur]] h6(. » Sprite Mode Word h2. Le mode Sprite <pre>Traduction en cours</pre> Le mode Sprite est une valeur 32 bits particulière du mode graphique utilisée pour définir le format du sprite. Il y a trois formats principaux supportés selon la version de RISC OS. h3. Mode graphique Les [[Screen Modes|modes graphiques]] sont les seuls modes supportés par les versions antérieures à RISC OS 3.5 If the mode number is one of an extension mode (i.e. a mode defined by a third-party module) then some operations on the sprite will only perform correctly if that mode (or a very similar one) is present on the host system. Notez que l'utilisation de modes graphiques compris entre 128 et 255 pour définir un mode Sprite n'est pas autorisé. h3. Le mode Sprite du RISC OS 3.5 Le RISC OS 3.5 étend les possibilités du mode graphique de la façon suivante: <pre>wttt tyyy yyyy yyyy yyxx xxxx xxxx xxx1</pre> |_<^. Plage de bits |_<^. Contents | |<^. w (bit 31) |<^. Wide mask flag | |<^. t (bits 27-30) |<^. Type de Sprite | |<^. y (bits 14-26) |<^. Densité de pixels vertical | |<^. x (bits 1-13) |<^. Densité de pixels horizontal | Le bit 0 doit valoir '1' pour définir un mode Sprite. Notez que de nombreuses API accepte uniquement des valeurs de mode Sprite dont la densité de pixels est exprimée en ratio: 180 DPI (valeur du radio 0), 90 DPI (valeur du radio 1), 45 DPI (valeur du radio 2) ou 22 ou 23 DPI (valeur de ratio 3). h3. Le mode sprite de RISC OS 5 A partir du RISC OS 5.21, un nouveau format a été ajouté permettant un plus grand nombre de type de sprite au détriment du nombre de combinaisons de densité de pixels. <pre>w111 1ttt tttt 0000 ffff ffff yyxx 0001</pre> |_<^. Plage de bits |_<^. Contents | |<^. w (bit 31) |<^. Wide mask flag | |<^. t (bits 20-26) |<^. Sprite type | |<^. f (bits 8-15) |<^. Contains bits 8-15 of the [[Mode Flags]] | |<^. y (bits 6-7) |<^. Y eigen value (0=180 DPI, 1=90 DPI, etc.) | |<^. x (bits 4-5) |<^. X eigen value | Les bits 27-30, 16-19 et 0-3 doivent contenir le motif &78000001. h3. Determining mode word format * Is the mode word an unsigned value less than 256? ** Yes: It's a [[Screen Modes|mode number]] * Is the bottom bit zero? ** Yes: It's a pointer to a [[Mode Selector Block]]. * Are bits 27-30 all set to 1? ** Yes: It's a RISC OS 5 style sprite mode word ** No: It's a RISC OS 3.5 style sprite mode word The above rules are essentially just an expanded form of the set of rules presented for decoding [[Mode Specifier|mode specifiers]], as many APIs which accept mode words actually accept all types of mode specifier. However it's important to remember that pointers to mode selector blocks are not valid sprite mode words, as there is no way the pointer or the block can be saved out to a sprite file. Therefore if you are writing a public API which only accepts sprite mode words, you may want to implement a check for mode selectors and throw an error if one is passed in by accident. Some APIs may also accept pointers to sprite areas - these can be distinguished from pointers to mode selector blocks by the fact that bit 0 of the first word of a sprite area will always be zero, whereas bit 0 of the first word of a mode selector block will always be one. Also note that even if it looks like a RISC OS 3.5 or RISC OS 5 sprite mode word, other factors may mean that it's a completely invalid mode word (e.g. DPI values of zero in a RISC OS 3.5 mode word, or the fixed bits of a RISC OS 5 mode word containing an invalid pattern). h3. RISC OS 3.5 sprite types |_<^. Type |_<^. Description |_<^. [[Mode Variable Numbers|NColour value]] |_<^. [[Mode Flags|ModeFlags value]] |_<^. [[Mode Variable Numbers|Log2BPP value]] | |<^. 0 |<^. Invalid (used to identify mode numbers) |<^. - |<^. - |<^. - | |<^. 1 |<^. 1bpp palletised |<^. 1 |<^. 0 |<^. 0 | |<^. 2 |<^. 2bpp palletised |<^. 3 |<^. 0 |<^. 1 | |<^. 3 |<^. 4bpp palletised |<^. 15 |<^. 0 |<^. 2 | |<^. 4 |<^. 8bpp palletised |<^. 63 |<^. 0 |<^. 3 | |<^. 5 |<^. 16bpp 1:5:5:5 TBGR |<^. 65535 |<^. 0 |<^. 4 | |<^. 6 |<^. 32bpp 8:8:8:8 TBGR |<^. -1 |<^. 0 |<^. 5 | |<^. 7 |<^. 32bpp CMYK |<^. -1 |<^. &1000 |<^. 5 | |<^. 8 |<^. 24bpp |<^. 16777215 |<^. 0 |<^. 6 | |<^. 9 |<^. JPEG data |<^. - |<^. - |<^. - | |<^. 10 |<^. 16bpp 5:6:5 TBGR |<^. 65535 |<^. &80 |<^. 4 | |<^. 11-14 |<^. Reserved |<^. - |<^. - |<^. - | |<^. 15 |<^. Invalid (used to identify RISC OS 5 sprite mode words) |<^. - |<^. - |<^. - | Note that for sprite type 4, the values returned by the kernel are for a sprite with a 64 entry palette instead of a full 256 entry palette. h3. RISC OS 5 sprite types Types 0-15 are as above. |_<^. Type |_<^. Description |_<^. [[Mode Variable Numbers|NColour value]] |_<^. [[Mode Variable Numbers|Log2BPP value]] | |<^. 16 |<^. 16bpp 4:4:4:4 |<^. 4095 |<^. 4 | |<^. 17 |<^. 4:2:0 YCbCr |<^. 420 |<^. 7 | |<^. 18 |<^. 4:2:2 YCbCr |<^. 422 |<^. 7 | |<^. 19-127 |<^. Reserved |<^. - |<^. - | When reading the mode flags, bits 8-15 of the sprite mode word directly specify bits 8-15 of the mode flags. The other flags (e.g. bit 7) are as specified in the tables above. h3. Gestion des types de sprites inconnus A partir de RISC OS 3.5, essayer d'utiliser la fonction [[OS_ReadModeVariable]] pour obtenir les détails d'un type de sprite non supporté va indiquer que le sprite est de type 6 (c.à.d 32bpp). En comparant les valeurs retournées aux valeurs fournies il est possible de savoir quels type de sprites le système d'exploitation est capable de gérer. h3. Mask types See [[Format Of Sprite]] for details of how the sprite mode word affects the format of the sprite mask. h4. Voir aussi * [[Screen Modes (français)|Screen Modes]] * [[Mode Flags (français)|Mode Flags]] * [[Mode Variable Numbers (français)|Mode Variable Numbers]] * [[Mode Selector Block (français)|Mode Selector Block]] * [[Mode Specifier (français)|Numéro de mode]] * [[Format Of Sprite (français)|Format Of Sprite]] h5. Page d'origine [[Sprite Mode Word|English]]