KSquare Utilities
ScannerFrame.cpp
Go to the documentation of this file.
1 #include "FirstIncludes.h"
2 #include <stdio.h>
3 #include "MemoryDebug.h"
4 //using namespace std;
5 
6 
7 #include "KKBaseTypes.h"
8 using namespace KKB;
9 
10 #include "ScannerClock.h"
11 #include "ScannerFrame.h"
12 using namespace KKLSC;
13 
14 
15 ScannerFrame::ScannerFrame (ScannerClockPtr _clock,
16  kkint32 _scanLinesPerFrame,
17  kkint32 _pixelsPerScanLine
18  ):
19 
20  clock (_clock),
21  frameNum (-1),
22  height (_scanLinesPerFrame),
23  scanLines (NULL),
24  scanLineFirst (-1),
25  scanLineLast (-1),
26  time (0),
27  width (_pixelsPerScanLine)
28 
29 {
30  clock = _clock;
31  scanLines = AllocateFrameArray ();
32 }
33 
34 
36 {
37  if (scanLines)
38  {
39  for (kkint32 x = 0; x < height; ++x)
40  {
41  delete scanLines[x];
42  scanLines[x] = NULL;
43  }
44  }
45 
46  delete scanLines;
47  scanLines = NULL;
48 }
49 
50 
51 
52 uchar** ScannerFrame::AllocateFrameArray ()
53 {
54  uchar** a = new uchar*[height];
55  for (kkint32 r = 0; r < height; r++)
56  a[r] = new uchar[width];
57  return a;
58 }
59 
60 
61 
63 {
64  time = clock->Time ();
65  return scanLines;
66 }
67 
68 
69 
70 void ScannerFrame::ScanLines (uchar** _scanLines)
71 {
72  time = clock->Time ();
73  scanLines = _scanLines;
74 }
void ScanLines(uchar **_scanLines)
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 Time()
Returns the current value of &#39;time&#39; them increments by 1.
KKTHread * KKTHreadPtr
unsigned char uchar
Unsigned character.
Definition: KKBaseTypes.h:77
Contains Classes that are specific to Cameras physical characteristics.
ScannerFrame(ScannerClockPtr _clock, kkint32 _scanLinesPerFrame, kkint32 _pixelsPerScanLine)
Construct a frame with the dimensions (Height = _scanLinesPerFrame) and (Width = _pixelsPerScanLine)...
Used to buffer one Frame of Scanner Data for use by &#39;ScannerFileBuffered&#39;.
Definition: ScannerFrame.h:16