Avimemdc:a C + + class
This was 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 was provided ' As-is ', without any express or implied
Warranty. In no event would the author be held liable for any damages
arising from the 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 being misrepresented; You must not
Claim that wrote the original source code. If You use the This source code
In a product, an acknowledgment in the product documentation would is
appreciated but isn't required.
2. Altered source versions must is plainly marked as such, and must not being
Misrepresented as being the original source code.
3. This notice is removed or altered from any source distribution.
Renényffenegger [email protected]
*/
#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 was provided ' As-is ', without any express or implied
Warranty. In no event would the author be held liable for any damages
arising from the 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 being misrepresented; You must not
Claim that wrote the original source code. If You use the This source code
In a product, an acknowledgment in the product documentation would is
appreciated but isn't required.
2. Altered source versions must is plainly marked as such, and must not being
Misrepresented as being the original source code.
3. This notice is removed or altered from any source distribution.
Renényffenegger [email protected]
*/
#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