SDL_BlitSurface
SDL_BlitSurface
Use this function to perform a fast surface copy to a destination surface.
Contents
Syntax
int SDL_BlitSurface(SDL_Surface* src,
const SDL_Rect* srcrect,
SDL_Surface* dst,
SDL_Rect* dstrect)
Function Parameters
src |
the SDL_Surface structure to be copied from |
srcrect |
the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
dst |
the SDL_Surface structure that is the blit target |
dstrect |
the SDL_Rect structure representing the rectangle that is copied into |
Return Value
Returns 0 if the blit is successful or a negative error code on failure; call SDL_GetError() for more information.
Code Examples
You can add your code example here
Remarks
You should call SDL_BlitSurface() unless you know exactly how SDL blitting works internally and how to use the other blit functions.
This is the public blit function, and it performs rectangle validation and clipping before passing it to SDL_LowerBlit().
The blit function should not be called on a locked surface.
The width and height in srcrect determine the size of the copied rectangle. Only the position is used in the dstrect (the width and height are ignored). Blits with negative dstrectcoordinates will be clipped properly.
If srcrect is NULL, the entire surface is copied. If dstrect is NULL, then the destination position (upper left corner) is (0, 0).
The final blit rectangle is saved in dstrect after all clipping is performed (srcrect is not modified).
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
RGBA->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored.
Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison.
RGB->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB, set destination alpha to source per-surface alpha value.
both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key.
RGBA->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored.
Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy all of RGBA to the destination. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison.
RGB->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB.
both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key.
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
Related Functions
SDL_BlitSurface的更多相关文章
- SDL第一个程序:加载一张图片
直接看代码吧 using System; using System.Collections.Generic; using System.ComponentModel; using System.Dat ...
- SDL文字和图形
SDL本身没有显示文字功能,它需要用扩展库SDL_ttf来显示文字.ttf是True Type Font的缩写,ttf是Windows下的缺省字体,它有美观,放大缩小不变形的优点,因此广泛应用很多场合 ...
- SDL制作拼图游戏
看完教程第三集后,好像自己能用这个来写一个简单的拼图游戏,第一次写出个带界面的游戏,好有成就感. 图片是自己慢慢截左上部分8个脸. #include <stdio.h> #include ...
- SDL教程第一和第二个视频的笔记
观看正月点灯笼的SDL教程,地址http://www.tudou.com/listplay/9eG9tkk91oQ.html #include <stdio.h> #include < ...
- SDL1.2学习
http://wenku.baidu.com/view/c953c0878762caaedd33d4d8.html 一.安装: sudo apt-get install libsdl1.2-dev l ...
- 转:SDL2源代码分析
1:初始化(SDL_Init()) SDL简介 有关SDL的简介在<最简单的视音频播放示例7:SDL2播放RGB/YUV>以及<最简单的视音频播放示例9:SDL2播放PCM>中 ...
- SDL1.2到2.0的迁移指南(转)
里面有些单词不好翻译所以放在开头,以备查验. BLock Image Transfer, a computer graphics operation in which two bitmap patte ...
- DLL——SDL_PingGe
这篇随笔专门做SDL的DLL开发. 下面这个版本暂且称为Beta版本吧. /* typedef void (*FUNCTION)(void); HMODULE HDll; HDll = LoadLib ...
- SDL_PingGe 1.2
加入了像素填充函数,必须要在一个指定颜色的边界范围内,边界必须没有缺口. 加入了鼠标类 /* typedef void (*FUNCTION)(void); HMODULE HDll; HDll = ...
随机推荐
- Excel 中批量处理数据(改成 json 格式)
如下excel: 需要处理成下面的效果: 方法: 在 C2 中输入公式: ="{"""&"code"&"" ...
- C# 读取Json配置文件
今天需要用到读取Json配置文件的helper 结果竟然没找到合适的 微软自己有一个 不过不支持.Net fw 4.0 于是自己在NewTonSoft.Json的基础上 加了点小小的封装 ...
- Zookeeper Ephemeral结点使用心得
原文地址:https://www.cnblogs.com/linlemo/p/4807178.html 公司里面在拿Zookeeper做命名服务,通过使用ZK,前端只需要根据指定的ZK地址获得相应的资 ...
- Linux内核第六节 20135332武西垚
如何描述一个进程:进程描述符的数据结构: 如何创建一个进程:内核是如何执行的,以及新创建的进程从哪里开始执行: 使用gdb跟踪新进程的创建过程. 进程的描述 操作系统三大功能: 进程管理(最核心最基础 ...
- Eclipse+tomcat+MySQL搭建JavaWeb开发环境
准备 1.安装JDK并配置环境变量 2.下载Eclipse,Tomcat,MySQL 配置eclipse 解压Eclipse,需要添加Web Tools Platform才能进行web开发 1.启动E ...
- 毕业设计心得与整理-APP-主题切换
1.定义主体颜色: 在style自定义了三个属性: <item name="textLight">@android:color/white</item> & ...
- XMLHttpRequest.withCredentials
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials var xhr = new XMLHtt ...
- K Nearest Neighbor 算法
文章出处:http://coolshell.cn/articles/8052.html K Nearest Neighbor算法又叫KNN算法,这个算法是机器学习里面一个比较经典的算法, 总体来说KN ...
- git 快捷键
实际上就是弄了个别名 $ git config --global alias.st status $ git config --global alias.ci commit $ git config ...
- hive web界面管理
老版本使用 访问<Hive Server Address>:9999/hwi 1.首先下载对应版本的src文件,本机使用apache-hive-1.2.2-src.tar.gz 2.解压缩 ...