1 <HTML 2 ><HEAD 3 ><TITLE 4 >SDL_Palette</TITLE 5 ><META 6 NAME="GENERATOR" 7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8 "><LINK 9 REL="HOME" 10 TITLE="SDL Library Documentation" 11 HREF="index.html"><LINK 12 REL="UP" 13 TITLE="Video" 14 HREF="video.html"><LINK 15 REL="PREVIOUS" 16 TITLE="SDL_Color" 17 HREF="sdlcolor.html"><LINK 18 REL="NEXT" 19 TITLE="SDL_PixelFormat" 20 HREF="sdlpixelformat.html"></HEAD 21 ><BODY 22 CLASS="REFENTRY" 23 BGCOLOR="#FFF8DC" 24 TEXT="#000000" 25 LINK="#0000ee" 26 VLINK="#551a8b" 27 ALINK="#ff0000" 28 ><DIV 29 CLASS="NAVHEADER" 30 ><TABLE 31 SUMMARY="Header navigation table" 32 WIDTH="100%" 33 BORDER="0" 34 CELLPADDING="0" 35 CELLSPACING="0" 36 ><TR 37 ><TH 38 COLSPAN="3" 39 ALIGN="center" 40 >SDL Library Documentation</TH 41 ></TR 42 ><TR 43 ><TD 44 WIDTH="10%" 45 ALIGN="left" 46 VALIGN="bottom" 47 ><A 48 HREF="sdlcolor.html" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 ></TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="sdlpixelformat.html" 63 ACCESSKEY="N" 64 >Next</A 65 ></TD 66 ></TR 67 ></TABLE 68 ><HR 69 ALIGN="LEFT" 70 WIDTH="100%"></DIV 71 ><H1 72 ><A 73 NAME="SDLPALETTE" 74 ></A 75 >SDL_Palette</H1 76 ><DIV 77 CLASS="REFNAMEDIV" 78 ><A 79 NAME="AEN3129" 80 ></A 81 ><H2 82 >Name</H2 83 >SDL_Palette -- Color palette for 8-bit pixel formats</DIV 84 ><DIV 85 CLASS="REFSECT1" 86 ><A 87 NAME="AEN3132" 88 ></A 89 ><H2 90 >Structure Definition</H2 91 ><PRE 92 CLASS="PROGRAMLISTING" 93 >typedef struct{ 94 int ncolors; 95 SDL_Color *colors; 96 } SDL_Palette;</PRE 97 ></DIV 98 ><DIV 99 CLASS="REFSECT1" 100 ><A 101 NAME="AEN3135" 102 ></A 103 ><H2 104 >Structure Data</H2 105 ><DIV 106 CLASS="INFORMALTABLE" 107 ><A 108 NAME="AEN3137" 109 ></A 110 ><P 111 ></P 112 ><TABLE 113 BORDER="0" 114 CLASS="CALSTABLE" 115 ><TBODY 116 ><TR 117 ><TD 118 ALIGN="LEFT" 119 VALIGN="TOP" 120 ><TT 121 CLASS="STRUCTFIELD" 122 ><I 123 >ncolors</I 124 ></TT 125 ></TD 126 ><TD 127 ALIGN="LEFT" 128 VALIGN="TOP" 129 >Number of colors used in this palette</TD 130 ></TR 131 ><TR 132 ><TD 133 ALIGN="LEFT" 134 VALIGN="TOP" 135 ><TT 136 CLASS="STRUCTFIELD" 137 ><I 138 >colors</I 139 ></TT 140 ></TD 141 ><TD 142 ALIGN="LEFT" 143 VALIGN="TOP" 144 >Pointer to <A 145 HREF="sdlcolor.html" 146 ><SPAN 147 CLASS="STRUCTNAME" 148 >SDL_Color</SPAN 149 ></A 150 > structures that make up the palette.</TD 151 ></TR 152 ></TBODY 153 ></TABLE 154 ><P 155 ></P 156 ></DIV 157 ></DIV 158 ><DIV 159 CLASS="REFSECT1" 160 ><A 161 NAME="AEN3150" 162 ></A 163 ><H2 164 >Description</H2 165 ><P 166 >Each pixel in an 8-bit surface is an index into the <TT 167 CLASS="STRUCTFIELD" 168 ><I 169 >colors</I 170 ></TT 171 > field of the <SPAN 172 CLASS="STRUCTNAME" 173 >SDL_Palette</SPAN 174 > structure store in <A 175 HREF="sdlpixelformat.html" 176 ><SPAN 177 CLASS="STRUCTNAME" 178 >SDL_PixelFormat</SPAN 179 ></A 180 >. A <SPAN 181 CLASS="STRUCTNAME" 182 >SDL_Palette</SPAN 183 > should never need to be created manually. It is automatically created when SDL allocates a <SPAN 184 CLASS="STRUCTNAME" 185 >SDL_PixelFormat</SPAN 186 > for a surface. The colors values of a <A 187 HREF="sdlsurface.html" 188 ><SPAN 189 CLASS="STRUCTNAME" 190 >SDL_Surface</SPAN 191 ></A 192 >s palette can be set with the <A 193 HREF="sdlsetcolors.html" 194 ><TT 195 CLASS="FUNCTION" 196 >SDL_SetColors</TT 197 ></A 198 >.</P 199 ></DIV 200 ><DIV 201 CLASS="REFSECT1" 202 ><A 203 NAME="AEN3163" 204 ></A 205 ><H2 206 >See Also</H2 207 ><P 208 ><A 209 HREF="sdlcolor.html" 210 ><SPAN 211 CLASS="STRUCTNAME" 212 >SDL_Color</SPAN 213 ></A 214 >, 215 <A 216 HREF="sdlsurface.html" 217 ><SPAN 218 CLASS="STRUCTNAME" 219 >SDL_Surface</SPAN 220 ></A 221 >, 222 <A 223 HREF="sdlsetcolors.html" 224 ><TT 225 CLASS="FUNCTION" 226 >SDL_SetColors</TT 227 ></A 228 > 229 <A 230 HREF="sdlsetpalette.html" 231 ><TT 232 CLASS="FUNCTION" 233 >SDL_SetPalette</TT 234 ></A 235 ></P 236 ></DIV 237 ><DIV 238 CLASS="NAVFOOTER" 239 ><HR 240 ALIGN="LEFT" 241 WIDTH="100%"><TABLE 242 SUMMARY="Footer navigation table" 243 WIDTH="100%" 244 BORDER="0" 245 CELLPADDING="0" 246 CELLSPACING="0" 247 ><TR 248 ><TD 249 WIDTH="33%" 250 ALIGN="left" 251 VALIGN="top" 252 ><A 253 HREF="sdlcolor.html" 254 ACCESSKEY="P" 255 >Prev</A 256 ></TD 257 ><TD 258 WIDTH="34%" 259 ALIGN="center" 260 VALIGN="top" 261 ><A 262 HREF="index.html" 263 ACCESSKEY="H" 264 >Home</A 265 ></TD 266 ><TD 267 WIDTH="33%" 268 ALIGN="right" 269 VALIGN="top" 270 ><A 271 HREF="sdlpixelformat.html" 272 ACCESSKEY="N" 273 >Next</A 274 ></TD 275 ></TR 276 ><TR 277 ><TD 278 WIDTH="33%" 279 ALIGN="left" 280 VALIGN="top" 281 >SDL_Color</TD 282 ><TD 283 WIDTH="34%" 284 ALIGN="center" 285 VALIGN="top" 286 ><A 287 HREF="video.html" 288 ACCESSKEY="U" 289 >Up</A 290 ></TD 291 ><TD 292 WIDTH="33%" 293 ALIGN="right" 294 VALIGN="top" 295 >SDL_PixelFormat</TD 296 ></TR 297 ></TABLE 298 ></DIV 299 ></BODY 300 ></HTML 301 >