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. annexb模式

    h264有两种封装,一种是annexb模式,传统模式,有startcode,SPS和PPS是在ES中一种是mp4模式,一般mp4 mkv会有,没有startcode,SPS和PPS以及其它信息被封装在 ...

  2. 【BZOJ】1664: [Usaco2006 Open]County Fair Events 参加节日庆祝(线段树+dp)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1664 和之前的那题一样啊.. 只不过权值变为了1.. 同样用线段树维护区间,然后在区间范围内dp. ...

  3. 【BZOJ】1639: [Usaco2007 Mar]Monthly Expense 月度开支(二分)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1639 同tyvj1359,http://www.cnblogs.com/iwtwiioi/p/394 ...

  4. 漫游kafka实战篇之搭建Kafka开发环境(3)

    上篇文章中我们搭建了kafka的服务器,并可以使用Kafka的命令行工具创建topic,发送和接收消息.下面我们来搭建kafka的开发环境.   添加依赖   搭建开发环境需要引入kafka的jar包 ...

  5. 剑指 offer set 18 数组中只出现一次的数字

    题目描述: 一个整型数组里除了两个数字之外,其他的数字都出现了两次.请写程序找出这两个只出现一次的数字 思路 1. 思路是先将数组分成两个部分, 两个单个数字分别分到两部分中, 并且数组中其他数字都成 ...

  6. JSP内置对象——request 及其响应get和post请求的实例

    request对象客户端的请求信息被封装在request对象中,通过它才能了解到客户的需求,然后做出响应.它是HttpServletRequest类的实例.request对象具有请求域,即完成客户端的 ...

  7. windows安装oracle11g第二部

    Oracle 11g数据库安装及配置 安装Oracle数据库: 1)压缩包解压,双击运行win64_11gR2_database\database\setup.exe 2)输入电子邮件,点击“下一步” ...

  8. ios 给UIImageView添加阴影

    _borderView.layer.shadowColor = [UIColor grayColor].CGColor; _borderView.layer.shadowOffset = CGSize ...

  9. node npm

    node.js -npm 查看npm版本号$ npm -v 全局安装npm$ npm install npm -g 安装模块$ npm install <module name> --本地 ...

  10. Openstack实现共有云多flat网络

    首先给两台虚拟机添加网卡,模式为仅主机模式 配置控制节点IP /etc/sysconfig/network-scripts/ifcfg-eth1 TYPE=Ethernet BOOTPROTO=sta ...