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的更多相关文章

  1. Creating an generated Earth AVI with C++

    Creating an generated Earth AVI with C++        EarthGenerator.cpp /*    EarthGenerator.cpp An examp ...

随机推荐

  1. IIS状态码大全【转】

    对于站长来说,经常分析下网站的IIS日志是有好处的,这样可以随时了解SE蜘蛛是否经常光顾自己的网站,都抓取了哪些页面,被抓取的页面哪些是被正常的,哪些是不正常的.而IIS日志有专门的返回状态码,为了方 ...

  2. 【BZOJ】1607: [Usaco2008 Dec]Patting Heads 轻拍牛头(特殊的技巧)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1607 其实题目描述不清楚,应该是 别人拿的数能整除自己拿的数 数据范围很大,n<=100000 ...

  3. 基于docker部署的微服务架构(四): 配置中心

    原文:http://www.jianshu.com/p/b17d65934b58%20 前言 在微服务架构中,由于服务数量众多,如果使用传统的配置文件管理方式,配置文件分散在各个项目中,不易于集中管理 ...

  4. C# 压缩和解压文件(SharpZipLib)

    先从网上下载ICSharpCode.SharpZipLib.dll类库 将文件或文件夹压缩为zip,函数如下 /// <summary> /// 压缩文件 /// </summary ...

  5. [转]Loadrunner经典面试题

    http://www.mianwww.com/html/category/it-interview/loadrunner/  史上最全 在LoadRunner中为什么要设置思考时间和pacing 答: ...

  6. 【cb2】扩展硬盘

    1.硬盘为sata串口 2.参考 http://docs.cubieboard.org/tutorials/ct1/installation/moving_rootfs_from_nandflash_ ...

  7. 运动目标检测ViBe算法

    一.运动目标检测简介   视频中的运动目标检测这一块现在的方法实在是太多了.运动目标检测的算法依照目标与摄像机之间的关系可以分为静态背景下运动检测和动态背景下运动检测.先简单从视频中的背景类型来讨论. ...

  8. HTML 标签 参考手册

    按功能类别排列 基础 标签 描述 <!DOCTYPE>  定义文档类型. <html> 定义 HTML 文档. <title> 定义文档的标题. <body& ...

  9. hdu 2196(求树上每个节点到树上其他节点的最远距离)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2196 思路:首先任意一次dfs求出树上最长直径的一个端点End,然后以该端点为起点再次dfs求出另一个 ...

  10. Hadoop1.2.1 HDFS原理

    基本以图片的形式呈现给大家: .