| 1 |
/* |
| 2 |
Copyright (c) 1993-2008, Cognitive Technologies |
| 3 |
All rights reserved. |
| 4 |
|
| 5 |
Разрешается повторное распространение и использование как в виде исходного кода, |
| 6 |
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий: |
| 7 |
|
| 8 |
* При повторном распространении исходного кода должны оставаться указанное |
| 9 |
выше уведомление об авторском праве, этот список условий и последующий |
| 10 |
отказ от гарантий. |
| 11 |
* При повторном распространении двоичного кода в документации и/или в |
| 12 |
других материалах, поставляемых при распространении, должны сохраняться |
| 13 |
указанная выше информация об авторском праве, этот список условий и |
| 14 |
последующий отказ от гарантий. |
| 15 |
* Ни название Cognitive Technologies, ни имена ее сотрудников не могут |
| 16 |
быть использованы в качестве средства поддержки и/или продвижения |
| 17 |
продуктов, основанных на этом ПО, без предварительного письменного |
| 18 |
разрешения. |
| 19 |
|
| 20 |
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК |
| 21 |
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ, |
| 22 |
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ |
| 23 |
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ |
| 24 |
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ |
| 25 |
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ |
| 26 |
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ |
| 27 |
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ, |
| 28 |
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ |
| 29 |
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ, |
| 30 |
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ |
| 31 |
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ. |
| 32 |
|
| 33 |
Redistribution and use in source and binary forms, with or without modification, |
| 34 |
are permitted provided that the following conditions are met: |
| 35 |
|
| 36 |
* Redistributions of source code must retain the above copyright notice, |
| 37 |
this list of conditions and the following disclaimer. |
| 38 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 39 |
this list of conditions and the following disclaimer in the documentation |
| 40 |
and/or other materials provided with the distribution. |
| 41 |
* Neither the name of the Cognitive Technologies nor the names of its |
| 42 |
contributors may be used to endorse or promote products derived from this |
| 43 |
software without specific prior written permission. |
| 44 |
|
| 45 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 46 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 47 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 48 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 49 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 50 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 51 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 52 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 53 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 54 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 55 |
*/ |
| 56 |
|
| 57 |
|
| 58 |
# ifndef __CRI_CONTROL_H_ |
| 59 |
# define __CRI_CONTROL_H_ |
| 60 |
|
| 61 |
#if _MSC_VER > 1000 |
| 62 |
#pragma once |
| 63 |
#endif // _MSC_VER > 1000 |
| 64 |
|
| 65 |
|
| 66 |
#include "resource.h" |
| 67 |
#include "cridefines.h" |
| 68 |
#include "cttypes.h" |
| 69 |
#include "criimage.h" |
| 70 |
#include "ctiimage.h" |
| 71 |
#include "crinvertor.h" // Added by ClassView |
| 72 |
#include "ctdib.h" // Added by ClassView |
| 73 |
#include "rprogressor.h" // Added by ClassView |
| 74 |
#include "cribinarizator.h" |
| 75 |
#include "crturner.h" |
| 76 |
#include "crinvertor.h" |
| 77 |
#include "crrotator.h" |
| 78 |
#include "cttypes.h" // Added by ClassView |
| 79 |
|
| 80 |
class CRIControl |
| 81 |
{ |
| 82 |
private: |
| 83 |
Handle mhOpenedDIB; |
| 84 |
Handle mhCreatedDIB; |
| 85 |
// pointer to class CTDIB |
| 86 |
PCTDIB mpSourceDIB; |
| 87 |
PCTDIB mpDestinationDIB; |
| 88 |
|
| 89 |
|
| 90 |
protected: |
| 91 |
// Name of last processed image |
| 92 |
char mcLastDIBName[256]; |
| 93 |
// |
| 94 |
void * mp_TurnedDIB; |
| 95 |
// pointer to class ProgressShow |
| 96 |
CRProgressor mcProgress; |
| 97 |
// pointer to class Binarizator |
| 98 |
PCRIBinarizator mpBinarizator; |
| 99 |
// pointer to clas Invertor |
| 100 |
PCRInvertor mpInvertor; |
| 101 |
// pointer to class Turn |
| 102 |
PCRTurner mpTurner; |
| 103 |
// pointer to class Rotate |
| 104 |
PCRRotator mpRotator; |
| 105 |
|
| 106 |
public: |
| 107 |
CRIControl(); |
| 108 |
~CRIControl(); |
| 109 |
|
| 110 |
private: |
| 111 |
Bool32 DIBOpeningType; |
| 112 |
RIMAGEMARGINS mrMargins; |
| 113 |
Bool32 mbMarginsFlag; |
| 114 |
|
| 115 |
private: |
| 116 |
Bool32 WriteDIBtoBMP(const char *cName, PCTDIB pDIB); |
| 117 |
Bool32 GetDIB(char* cDIB, Handle* phDIB); |
| 118 |
Bool32 CloseSourceDIB(); |
| 119 |
Bool32 CreateDestinatonDIB(uint32_t BitCount); |
| 120 |
Bool32 SetDestinationDIBtoStorage(char* cDIBName); |
| 121 |
Bool32 OpenDestinationDIBfromSource(char* cSDIB); |
| 122 |
Bool32 CloseDestinationDIB(char* cDIBName); |
| 123 |
Bool32 OpenSourceDIB(char* cDIBName); |
| 124 |
Bool32 SetDIB(char* cDIB, Handle hDIB); |
| 125 |
Bool32 WriteDIB(char* cDIB, Handle hDIB); |
| 126 |
Bool32 ReadDIB(char* cDIB, Handle* phDIB); |
| 127 |
|
| 128 |
public: |
| 129 |
Bool32 RotatePoint(char* cDIB, int32_t iX, int32_t iY, int32_t * prX, int32_t * prY); |
| 130 |
Bool32 StartProgress(void); |
| 131 |
Bool32 SetProgressCallBacks(PRIMAGECBPRogressStart pcbStart, PRIMAGECBPRogressStep pcbStep, PRIMAGECBPRogressFinish pcbFinish); |
| 132 |
Bool32 SetMargins(PRIMAGEMARGINS pMargins); |
| 133 |
Bool32 Binarise(char* cDIBIn, char* cDIBOut, uint32_t wFlag, uint32_t UseMargins); |
| 134 |
Bool32 Rotate(char* cDIBIn, char* cDIBOut, int32_t High, int32_t Low, uint32_t UseMargins); |
| 135 |
Bool32 Roll(char* cDIBIn, char* cDIBOut, int32_t Num, int32_t Denum, uint32_t bUseMargins); |
| 136 |
Bool32 Turn(char* cDIBIn, char* cDIBOut, uint32_t wFlag, uint32_t UseMargins); |
| 137 |
Bool32 Inverse(char* cDIBIn, char* cDIBOut, uint32_t UseMargins); |
| 138 |
}; |
| 139 |
# endif //__CRI_CONTROL_H_ |
| 140 |
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 141 |
// end of file |