1<HTML 2><HEAD 3><TITLE 4>SDL_Surface</TITLE 5><META 6NAME="GENERATOR" 7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8"><LINK 9REL="HOME" 10TITLE="SDL Library Documentation" 11HREF="index.html"><LINK 12REL="UP" 13TITLE="Video" 14HREF="video.html"><LINK 15REL="PREVIOUS" 16TITLE="SDL_PixelFormat" 17HREF="sdlpixelformat.html"><LINK 18REL="NEXT" 19TITLE="SDL_VideoInfo" 20HREF="sdlvideoinfo.html"></HEAD 21><BODY 22CLASS="REFENTRY" 23BGCOLOR="#FFF8DC" 24TEXT="#000000" 25LINK="#0000ee" 26VLINK="#551a8b" 27ALINK="#ff0000" 28><DIV 29CLASS="NAVHEADER" 30><TABLE 31SUMMARY="Header navigation table" 32WIDTH="100%" 33BORDER="0" 34CELLPADDING="0" 35CELLSPACING="0" 36><TR 37><TH 38COLSPAN="3" 39ALIGN="center" 40>SDL Library Documentation</TH 41></TR 42><TR 43><TD 44WIDTH="10%" 45ALIGN="left" 46VALIGN="bottom" 47><A 48HREF="sdlpixelformat.html" 49ACCESSKEY="P" 50>Prev</A 51></TD 52><TD 53WIDTH="80%" 54ALIGN="center" 55VALIGN="bottom" 56></TD 57><TD 58WIDTH="10%" 59ALIGN="right" 60VALIGN="bottom" 61><A 62HREF="sdlvideoinfo.html" 63ACCESSKEY="N" 64>Next</A 65></TD 66></TR 67></TABLE 68><HR 69ALIGN="LEFT" 70WIDTH="100%"></DIV 71><H1 72><A 73NAME="SDLSURFACE" 74></A 75>SDL_Surface</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN3263" 80></A 81><H2 82>Name</H2 83>SDL_Surface -- Graphical Surface Structure</DIV 84><DIV 85CLASS="REFSECT1" 86><A 87NAME="AEN3266" 88></A 89><H2 90>Structure Definition</H2 91><PRE 92CLASS="PROGRAMLISTING" 93>typedef struct SDL_Surface { 94 Uint32 flags; /* Read-only */ 95 SDL_PixelFormat *format; /* Read-only */ 96 int w, h; /* Read-only */ 97 Uint16 pitch; /* Read-only */ 98 void *pixels; /* Read-write */ 99 100 /* clipping information */ 101 SDL_Rect clip_rect; /* Read-only */ 102 103 /* Reference count -- used when freeing surface */ 104 int refcount; /* Read-mostly */ 105 106 /* This structure also contains private fields not shown here */ 107} SDL_Surface;</PRE 108></DIV 109><DIV 110CLASS="REFSECT1" 111><A 112NAME="AEN3269" 113></A 114><H2 115>Structure Data</H2 116><DIV 117CLASS="INFORMALTABLE" 118><A 119NAME="AEN3271" 120></A 121><P 122></P 123><TABLE 124BORDER="0" 125CLASS="CALSTABLE" 126><TBODY 127><TR 128><TD 129ALIGN="LEFT" 130VALIGN="TOP" 131><TT 132CLASS="STRUCTFIELD" 133><I 134>flags</I 135></TT 136></TD 137><TD 138ALIGN="LEFT" 139VALIGN="TOP" 140>Surface flags</TD 141></TR 142><TR 143><TD 144ALIGN="LEFT" 145VALIGN="TOP" 146><TT 147CLASS="STRUCTFIELD" 148><I 149>format</I 150></TT 151></TD 152><TD 153ALIGN="LEFT" 154VALIGN="TOP" 155>Pixel <A 156HREF="sdlpixelformat.html" 157>format</A 158></TD 159></TR 160><TR 161><TD 162ALIGN="LEFT" 163VALIGN="TOP" 164><TT 165CLASS="STRUCTFIELD" 166><I 167>w, h</I 168></TT 169></TD 170><TD 171ALIGN="LEFT" 172VALIGN="TOP" 173>Width and height of the surface</TD 174></TR 175><TR 176><TD 177ALIGN="LEFT" 178VALIGN="TOP" 179><TT 180CLASS="STRUCTFIELD" 181><I 182>pitch</I 183></TT 184></TD 185><TD 186ALIGN="LEFT" 187VALIGN="TOP" 188>Length of a surface scanline in bytes</TD 189></TR 190><TR 191><TD 192ALIGN="LEFT" 193VALIGN="TOP" 194><TT 195CLASS="STRUCTFIELD" 196><I 197>pixels</I 198></TT 199></TD 200><TD 201ALIGN="LEFT" 202VALIGN="TOP" 203>Pointer to the actual pixel data</TD 204></TR 205><TR 206><TD 207ALIGN="LEFT" 208VALIGN="TOP" 209><TT 210CLASS="STRUCTFIELD" 211><I 212>clip_rect</I 213></TT 214></TD 215><TD 216ALIGN="LEFT" 217VALIGN="TOP" 218>surface clip <A 219HREF="sdlrect.html" 220>rectangle</A 221></TD 222></TR 223></TBODY 224></TABLE 225><P 226></P 227></DIV 228></DIV 229><DIV 230CLASS="REFSECT1" 231><A 232NAME="AEN3300" 233></A 234><H2 235>Description</H2 236><P 237><SPAN 238CLASS="STRUCTNAME" 239>SDL_Surface</SPAN 240>'s represent areas of "graphical" 241memory, memory that can be drawn to. The video framebuffer is returned 242as a <SPAN 243CLASS="STRUCTNAME" 244>SDL_Surface</SPAN 245> by 246<A 247HREF="sdlsetvideomode.html" 248><TT 249CLASS="FUNCTION" 250>SDL_SetVideoMode</TT 251></A 252> 253and <A 254HREF="sdlgetvideosurface.html" 255><TT 256CLASS="FUNCTION" 257>SDL_GetVideoSurface</TT 258></A 259>. 260Most of the fields should be pretty obvious. 261<TT 262CLASS="STRUCTFIELD" 263><I 264>w</I 265></TT 266> and <TT 267CLASS="STRUCTFIELD" 268><I 269>h</I 270></TT 271> are the 272width and height of the surface in pixels. 273<TT 274CLASS="STRUCTFIELD" 275><I 276>pixels</I 277></TT 278> is a pointer to the actual pixel data, 279the surface should be <A 280HREF="sdllocksurface.html" 281>locked</A 282> 283before accessing this field. The <TT 284CLASS="STRUCTFIELD" 285><I 286>clip_rect</I 287></TT 288> field 289is the clipping rectangle as set by 290<A 291HREF="sdlsetcliprect.html" 292><TT 293CLASS="FUNCTION" 294>SDL_SetClipRect</TT 295></A 296>.</P 297><P 298>The following are supported in the 299<TT 300CLASS="STRUCTFIELD" 301><I 302>flags</I 303></TT 304> field.</P 305><DIV 306CLASS="INFORMALTABLE" 307><A 308NAME="AEN3318" 309></A 310><P 311></P 312><TABLE 313BORDER="1" 314CLASS="CALSTABLE" 315><TBODY 316><TR 317><TD 318ALIGN="LEFT" 319VALIGN="TOP" 320><TT 321CLASS="LITERAL" 322>SDL_SWSURFACE</TT 323></TD 324><TD 325ALIGN="LEFT" 326VALIGN="TOP" 327>Surface is stored in system memory</TD 328></TR 329><TR 330><TD 331ALIGN="LEFT" 332VALIGN="TOP" 333><TT 334CLASS="LITERAL" 335>SDL_HWSURFACE</TT 336></TD 337><TD 338ALIGN="LEFT" 339VALIGN="TOP" 340>Surface is stored in video memory</TD 341></TR 342><TR 343><TD 344ALIGN="LEFT" 345VALIGN="TOP" 346><TT 347CLASS="LITERAL" 348>SDL_ASYNCBLIT</TT 349></TD 350><TD 351ALIGN="LEFT" 352VALIGN="TOP" 353>Surface uses asynchronous blits if possible</TD 354></TR 355><TR 356><TD 357ALIGN="LEFT" 358VALIGN="TOP" 359><TT 360CLASS="LITERAL" 361>SDL_ANYFORMAT</TT 362></TD 363><TD 364ALIGN="LEFT" 365VALIGN="TOP" 366>Allows any pixel-format (Display surface)</TD 367></TR 368><TR 369><TD 370ALIGN="LEFT" 371VALIGN="TOP" 372><TT 373CLASS="LITERAL" 374>SDL_HWPALETTE</TT 375></TD 376><TD 377ALIGN="LEFT" 378VALIGN="TOP" 379>Surface has exclusive palette</TD 380></TR 381><TR 382><TD 383ALIGN="LEFT" 384VALIGN="TOP" 385><TT 386CLASS="LITERAL" 387>SDL_DOUBLEBUF</TT 388></TD 389><TD 390ALIGN="LEFT" 391VALIGN="TOP" 392>Surface is double buffered (Display surface)</TD 393></TR 394><TR 395><TD 396ALIGN="LEFT" 397VALIGN="TOP" 398><TT 399CLASS="LITERAL" 400>SDL_FULLSCREEN</TT 401></TD 402><TD 403ALIGN="LEFT" 404VALIGN="TOP" 405>Surface is full screen (Display Surface)</TD 406></TR 407><TR 408><TD 409ALIGN="LEFT" 410VALIGN="TOP" 411><TT 412CLASS="LITERAL" 413>SDL_OPENGL</TT 414></TD 415><TD 416ALIGN="LEFT" 417VALIGN="TOP" 418>Surface has an OpenGL context (Display Surface)</TD 419></TR 420><TR 421><TD 422ALIGN="LEFT" 423VALIGN="TOP" 424><TT 425CLASS="LITERAL" 426>SDL_OPENGLBLIT</TT 427></TD 428><TD 429ALIGN="LEFT" 430VALIGN="TOP" 431>Surface supports OpenGL blitting (Display Surface)</TD 432></TR 433><TR 434><TD 435ALIGN="LEFT" 436VALIGN="TOP" 437><TT 438CLASS="LITERAL" 439>SDL_RESIZABLE</TT 440></TD 441><TD 442ALIGN="LEFT" 443VALIGN="TOP" 444>Surface is resizable (Display Surface)</TD 445></TR 446><TR 447><TD 448ALIGN="LEFT" 449VALIGN="TOP" 450><TT 451CLASS="LITERAL" 452>SDL_HWACCEL</TT 453></TD 454><TD 455ALIGN="LEFT" 456VALIGN="TOP" 457>Surface blit uses hardware acceleration</TD 458></TR 459><TR 460><TD 461ALIGN="LEFT" 462VALIGN="TOP" 463><TT 464CLASS="LITERAL" 465>SDL_SRCCOLORKEY</TT 466></TD 467><TD 468ALIGN="LEFT" 469VALIGN="TOP" 470>Surface use colorkey blitting</TD 471></TR 472><TR 473><TD 474ALIGN="LEFT" 475VALIGN="TOP" 476><TT 477CLASS="LITERAL" 478>SDL_RLEACCEL</TT 479></TD 480><TD 481ALIGN="LEFT" 482VALIGN="TOP" 483>Colorkey blitting is accelerated with RLE</TD 484></TR 485><TR 486><TD 487ALIGN="LEFT" 488VALIGN="TOP" 489><TT 490CLASS="LITERAL" 491>SDL_SRCALPHA</TT 492></TD 493><TD 494ALIGN="LEFT" 495VALIGN="TOP" 496>Surface blit uses alpha blending</TD 497></TR 498><TR 499><TD 500ALIGN="LEFT" 501VALIGN="TOP" 502><TT 503CLASS="LITERAL" 504>SDL_PREALLOC</TT 505></TD 506><TD 507ALIGN="LEFT" 508VALIGN="TOP" 509>Surface uses preallocated memory</TD 510></TR 511></TBODY 512></TABLE 513><P 514></P 515></DIV 516></DIV 517><DIV 518CLASS="REFSECT1" 519><A 520NAME="AEN3381" 521></A 522><H2 523>See Also</H2 524><P 525><A 526HREF="sdlpixelformat.html" 527><SPAN 528CLASS="STRUCTNAME" 529>SDL_PixelFormat</SPAN 530></A 531></P 532></DIV 533><DIV 534CLASS="NAVFOOTER" 535><HR 536ALIGN="LEFT" 537WIDTH="100%"><TABLE 538SUMMARY="Footer navigation table" 539WIDTH="100%" 540BORDER="0" 541CELLPADDING="0" 542CELLSPACING="0" 543><TR 544><TD 545WIDTH="33%" 546ALIGN="left" 547VALIGN="top" 548><A 549HREF="sdlpixelformat.html" 550ACCESSKEY="P" 551>Prev</A 552></TD 553><TD 554WIDTH="34%" 555ALIGN="center" 556VALIGN="top" 557><A 558HREF="index.html" 559ACCESSKEY="H" 560>Home</A 561></TD 562><TD 563WIDTH="33%" 564ALIGN="right" 565VALIGN="top" 566><A 567HREF="sdlvideoinfo.html" 568ACCESSKEY="N" 569>Next</A 570></TD 571></TR 572><TR 573><TD 574WIDTH="33%" 575ALIGN="left" 576VALIGN="top" 577>SDL_PixelFormat</TD 578><TD 579WIDTH="34%" 580ALIGN="center" 581VALIGN="top" 582><A 583HREF="video.html" 584ACCESSKEY="U" 585>Up</A 586></TD 587><TD 588WIDTH="33%" 589ALIGN="right" 590VALIGN="top" 591>SDL_VideoInfo</TD 592></TR 593></TABLE 594></DIV 595></BODY 596></HTML 597>