Debian Codegraph @

cuneiform_src/Kern/rimage/sources/main/crrotator.h

raw
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 // CRRotator.h: interface for the CRRotator class.
58 //
59 //////////////////////////////////////////////////////////////////////
60
61 #if !defined(CRROTATOR_H)
62 #define CRROTATOR_H
63
64 #if _MSC_VER > 1000
65 #pragma once
66 #endif // _MSC_VER > 1000
67
68 #include "ctdib.h"
69 #include "rprogressor.h" // Added by ClassView
70 #include "cttypes.h" // Added by ClassView
71
72 class CRRotator
73 {
74 #define CTROTATOR_MIN_TANG 0.0001
75 #define CTROTATOR_MAX_TANG 0.2
76 // static uint32_t LAtoBytes[512];
77 public:
78 Bool32 RotatePoint(int32_t iX, int32_t iY, int32_t * prX, int32_t * prY);
79 CRRotator( PCRProgressor pProgressIndicator);
80 Bool32 Roll(PCTDIB cDIBIn, PCTDIB cDIBOut, int32_t Num, int32_t Denum);
81 Bool32 Rotate(PCTDIB cDIBIn, PCTDIB cDIBOut, int32_t Num, int32_t Denum);
82 CRRotator();
83 virtual ~CRRotator();
84
85 private:
86 void ComposeLine4(PCTDIB cDIBIn, int32_t iDirect, uint32_t wLine, uint32_t wBuffLen);
87 void AllocWorkBuffers(uint32_t wStringBufferRange);
88 void ResetItself(void);
89 void FreeWorkBuffers(void);
90 Bool32 AddBlackToGray(int32_t X, int32_t Y, uchar Gray);
91 Bool32 UnmaskPixels(puchar pMask, puchar pGrayPix, int32_t X, int32_t Y, uint32_t wLineLen, int32_t ShiftX, int32_t ShiftY);
92 Bool32 GetGrayCoord(int32_t eX, int32_t eY, int32_t * pX, int32_t * pY, int32_t * psX, int32_t * psY);
93 Bool32 RollPoint(int32_t X, int32_t Y, int32_t * pnX, int32_t * pnY);
94 Bool32 GetExtCoord(int32_t X, int32_t Y, int32_t * peX, int32_t * peY);
95 Bool32 DescewGray(PCTDIB cDIBIn, PCTDIB cDIBOut);
96 Bool32 ConstructOutDIB(PCTDIB cDIBIn, PCTDIB cDIBOut, Bool32 Gray);
97 void ComposeLineLA(PCTDIB cDIBIn, int32_t iDirect, uint32_t wLine, uint32_t wBuffLen);
98 void ComposeLineG(PCTDIB cDIBIn, int32_t iDirect, uint32_t wLine, uint32_t wBuffLen);
99 void SetEndLineLA(uint32_t Line, uint32_t wLineW, uint32_t wLineBytes);
100 void PrepareTables( uint32_t wMax, uint32_t wCheck);
101 void ShiftLineLA(uint32_t LocalShift, uint32_t wBytesTo);
102 Bool32 Descew(PCTDIB cDIBIn, PCTDIB cDIBOut);
103
104 protected:
105 uint32_t wWorkGrayBufferLenght;
106 uint32_t mwTablesRange;
107 uint32_t mwDescewedHeight;
108 uint32_t mwDescewedWidth;
109 uint32_t mwOriginalHeight;
110 uint32_t mwOriginalWidth;
111 Handle hBufferForGray;
112 Handle hVShiftLenght;
113 Handle hVShiftTable;
114 Handle hHShiftTable;
115 PCRProgressor mpProgressor;
116 PCTDIB mdDIBOut;
117 Bool32 mbEnableVSS;
118 Bool32 mbEnableVS;
119 Bool32 mbEnableHS;
120 uchar BitFillforGray;
121 uint32_t ToY;
122 uint32_t ToX;
123 uint32_t AtY;
124 uint32_t AtX;
125 int32_t VerticalShift;
126 int32_t HorisontalShift;
127 long double mfCos;
128 long double mfSin;
129 long double mfTang;
130 puchar BufferForGray;
131 int32_t * HShiftTable;
132 uint32_t * VShiftTable;
133 uint32_t * VShiftLenght;
134 };
135
136 typedef CRRotator *PCRRotator, **PPCRRotator;
137 #endif // !defined(CRROTATOR_H)