AviMemDc: a C++ class
AviMemDc: a C++ class
        
This class is used in the Avi Examples.
The header file
AviMemDC.h
/* 
   AviMemDC.h
A C++ class for creating avi files
Copyright (c) 2004, 2005 René Nyffenegger
This source code is provided 'as-is', without any express or implied
   warranty. In no event will the author be held liable for any damages
   arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
      claim that you wrote the original source code. If you use this source code
      in a product, an acknowledgment in the product documentation would be
      appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
      misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include "MemoryDC.h"
#include "DibSection.h"
#include "Color.h"
#include "Font.h"
#include "avi.h"
class AviMemDC : public MemoryDC {
public:
    AviMemDC(int width, int height, std::string const& avi_file, int frames_per_second);
void AddFrame();
DibSection& GetDibSection();
private:
    DibSection dib_section_;
    Avi        avi_;
bool       compression_chosen_;
};
The implementation file
AviMemDC.cpp
/* 
   AviMemDC.cpp
A C++ class for creating avi files
Copyright (c) 2004, 2005 René Nyffenegger
This source code is provided 'as-is', without any express or implied
   warranty. In no event will the author be held liable for any damages
   arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
      claim that you wrote the original source code. If you use this source code
      in a product, an acknowledgment in the product documentation would be
      appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
      misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include "AviMemDC.h"
AviMemDC::AviMemDC(int width, int height, std::string const& avi_file, int frames_per_second) : 
  MemoryDC(),
  dib_section_(width, height),
  avi_(avi_file, 1000/frames_per_second, 0),
  compression_chosen_(false)
{
  Select(dib_section_);
}
void AviMemDC::AddFrame() {
  if (!compression_chosen_) {
    avi_.compression(dib_section_, 0, true, 0);
    compression_chosen_ = true;
  }
  avi_.add_frame(dib_section_);
}
DibSection& AviMemDC::GetDibSection() {
  return dib_section_;
}
AviMemDc: a C++ class的更多相关文章
- Creating an generated Earth AVI with C++
		
Creating an generated Earth AVI with C++ EarthGenerator.cpp /* EarthGenerator.cpp An examp ...
 
随机推荐
- IoC最大的好处是什么
			
IoC最大的好处是什么?因为把对象生成放在了XML里定义,所以当我们需要换一个实现子类将会变成很简单(一般这样的对象都是实现于某种接口的),只要修改XML就可以了,这样我们甚至可以实现对象的热插拨(有 ...
 - 【BZOJ】2555: SubString(后缀自动机)
			
http://www.lydsy.com/JudgeOnline/problem.php?id=2555 学到了如何快速维护right值orz (不过这仍然是暴力维护,可以卡到O(n) 首先我们在加一 ...
 - 注解-->Spring配置
			
有必要对JDK 5.0新增的注解(Annotation)技术进行简单的学习,因为Spring 支持@AspectJ,而@AspectJ本身就是基于JDK 5.0的注解技术.所以学习JDK 5.0的注解 ...
 - JavaScript的arguements
			
---恢复内容开始--- arguments 对象 在函数代码中,使用特殊对象 arguments,开发者无需明确指出参数名,就能访问它们. 例如,在函数 sayHi() 中,第一个参数是 messa ...
 - DecimalFormat 四舍五入Float类型的坑
			
今天又踩了一个坑,使用DecimalFormat来完毕四舍五入.可是传入的是float类型,几轮測试才发现一个问题,传入的float会被转为double类型.大家都知道float是4位,double是 ...
 - 九度OJ 上剑指 offer 习题目录
			
<剑指Offer>面试题集收录汇总 面试题1 赋值运算符函数 不适合在线模式 面试题2 实现Singleton模式 不适合在线模式 面试题3 二维数组中的查找 已收录 面试题4 替换空格 ...
 - JZOJ.5327【NOIP2017模拟8.21】四驱兄弟
			
Description
 - [SCOI2010]序列操作[分块or线段树]
			
#include<cstdio> #include<iostream> #define lc k<<1 #define rc k<<1|1 using ...
 - 使用隧道技术进行C&C通信
			
一.C&C通信 这里的C&C服务器指的是Command & Control Server--命令和控制服务器,说白了就是被控主机的遥控端.一般C&C节点分为两种,C&a ...
 - kettle中denormalizer(列转行)的使用
			
转载: 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://sucre.blog.51cto.com/1084905/1434015 ...