~ubuntu-branches/ubuntu/trusty/cuneiform/trusty

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/lns32/src/lns_skew1024.h

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk, c-assert.diff, slovenian-slv.diff
  • Date: 2011-01-26 21:53:07 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110126215307-62x61mcesr607qb7
Tags: 1.0.0+dfsg-2
* Upload to unstable.
* Explicitly build-depend on pkg-config. Thanks to Stefano Rivera for the
  bug report.
* Add Vcs-* fields.
* Use the standard C assert() macro, rather than custom Cuneiform one.
  [c-assert.diff]
* Pass CFLAGS, CXXFLAGS and LDFLAGS (get from dpkg-buildflags) to cmake
  (closes: #608345). Thanks to Sami Liedes for the bug report.
  + Build depend on dpkg-dev (>= 1.15.7).
* Pass --parallel to dh.
  + Bump debhelper minimum version to 7.4.10.
* Update debian/copyright to the latest DEP-5 version.
* Bump year in debian/copyright.
* Explicitly link to GraphicsMagick (rather than via the ImageMagick
  compatibility layer).
* Don't ship /usr/lib/cuneiform/*.so symlinks. These libraries are
  considered private, at least until #598616 is fixed.
* Rename some private variables in debian/rules to make them lowercase.
* Update patch headers.
* Provide proper ‘build-arch’ and ‘build-indep’ targets in debian/rules.
* Document input format in the manual page (closes: #572061). Thanks to
  Janusz S. Bień for the bug report.
* Use ‘slv’ (rather than ‘slo’) as language code for Slovenian.
  [slovenian-slv.diff]
* Fix package description: Slovenian is supported, Slovak is not.
* Improve documentation of the language (-l) option (closes: #602512).
  Thanks to Jari Aalto for the bug report.
* Install reasons file for vrms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 1993-2008, Cognitive Technologies
3
3
All rights reserved.
4
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
 
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
 
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
32
 
33
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
58
58
//////////////////////////////////////////////////////
59
59
// Rotation routines:
60
60
//
61
 
// inline Point32& Deskew( Point32& pt, Int32 skew1024);
62
 
// inline Point16& Deskew( Point16& pt, Int32 skew1024);
 
61
// inline Point32& Deskew( Point32& pt, int32_t skew1024);
 
62
// inline Point16& Deskew( Point16& pt, int32_t skew1024);
63
63
//
64
64
// NOTE: POSITIVE SKEW == CLOCKWISE
65
65
//////////////////////////////////////////////////////
71
71
 
72
72
#include "cttypes.h"
73
73
 
74
 
inline Point32& Deskew( Point32& pt, Int32 skew1024)
 
74
inline Point32& Deskew( Point32& pt, int32_t skew1024)
75
75
{
76
76
   long phi_sq = (skew1024*skew1024);
77
77
   long dx = ( (skew1024*pt.y+0x200) >> 10 );
85
85
   return pt;
86
86
}
87
87
 
88
 
inline Point16& Deskew( Point16& pt, Int32 skew1024)
 
88
inline Point16& Deskew( Point16& pt, int32_t skew1024)
89
89
{
90
90
   long phi_sq = (skew1024*skew1024);
91
91
   long dx = ( (skew1024*(long)pt.y+0x200) >> 10 );
92
92
   long dy = ( (skew1024*(long)pt.x+0x200) >> 10 );
93
93
   long ddx =( (phi_sq*(long)pt.x+0x100000) >> 21 );
94
94
   long ddy =( (phi_sq*(long)pt.y+0x100000) >> 21 );
95
 
   pt.x -= (Int16)dx;
96
 
   pt.x -= (Int16)ddx;
97
 
   pt.y += (Int16)dy;
98
 
   pt.y -= (Int16)ddy;
 
95
   pt.x -= (int16_t)dx;
 
96
   pt.x -= (int16_t)ddx;
 
97
   pt.y += (int16_t)dy;
 
98
   pt.y -= (int16_t)ddy;
99
99
   return pt;
100
100
}
101
101
 
102
 
inline Point32& DeskewRel( Point32& pt, Int32 skew1024, Point32& rel )
 
102
inline Point32& DeskewRel( Point32& pt, int32_t skew1024, Point32& rel )
103
103
{
104
104
   pt.x -= rel.x;
105
105
   pt.y -= rel.y;
109
109
   return pt;
110
110
}
111
111
 
112
 
inline Point16& DeskewRel( Point16& pt, Int32 skew1024, Point16& rel )
 
112
inline Point16& DeskewRel( Point16& pt, int32_t skew1024, Point16& rel )
113
113
{
114
114
   pt.x -= rel.x;
115
115
   pt.y -= rel.y;
141
141
 
142
142
inline Point16& Copy(Point16& dst, Point32 const & src)
143
143
{
144
 
   dst.x=(Int16)src.x; dst.y=(Int16)src.y;
 
144
   dst.x=(int16_t)src.x; dst.y=(int16_t)src.y;
145
145
   return dst;
146
146
}
147
147
 
154
154
 
155
155
inline Rect16& Copy(Rect16& dst, Rect32 const & src)
156
156
{
157
 
   dst.left = (Int16)src.left; dst.right  = (Int16)src.right;
158
 
   dst.top  = (Int16)src.top;  dst.bottom = (Int16)src.bottom;
 
157
   dst.left = (int16_t)src.left; dst.right  = (int16_t)src.right;
 
158
   dst.top  = (int16_t)src.top;  dst.bottom = (int16_t)src.bottom;
159
159
   return dst;
160
160
}
161
161
 
181
181
}
182
182
inline Rect16& Pt2Rc(Rect16& dst, Point32 const & a, Point32 const & b )
183
183
{
184
 
   dst.left = (Int16)a.x; dst.right  = (Int16)b.x;
185
 
   dst.top  = (Int16)a.y; dst.bottom = (Int16)b.y;
 
184
   dst.left = (int16_t)a.x; dst.right  = (int16_t)b.x;
 
185
   dst.top  = (int16_t)a.y; dst.bottom = (int16_t)b.y;
186
186
   return dst;
187
187
}
188
188
 
190
190
// movements ( -=, += )
191
191
#define RC_MINUS_PT  {  rc.left  -= pt.x; rc.right -= pt.x; rc.top   -= pt.y; rc.bottom-= pt.y; return rc; }
192
192
#define RC_PLUS_PT   {  rc.left  += pt.x; rc.right += pt.x; rc.top   += pt.y; rc.bottom+= pt.y; return rc; }
193
 
#define RC_MINUS_PT_16 {  rc.left  -= (Int16)pt.x; rc.right -= (Int16)pt.x; rc.top   -= (Int16)pt.y; rc.bottom-= (Int16)pt.y; return rc; }
194
 
#define RC_PLUS_PT_16  {  rc.left  += (Int16)pt.x; rc.right += (Int16)pt.x; rc.top   += (Int16)pt.y; rc.bottom+= (Int16)pt.y; return rc; }
 
193
#define RC_MINUS_PT_16 {  rc.left  -= (int16_t)pt.x; rc.right -= (int16_t)pt.x; rc.top   -= (int16_t)pt.y; rc.bottom-= (int16_t)pt.y; return rc; }
 
194
#define RC_PLUS_PT_16  {  rc.left  += (int16_t)pt.x; rc.right += (int16_t)pt.x; rc.top   += (int16_t)pt.y; rc.bottom+= (int16_t)pt.y; return rc; }
195
195
inline Rect32& operator -=(Rect32& rc, Point32 const & pt)  RC_MINUS_PT
196
196
inline Rect16& operator -=(Rect16& rc, Point16 const & pt)  RC_MINUS_PT_16
197
197
inline Rect32& operator -=(Rect32& rc, Point16 const & pt)  RC_MINUS_PT
326
326
 
327
327
 
328
328
//////////////////////////////////////////////////
329
 
inline Rect32& DeskewCenter( Rect32& rc, Int32 skew1024)
330
 
{
331
 
   Point32 center; GetCenter(rc, center);
332
 
   Point32 old_center = center;
333
 
   Deskew( center, skew1024 );
334
 
   center -= old_center;   // diff
335
 
   rc += center;
336
 
   return rc;
337
 
}
338
 
 
339
 
inline Rect16& DeskewCenter( Rect16& rc, Int32 skew1024)
340
 
{
341
 
   Point16 center; GetCenter(rc, center);
342
 
   Point16 old_center = center;
343
 
   Deskew( center, skew1024 );
344
 
   center -= old_center;   // diff
345
 
   rc += center;
346
 
   return rc;
347
 
}
348
 
 
349
 
inline Rect32& DeskewCenterRel( Rect32& rc, Int32 skew1024, Point32& pt)
350
 
{
351
 
   Point32 center; GetCenter(rc, center);
352
 
   Point32 old_center = center;
353
 
   DeskewRel( center, skew1024, pt );
354
 
   center -= old_center;   // diff
355
 
   rc += center;
356
 
   return rc;
357
 
}
358
 
 
359
 
inline Rect16& DeskewCenterRel( Rect16& rc, Int32 skew1024, Point16& pt)
360
 
{
361
 
   Point16 center; GetCenter(rc, center);
362
 
   Point16 old_center = center;
363
 
   DeskewRel( center, skew1024, pt );
364
 
   center -= old_center;   // diff
365
 
   rc += center;
366
 
   return rc;
367
 
}
368
 
 
369
 
inline Rect16& Expand( Rect16& rc, Int16 delta )
 
329
inline Rect32& DeskewCenter( Rect32& rc, int32_t skew1024)
 
330
{
 
331
   Point32 center; GetCenter(rc, center);
 
332
   Point32 old_center = center;
 
333
   Deskew( center, skew1024 );
 
334
   center -= old_center;   // diff
 
335
   rc += center;
 
336
   return rc;
 
337
}
 
338
 
 
339
inline Rect16& DeskewCenter( Rect16& rc, int32_t skew1024)
 
340
{
 
341
   Point16 center; GetCenter(rc, center);
 
342
   Point16 old_center = center;
 
343
   Deskew( center, skew1024 );
 
344
   center -= old_center;   // diff
 
345
   rc += center;
 
346
   return rc;
 
347
}
 
348
 
 
349
inline Rect32& DeskewCenterRel( Rect32& rc, int32_t skew1024, Point32& pt)
 
350
{
 
351
   Point32 center; GetCenter(rc, center);
 
352
   Point32 old_center = center;
 
353
   DeskewRel( center, skew1024, pt );
 
354
   center -= old_center;   // diff
 
355
   rc += center;
 
356
   return rc;
 
357
}
 
358
 
 
359
inline Rect16& DeskewCenterRel( Rect16& rc, int32_t skew1024, Point16& pt)
 
360
{
 
361
   Point16 center; GetCenter(rc, center);
 
362
   Point16 old_center = center;
 
363
   DeskewRel( center, skew1024, pt );
 
364
   center -= old_center;   // diff
 
365
   rc += center;
 
366
   return rc;
 
367
}
 
368
 
 
369
inline Rect16& Expand( Rect16& rc, int16_t delta )
370
370
{
371
371
   rc.left -= delta; rc.top -= delta;
372
372
   rc.right+= delta; rc.bottom+= delta;
373
373
   return rc;
374
374
}
375
375
 
376
 
inline Rect32& Expand( Rect32& rc, Int32 delta )
 
376
inline Rect32& Expand( Rect32& rc, int32_t delta )
377
377
{
378
378
   rc.left -= delta; rc.top -= delta;
379
379
   rc.right+= delta; rc.bottom+= delta;
390
390
inline void GetDiag2( Rect16& rc, Point16& rt, Point16& lb )
391
391
{  rt.x = rc.right; rt.y = rc.top; lb.x = rc.left;lb.y = rc.bottom; }
392
392
 
393
 
inline Rect32& GetBounding( Rect32& rc_src, Rect32& rc_dest, Int32 skew1024 )
 
393
inline Rect32& GetBounding( Rect32& rc_src, Rect32& rc_dest, int32_t skew1024 )
394
394
   // dest rect can be the same as source
395
395
{
396
396
   Point32 lt, rb; GetDiag1(rc_src, lt, rb);
414
414
   return rc_dest;
415
415
}
416
416
 
417
 
inline Rect16& GetBounding(  Rect16& rc_src, Rect16& rc_dest, Int32 skew1024 )
 
417
inline Rect16& GetBounding(  Rect16& rc_src, Rect16& rc_dest, int32_t skew1024 )
418
418
   // dest rect can be the same as source
419
419
{
420
420
   Point16 lt, rb; GetDiag1(rc_src, lt, rb);