1 <HTML 2 ><HEAD 3 ><TITLE 4 >SDL_ConvertSurface</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_GetClipRect" 17 HREF="sdlgetcliprect.html"><LINK 18 REL="NEXT" 19 TITLE="SDL_BlitSurface" 20 HREF="sdlblitsurface.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="sdlgetcliprect.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="sdlblitsurface.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="SDLCONVERTSURFACE" 74 ></A 75 >SDL_ConvertSurface</H1 76 ><DIV 77 CLASS="REFNAMEDIV" 78 ><A 79 NAME="AEN2258" 80 ></A 81 ><H2 82 >Name</H2 83 >SDL_ConvertSurface -- Converts a surface to the same format as another surface.</DIV 84 ><DIV 85 CLASS="REFSYNOPSISDIV" 86 ><A 87 NAME="AEN2261" 88 ></A 89 ><H2 90 >Synopsis</H2 91 ><DIV 92 CLASS="FUNCSYNOPSIS" 93 ><A 94 NAME="AEN2262" 95 ></A 96 ><P 97 ></P 98 ><PRE 99 CLASS="FUNCSYNOPSISINFO" 100 >#include "SDL/SDL.h"</PRE 101 ><P 102 ><CODE 103 ><CODE 104 CLASS="FUNCDEF" 105 >SDL_Surface *<B 106 CLASS="FSFUNC" 107 >SDL_ConvertSurface</B 108 ></CODE 109 >(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);</CODE 110 ></P 111 ><P 112 ></P 113 ></DIV 114 ></DIV 115 ><DIV 116 CLASS="REFSECT1" 117 ><A 118 NAME="AEN2268" 119 ></A 120 ><H2 121 >Description</H2 122 ><P 123 >Creates a new surface of the specified format, and then copies and maps 124 the given surface to it. If this function fails, it returns 125 <TT 126 CLASS="LITERAL" 127 >NULL</TT 128 >.</P 129 ><P 130 >The <TT 131 CLASS="PARAMETER" 132 ><I 133 >flags</I 134 ></TT 135 > parameter is passed to 136 <A 137 HREF="sdlcreatergbsurface.html" 138 ><TT 139 CLASS="FUNCTION" 140 >SDL_CreateRGBSurface</TT 141 ></A 142 > 143 and has those semantics.</P 144 ><P 145 >This function is used internally by 146 <A 147 HREF="sdldisplayformat.html" 148 ><TT 149 CLASS="FUNCTION" 150 >SDL_DisplayFormat</TT 151 ></A 152 >.</P 153 ><P 154 >This function can only be called after SDL_Init.</P 155 ></DIV 156 ><DIV 157 CLASS="REFSECT1" 158 ><A 159 NAME="AEN2280" 160 ></A 161 ><H2 162 >Return Value</H2 163 ><P 164 >Returns either a pointer to the new surface, or 165 <TT 166 CLASS="LITERAL" 167 >NULL</TT 168 > on error.</P 169 ></DIV 170 ><DIV 171 CLASS="REFSECT1" 172 ><A 173 NAME="AEN2284" 174 ></A 175 ><H2 176 >See Also</H2 177 ><P 178 ><A 179 HREF="sdlcreatergbsurface.html" 180 ><TT 181 CLASS="FUNCTION" 182 >SDL_CreateRGBSurface</TT 183 ></A 184 >, 185 <A 186 HREF="sdldisplayformat.html" 187 ><TT 188 CLASS="FUNCTION" 189 >SDL_DisplayFormat</TT 190 ></A 191 >, 192 <A 193 HREF="sdlpixelformat.html" 194 ><SPAN 195 CLASS="STRUCTNAME" 196 >SDL_PixelFormat</SPAN 197 ></A 198 >, 199 <A 200 HREF="sdlsurface.html" 201 ><SPAN 202 CLASS="STRUCTNAME" 203 >SDL_Surface</SPAN 204 ></A 205 ></P 206 ></DIV 207 ><DIV 208 CLASS="NAVFOOTER" 209 ><HR 210 ALIGN="LEFT" 211 WIDTH="100%"><TABLE 212 SUMMARY="Footer navigation table" 213 WIDTH="100%" 214 BORDER="0" 215 CELLPADDING="0" 216 CELLSPACING="0" 217 ><TR 218 ><TD 219 WIDTH="33%" 220 ALIGN="left" 221 VALIGN="top" 222 ><A 223 HREF="sdlgetcliprect.html" 224 ACCESSKEY="P" 225 >Prev</A 226 ></TD 227 ><TD 228 WIDTH="34%" 229 ALIGN="center" 230 VALIGN="top" 231 ><A 232 HREF="index.html" 233 ACCESSKEY="H" 234 >Home</A 235 ></TD 236 ><TD 237 WIDTH="33%" 238 ALIGN="right" 239 VALIGN="top" 240 ><A 241 HREF="sdlblitsurface.html" 242 ACCESSKEY="N" 243 >Next</A 244 ></TD 245 ></TR 246 ><TR 247 ><TD 248 WIDTH="33%" 249 ALIGN="left" 250 VALIGN="top" 251 >SDL_GetClipRect</TD 252 ><TD 253 WIDTH="34%" 254 ALIGN="center" 255 VALIGN="top" 256 ><A 257 HREF="video.html" 258 ACCESSKEY="U" 259 >Up</A 260 ></TD 261 ><TD 262 WIDTH="33%" 263 ALIGN="right" 264 VALIGN="top" 265 >SDL_BlitSurface</TD 266 ></TR 267 ></TABLE 268 ></DIV 269 ></BODY 270 ></HTML 271 >