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 = ...
随机推荐
- c#通用配置文件读写类与格式转换(xml,ini,json)
.NET下编写程序的时候经常会使用到配置文件.配置文件格式通常有xml.ini.json等几种,操作不同类型配置文件需要使用不同的方法,操作较为麻烦.特别是针对同时应用不同格式配置文件的时候,很容易引 ...
- Flask_admin 笔记六 modelView的内置方法
增加model后端Flask-Admin对与之配合的数据库模型做了一些假设. 如果要实现自己的数据库后端,并且Flask-Admin的模型视图仍可按预期工作,则应注意以下事项:1) 每一个model必 ...
- python爬虫xpath的语法
有朋友问我正则,,okey,其实我的正则也不好,但是python下xpath是相对较简单的 简单了解一下xpath: XPath 是一门在 XML 文档中查找信息的语言.XPath 可用来在 XML ...
- Dethe is my Finaunce金融
英国诗人乔叟Dethe is my Finaunce金融 英语中“金融”在14世纪,金融计算时间价值的手段.就随机结果签约的能力.一个允许转让金融权后的清算.<Lamentation of Ma ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(3)
继下面三篇文章完成了kvm虚拟化管理平台webvirtmgr环境的部署安装:kvm虚拟化管理平台WebVirtMgr部署-虚拟化环境安装-完整记录(0)kvm虚拟化管理平台WebVirtMgr部署-完 ...
- C-数据结构-typedef的用法
.typedef的用法 # include <stdio.h> typedef int zhang; //为数据类为int从新取名为zhang 等价于int typedef struct ...
- C语言与汇编衔接1
研究实验二 问题研究过程: 发问:C语言中的变量究竟是什么,通过下面的程序进行C语言中的变量的学习 图1 URL.EXE函数 为了研究main函数的首地址,我首先自作聪明的用了一条_DX=main, ...
- alpa开发阶段团队贡献分
这是我们团队之前决定的分配方式: 1.凡是认真完成自己任务的队员,都将有基础分30分(态度分). 2. 将整个项目细化为不同的任务,列出一个任务清单,在综合.协调完每名成员的意愿后,我会分配清单中的任 ...
- final个人阅读作业
一.软件工程M1/M2总结 1.M1阶段总结: 我们团队的软件工程开发是按照前后端来分别开发的,我是负责后端的.我们的项目是做一个北航的社团平台,是一个网站.在后端我们使用的是ruby on rail ...
- Linux内核分析——第十八章 调试
第十八章 调试 18.1 准备开始 1.在用户级的程序里,bug表现比较直接:在内核中却不清晰. 2.内核级开发的调试工作远比用户级开发艰难的多. 3.准备工作需要的是: (1)一个bug (2 ...