⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdlblitsurface.html

📁 VC5.6.7的一个扩展库。跟DirectX的功能差不多。
💻 HTML
字号:
<HTML><HEAD><TITLE>SDL_BlitSurface</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="SDL Library Documentation"HREF="index.html"><LINKREL="UP"TITLE="Video"HREF="video.html"><LINKREL="PREVIOUS"TITLE="SDL_ConvertSurface"HREF="sdlconvertsurface.html"><LINKREL="NEXT"TITLE="SDL_FillRect"HREF="sdlfillrect.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFF8DC"TEXT="#000000"LINK="#0000ee"VLINK="#551a8b"ALINK="#ff0000"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">SDL Library Documentation</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="sdlconvertsurface.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sdlfillrect.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SDLBLITSURFACE"></A>SDL_BlitSurface</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN2299"></A><H2>Name</H2>SDL_BlitSurface&nbsp;--&nbsp;This performs a fast blit from the source surface to the destination surface.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN2302"></A><H2>Synopsis</H2><DIVCLASS="FUNCSYNOPSIS"><ANAME="AEN2303"></A><P></P><PRECLASS="FUNCSYNOPSISINFO">#include "SDL.h"</PRE><P><CODE><CODECLASS="FUNCDEF">int <BCLASS="FSFUNC">SDL_BlitSurface</B></CODE>(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);</CODE></P><P></P></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2309"></A><H2>Description</H2><P>This performs a fast blit from the source surface to the destination surface.</P><P>The width and height in <TTCLASS="PARAMETER"><I>srcrect</I></TT> determine thesize of the copied rectangle. Only the position is used in the<TTCLASS="PARAMETER"><I>dstrect</I></TT> (the width and height are ignored).</P><P>If <TTCLASS="PARAMETER"><I>srcrect</I></TT> is <TTCLASS="LITERAL">NULL</TT>, theentire surface is copied. If <TTCLASS="PARAMETER"><I>dstrect</I></TT> is<TTCLASS="LITERAL">NULL</TT>, then the destination position (upper leftcorner) is (0, 0).</P><P>The final blit rectangle is saved in<TTCLASS="PARAMETER"><I>dstrect</I></TT> after all clipping is performed(<TTCLASS="PARAMETER"><I>srcrect</I></TT> is not modified).</P><P>The blit function should not be called on a locked surface.</P><P>The results of blitting operations vary greatly depending on whether <TTCLASS="LITERAL">SDL_SRCAPLHA</TT> is set or not. See <AHREF="sdlsetalpha.html">SDL_SetAlpha</A> for an explaination of how this affects your results. Colorkeying and alpha attributes also interact with surface blitting, as the following pseudo-code should hopefully explain.<PRECLASS="PROGRAMLISTING">if (source surface has SDL_SRCALPHA set) {    if (source surface has alpha channel (that is, format-&#62;Amask != 0))        blit using per-pixel alpha, ignoring any colour key    else {        if (source surface has SDL_SRCCOLORKEY set)            blit using the colour key AND the per-surface alpha value        else            blit using the per-surface alpha value    }} else {    if (source surface has SDL_SRCCOLORKEY set)        blit using the colour key    else        ordinary opaque rectangular blit}</PRE></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2328"></A><H2>Return Value</H2><P>If the blit is successful, it returns <SPANCLASS="RETURNVALUE">0</SPAN>,otherwise it returns <SPANCLASS="RETURNVALUE">-1</SPAN>.</P><P>If either of the surfaces were in video memory, and the blit returns<SPANCLASS="RETURNVALUE">-2</SPAN>, the video memory was lost, so it should bereloaded with artwork and re-blitted:<PRECLASS="PROGRAMLISTING">        while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {                while ( SDL_LockSurface(image)) &#60; 0 )                        SDL_Delay(10);                -- Write image pixels to image-&#62;pixels --                SDL_UnlockSurface(image);        }</PRE>This happens under DirectX 5.0 when the system switches away from yourfullscreen application.  Locking the surface will also fail until youhave access to the video memory again.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2336"></A><H2>See Also</H2><P><AHREF="sdllocksurface.html"><TTCLASS="FUNCTION">SDL_LockSurface</TT></A>,<AHREF="sdlfillrect.html"><TTCLASS="FUNCTION">SDL_FillRect</TT></A>,<AHREF="sdlsurface.html"><SPANCLASS="STRUCTNAME">SDL_Surface</SPAN></A>,<AHREF="sdlrect.html"><SPANCLASS="STRUCTNAME">SDL_Rect</SPAN></A></P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="sdlconvertsurface.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sdlfillrect.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">SDL_ConvertSurface</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="video.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SDL_FillRect</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -