Documentation
 All Classes Functions Variables Properties
Page.h
1 #pragma once
2 #include "ImagingDef.h"
3 
4 namespace MST{
5  namespace Imaging{
6 
7  ref class FileFormat;
8 
13  public ref class Page
14  {
15  public:
21  Page(FileFormat^ fileFmt,int iPageNum);
22 
27  void RotateFlip(RotateFlipType);
28  public:
32  property int Width
33  {
34  int get()
35  {
36  return (m_Bmp!=nullptr)?m_Bmp->Width:-1;
37  }
38  }
39 
43  property int Height
44  {
45  int get()
46  {
47  return (m_Bmp!=nullptr)?m_Bmp->Height:-1;
48  }
49  }
50 
54  property int BitDepth
55  {
56  int get()
57  {
58  if(m_Bmp==nullptr)
59  return -1;
60  switch(m_Bmp->PixelFormat)
61  {
62  case System::Drawing::Imaging::PixelFormat::Format1bppIndexed:
63  return 1;
64  case System::Drawing::Imaging::PixelFormat::Format4bppIndexed:
65  return 4;
66  case System::Drawing::Imaging::PixelFormat::Format8bppIndexed:
67  return 8;
68  case System::Drawing::Imaging::PixelFormat::Format32bppArgb:
69  case System::Drawing::Imaging::PixelFormat::Format32bppPArgb :
70  case System::Drawing::Imaging::PixelFormat::Format32bppRgb:
71  return 32;
72  }
73  return 24;
74  }
75  }
76 
80  property array<System::Drawing::Color>^ ColorTable
81  {
82  array<System::Drawing::Color>^ get()
83  {
84  return (m_Bmp!=nullptr)?m_Bmp->Palette->Entries:gcnew array<System::Drawing::Color>(0);
85  }
86  }
87 
91  property array<Byte>^ RawPixelData
92  {
93  array<Byte>^ get()
94  {
95  if(m_Bmp != nullptr)
96  {
97  System::Drawing::Imaging::BitmapData^ bmpData = m_Bmp->LockBits(System::Drawing::Rectangle(0,0,m_Bmp->Width,m_Bmp->Height),System::Drawing::Imaging::ImageLockMode::WriteOnly,
98  m_Bmp->PixelFormat);
99  if(bmpData != nullptr)
100  {
101  array<Byte>^ byArr = gcnew array<Byte>(bmpData->Stride*m_Bmp->Height);
102  System::Runtime::InteropServices::Marshal::Copy(bmpData->Scan0,byArr,0,bmpData->Stride*m_Bmp->Height);
103  m_Bmp->UnlockBits(bmpData);
104  return byArr;
105  }
106  }
107  return gcnew array<Byte>(0);
108  }
109  }
110 
114  property int VerticalResolution
115  {
116  int get()
117  {
118  return (m_Bmp!=nullptr)?m_Bmp->VerticalResolution:-1;
119  }
120  }
121 
125  property int HorizontalResolution
126  {
127  int get()
128  {
129  return (m_Bmp!=nullptr)?m_Bmp->HorizontalResolution:-1;
130  }
131  }
132 
136  property System::Drawing::Image^ Image
137  {
138  System::Drawing::Image^ get()
139  {
140  return m_Bmp;
141  }
142  }
143 
147  property Object^ Tag
148  {
149  Object^ get(){return m_Tag;}
150  void set(Object^ value){m_Tag = value;}
151  }
152 
156  property System::Drawing::Image^ ScaledImage[float,float]
157  {
158  virtual System::Drawing::Image^ get(float x,float y)
159  {
160  if(m_Bmp!=nullptr)
161  return gcnew System::Drawing::Bitmap(m_Bmp,x*m_Bmp->Width,y*m_Bmp->Height);
162  else return nullptr;
163  }
164  }
165 
170  {
171  PAGEINFO get()
172  {
173  PAGEINFO pageInfo;
174  pageInfo.nWidth = Width;
175  pageInfo.nHeight = Height;
176  pageInfo.nBitCount = BitDepth;
177  pageInfo.nXRes = HorizontalResolution;
178  pageInfo.nYRes = VerticalResolution;
179  return pageInfo;
180  }
181  }
182 
189  void Draw(System::Drawing::Graphics^ g,int x,int y);
190 
199  void Draw(System::Drawing::Graphics^ g,float x,float y,float width,float height);
200  bool UpdateImage(array<Byte>^ imgData);
201  protected:
202  System::Drawing::Image^ LoadImage(int iHeight,int iWidth,int iBitDepth,array<Byte>^ pixelData,array<Byte>^ clrTable);
203  protected:
204  FileFormat^ m_fileformat;
205  int m_iPageNum;
206  System::Drawing::Bitmap^ m_Bmp;
207  Object^ m_Tag;
208  };
209  }
210 }
Object^ Tag
Use to get Tag of page.
Definition: Page.h:147
int BitDepth
Use to get BitDepth of page.
Definition: Page.h:54
int HorizontalResolution
Use to get HorizontalResolution of page.
Definition: Page.h:125
int Height
Use to get Height of page.
Definition: Page.h:43
Page(FileFormat^ fileFmt, int iPageNum)
Constructor of a class.
Definition: ImageProcess.h:13
Definition: ImagingDef.h:81
Definition: FileFormat.h:15
void RotateFlip(RotateFlipType)
Use to rotate or flip the page.
array< Byte >^ RawPixelData
Use to get RawPixelData of page.
Definition: Page.h:91
array< System::Drawing::Color >^ ColorTable
Use to get ColorTable of page.
Definition: Page.h:80
Definition: Image.h:15
Definition: Page.h:13
void Draw(System::Drawing::Graphics^ g, int x, int y)
Use to draw page.
int Width
Use to get width of page.
Definition: Page.h:32
int VerticalResolution
Use to get VerticalResolution of page.
Definition: Page.h:114