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. php -- 魔术方法 之 删除属性:__unset()

    属性重载:当访问一个不存在或者权限不够的属性的时候,能够触发一系列的魔术方法,就叫做属性重载 __unset():当删除一个不存在或者权限不够的属性的时候会自动触发 <?php //属性重载 c ...

  2. Python 资料性网站。

    伯乐在线:http://blog.jobbole.com/category/python/ http://blog.chinaunix.net/uid/22334392/cid-24327-list- ...

  3. digitalocean --- How To Install Apache Tomcat 8 on Ubuntu 16.04

    https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04 Intr ...

  4. linux_shell_find命令

    使用find查找文件 基本格式:find path expression 1.按照文件名查找 (1)find / -name httpd.conf #在根目录下查找文件httpd.conf,表示在整个 ...

  5. WinForm------如何修改PanelControl控件背景色

    方法: 如何修改panelcontrol背景色 this.bottomPanel.BorderStyle = BorderStyles.NoBorder; this.bottomPanel.Appea ...

  6. Text Particle Systems

    一.简介 在一些企业广告或者网站需要一些动态文字特效的时候,往往有下面这几种选择: 1.Flash制作的文字特效 2.制作一个动态的GIF 3.Javascript+dom+css 4.SVG 二.j ...

  7. Myeclipse下使用Maven搭建spring boot项目(第二篇)

    现在需要搭建spring boot框架,并实现一个HelloWorld的项目,让程序真正运行起来. 一.在pom.xml中引入spring-boot-start-parent,spring官方的叫st ...

  8. js 函数递归优化,arguments.callee 优化

    函数递归是个经典的问题,平常用的时候,小练习可以通过函数名来反复调用,比如: function factorial(num) { if (num <= 1) { return 1; } else ...

  9. Hibernate与数据库的触发器协同工作

    Hibernate 与数据库中的触发器协同工作时, 会造成两类问题 1触发器使 Session 的缓存中的持久化对象与数据库中对应的数据不一致:触发器运行在数据库中, 它执行的操作对 Session ...

  10. libxml_disable_entity_loader

    w避免加载外部实体字符. http://php.net/manual/en/function.libxml-disable-entity-loader.php libxml_disable_entit ...