zoukankan      html  css  js  c++  java
  • 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_;
    }

     

  • 相关阅读:
    [导入]遍历表单的代码,包括遍历所有,以及遍历特定tag,如input,select lcs
    [导入]JS更改onclick事件 lcs
    [导入]SQLite 字符串长度 函数 lcs
    [导入]休眠 睡眠 区别 lcs
    【转】OpenGL鼠标点击事件
    【转】键盘按键和键盘对应代码表
    【转】vs2010快捷键;sql server 2008快捷;IE9快捷键
    【转】vc6.0移植到VS2010遇到的问题,散分给大家,虽然分不多,各位帮忙
    【转】单缓冲与双缓冲的区别
    【转】光照、材质、纹理的关系
  • 原文地址:https://www.cnblogs.com/honeynm/p/4695857.html
Copyright © 2011-2022 走看看