mirror of
https://gitee.com/Polarix/simplegui.git
synced 2025-08-12 05:02:51 +00:00
2018-01-09:改进模拟器像素面板的缓存结构,方便后续拓展。
This commit is contained in:
parent
09eea18a99
commit
0e80ac4044
@ -3,14 +3,14 @@
|
|||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
//= Include files. =//
|
//= Include files. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
#include "wxDotLCD.h"
|
#include "wxPixelatedPanel.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
|
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
//= Class declare. =//
|
//= Class declare. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
class MonochromeDotLCD : public wxDotLCD
|
class MonochromeDotLCD : public wxPixelatedPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
uint32_t m_uiPageCount;
|
uint32_t m_uiPageCount;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
//= Event table. =//
|
//= Event table. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
BEGIN_EVENT_TABLE(MonochromeDotLCD,wxDotLCD)
|
BEGIN_EVENT_TABLE(MonochromeDotLCD,wxPixelatedPanel)
|
||||||
EVT_SET_FOCUS (MonochromeDotLCD::wxEvent_OnSetFocus)
|
EVT_SET_FOCUS (MonochromeDotLCD::wxEvent_OnSetFocus)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ END_EVENT_TABLE()
|
|||||||
//= Function define. =//
|
//= Function define. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
MonochromeDotLCD::MonochromeDotLCD(wxWindow *pclsParent, wxWindowID iWinID, const wxPoint& clsPosition):
|
MonochromeDotLCD::MonochromeDotLCD(wxWindow *pclsParent, wxWindowID iWinID, const wxPoint& clsPosition):
|
||||||
wxDotLCD(pclsParent, iWinID, clsPosition)
|
wxPixelatedPanel(pclsParent, iWinID, clsPosition)
|
||||||
{
|
{
|
||||||
m_pclsPanelColor = new wxColor(0x00, 0x00, 0x00, 0x00);
|
m_pclsPanelColor = new wxColor(0x00, 0x00, 0x00, 0x00);
|
||||||
m_pclsPixelColor = new wxColor(0x00, 0x00, 0x00, 0x00);
|
m_pclsPixelColor = new wxColor(0x00, 0x00, 0x00, 0x00);
|
||||||
@ -37,16 +37,16 @@ void MonochromeDotLCD::SetParameter(PixelPanelParameter* pstPanelParameter)
|
|||||||
{
|
{
|
||||||
if(NULL != pstPanelParameter)
|
if(NULL != pstPanelParameter)
|
||||||
{
|
{
|
||||||
wxDotLCD::SetEdgeWidth(pstPanelParameter->EdgeWidth);
|
wxPixelatedPanel::SetEdgeWidth(pstPanelParameter->EdgeWidth);
|
||||||
wxDotLCD::SetPixelSize(pstPanelParameter->PixelSize);
|
wxPixelatedPanel::SetPixelSize(pstPanelParameter->PixelSize);
|
||||||
wxDotLCD::SetGridVisibled(pstPanelParameter->EnableGrid);
|
wxPixelatedPanel::SetGridVisibled(pstPanelParameter->EnableGrid);
|
||||||
wxDotLCD::SetDisplaySizes(pstPanelParameter->HorizontalPixelNumber, pstPanelParameter->VerticalPixelNumber);
|
wxPixelatedPanel::SetPixelNumber(pstPanelParameter->HorizontalPixelNumber, pstPanelParameter->VerticalPixelNumber);
|
||||||
m_uiColumnCount = pstPanelParameter->HorizontalPixelNumber;
|
m_uiColumnCount = pstPanelParameter->HorizontalPixelNumber;
|
||||||
m_uiPageCount = pstPanelParameter->VerticalPixelNumber/8;
|
m_uiPageCount = pstPanelParameter->VerticalPixelNumber/8;
|
||||||
|
|
||||||
m_pclsPanelColor->SetRGBA(pstPanelParameter->PanelColor.RGBA);
|
m_pclsPanelColor->SetRGBA(pstPanelParameter->PanelColor.RGBA);
|
||||||
m_pclsPixelColor->SetRGBA(pstPanelParameter->PixelColor.RGBA);
|
m_pclsPixelColor->SetRGBA(pstPanelParameter->PixelColor.RGBA);
|
||||||
wxDotLCD::SetDisplayColors( wxColor(pstPanelParameter->EdgeColor.RGBA),
|
wxPixelatedPanel::SetColors( wxColor(pstPanelParameter->EdgeColor.RGBA),
|
||||||
wxColor(pstPanelParameter->PanelColor.RGBA),
|
wxColor(pstPanelParameter->PanelColor.RGBA),
|
||||||
wxColor(pstPanelParameter->GridColor.RGBA));
|
wxColor(pstPanelParameter->GridColor.RGBA));
|
||||||
}
|
}
|
||||||
@ -57,11 +57,11 @@ void MonochromeDotLCD::SetPixel(uint32_t uiPosX, uint32_t uiPosY, LCD_PIXEL_COLO
|
|||||||
{
|
{
|
||||||
if(LCD_PIXEL_COLOR_L == ePixelValue)
|
if(LCD_PIXEL_COLOR_L == ePixelValue)
|
||||||
{
|
{
|
||||||
wxDotLCD::SetPixelUnitColor(uiPosX, uiPosY, *m_pclsPanelColor);
|
wxPixelatedPanel::SetPixelUnitColor(uiPosX, uiPosY, *m_pclsPanelColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxDotLCD::SetPixelUnitColor(uiPosX, uiPosY, *m_pclsPixelColor);
|
wxPixelatedPanel::SetPixelUnitColor(uiPosX, uiPosY, *m_pclsPixelColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +97,11 @@ void MonochromeDotLCD::DrawPixel(uint32_t uiPosX, uint32_t uiPosY, LCD_PIXEL_COL
|
|||||||
{
|
{
|
||||||
if(LCD_PIXEL_COLOR_L == ePixelValue)
|
if(LCD_PIXEL_COLOR_L == ePixelValue)
|
||||||
{
|
{
|
||||||
wxDotLCD::DrawPixel(uiPosX, uiPosY, *m_pclsPanelColor);
|
wxPixelatedPanel::DrawPixel(uiPosX, uiPosY, *m_pclsPanelColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxDotLCD::DrawPixel(uiPosX, uiPosY, *m_pclsPixelColor);
|
wxPixelatedPanel::DrawPixel(uiPosX, uiPosY, *m_pclsPixelColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ void MonochromeDotLCD::CleanScreen(void)
|
|||||||
{
|
{
|
||||||
uint32_t uiHorizontalPixelNumber, uiVerticalPixelNumber;
|
uint32_t uiHorizontalPixelNumber, uiVerticalPixelNumber;
|
||||||
|
|
||||||
GetDisplaySize(&uiHorizontalPixelNumber, &uiVerticalPixelNumber);
|
GetPixelNumber(&uiHorizontalPixelNumber, &uiVerticalPixelNumber);
|
||||||
for(uint32_t i_V=0; i_V<uiVerticalPixelNumber; i_V++)
|
for(uint32_t i_V=0; i_V<uiVerticalPixelNumber; i_V++)
|
||||||
{
|
{
|
||||||
for(uint32_t i_H=0; i_H<uiHorizontalPixelNumber; i_H++)
|
for(uint32_t i_H=0; i_H<uiHorizontalPixelNumber; i_H++)
|
||||||
|
@ -101,10 +101,6 @@
|
|||||||
<Unit filename="../../../DemoProc/src/VariableBox.c">
|
<Unit filename="../../../DemoProc/src/VariableBox.c">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="../../../GUI/inc/Font_H12.h" />
|
|
||||||
<Unit filename="../../../GUI/inc/Font_H16.h" />
|
|
||||||
<Unit filename="../../../GUI/inc/Font_H32.h" />
|
|
||||||
<Unit filename="../../../GUI/inc/Font_H8.h" />
|
|
||||||
<Unit filename="../../../GUI/inc/SGUI_Basic.h" />
|
<Unit filename="../../../GUI/inc/SGUI_Basic.h" />
|
||||||
<Unit filename="../../../GUI/inc/SGUI_Common.h" />
|
<Unit filename="../../../GUI/inc/SGUI_Common.h" />
|
||||||
<Unit filename="../../../GUI/inc/SGUI_Frame.h" />
|
<Unit filename="../../../GUI/inc/SGUI_Frame.h" />
|
||||||
@ -179,8 +175,8 @@
|
|||||||
<Unit filename="../../Resource/Resource.rc">
|
<Unit filename="../../Resource/Resource.rc">
|
||||||
<Option compilerVar="WINDRES" />
|
<Option compilerVar="WINDRES" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="../../wxExpand/inc/wxDotLCD.h" />
|
<Unit filename="../../wxExpand/inc/wxPixelatedPanel.h" />
|
||||||
<Unit filename="../../wxExpand/src/wxDotLCD.cpp" />
|
<Unit filename="../../wxExpand/src/wxPixelatedPanel.cpp" />
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<code_completion />
|
<code_completion />
|
||||||
<envvars />
|
<envvars />
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
/// Class LCD_DisplayPanel
|
/// Class LCD_DisplayPanel
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class wxDotLCD : public wxPanel
|
class wxPixelatedPanel : public wxPanel
|
||||||
{
|
{
|
||||||
private: //Appearance parameters.
|
private:
|
||||||
// Colors
|
// Colors
|
||||||
wxColor* m_pclsEdgeColor;
|
wxColor* m_pclsEdgeColor;
|
||||||
wxColor* m_pclsBaseColor;
|
wxColor* m_pclsBaseColor;
|
||||||
@ -24,34 +24,32 @@ private: //Appearance parameters.
|
|||||||
uint32_t m_uiEdgeWidth;
|
uint32_t m_uiEdgeWidth;
|
||||||
bool m_bGridVisible;
|
bool m_bGridVisible;
|
||||||
// Private data declare.
|
// Private data declare.
|
||||||
private: // Private data.
|
// Private data.
|
||||||
uint32_t* m_parrDisplayBuffer;
|
uint32_t** m_ppuiDisplayBuffer;
|
||||||
void (wxDotLCD::*m_pfDrawPoint)(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
void (wxPixelatedPanel::*m_pfDrawPoint)(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
||||||
|
// Private object;
|
||||||
private: // Private object;
|
|
||||||
wxClientDC m_clsCDC;
|
wxClientDC m_clsCDC;
|
||||||
wxPen m_clsPen;
|
wxPen m_clsPen;
|
||||||
wxBrush m_clsBrush;
|
wxBrush m_clsBrush;
|
||||||
|
|
||||||
private: // Event callback function.
|
private:
|
||||||
|
// Event callback function.
|
||||||
void _wxEvent_OnPaint(wxPaintEvent &event) {OnPaint();event.Skip();}
|
void _wxEvent_OnPaint(wxPaintEvent &event) {OnPaint();event.Skip();}
|
||||||
|
|
||||||
|
public:
|
||||||
public: // Constructor/Destructor
|
// Constructor/Destructor
|
||||||
wxDotLCD(wxWindow *pclsParent, wxWindowID iWinID = wxID_ANY, const wxPoint& clsPosition = wxDefaultPosition);
|
wxPixelatedPanel(wxWindow *pclsParent, wxWindowID iWinID = wxID_ANY, const wxPoint& clsPosition = wxDefaultPosition);
|
||||||
~wxDotLCD();
|
~wxPixelatedPanel();
|
||||||
|
// Public interface
|
||||||
public: // Public interface
|
void SetPixelNumber(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber);
|
||||||
void SetDisplaySizes(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber);
|
void GetPixelNumber(uint32_t* puiHorizontalPixelNumber, uint32_t* puiVerticalPixelNumber);
|
||||||
void GetDisplaySize(uint32_t* puiHorizontalPixelNumber, uint32_t* puiVerticalPixelNumber);
|
void SetColors(const wxColor& clsEdgeColor, const wxColor& clsBaseColor, const wxColor& clsGridColor);
|
||||||
void SetDisplayColors(const wxColor& clsEdgeColor, const wxColor& clsBaseColor, const wxColor& clsGridColor);
|
|
||||||
void SetEdgeWidth(uint32_t uiEdgeWidth);
|
void SetEdgeWidth(uint32_t uiEdgeWidth);
|
||||||
uint32_t GetEdgeWidth(void) {return m_uiEdgeWidth;}
|
uint32_t GetEdgeWidth(void) {return m_uiEdgeWidth;}
|
||||||
void SetPixelSize(uint32_t uiPixelSize);
|
void SetPixelSize(uint32_t uiPixelSize);
|
||||||
uint32_t GetPixelSize(void) {return m_uiPixelSize;}
|
uint32_t GetPixelSize(void) {return m_uiPixelSize;}
|
||||||
void SetGridVisibled(bool bGridVisible);
|
void SetGridVisibled(bool bGridVisible);
|
||||||
bool GetGridVisibled(void) {return m_bGridVisible;}
|
bool GetGridVisibled(void) {return m_bGridVisible;}
|
||||||
void SetDisplayAreaSize( uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber);
|
|
||||||
void SetEdgeColor(const wxColor& clsColor);
|
void SetEdgeColor(const wxColor& clsColor);
|
||||||
wxColor& GetEdgeColor(void);
|
wxColor& GetEdgeColor(void);
|
||||||
void SetBaseColor(const wxColor& clsColor);
|
void SetBaseColor(const wxColor& clsColor);
|
||||||
@ -59,7 +57,7 @@ public: // Public interface
|
|||||||
void SetGridColor(const wxColor& clsColor);
|
void SetGridColor(const wxColor& clsColor);
|
||||||
wxColor& GetGridColor(void);
|
wxColor& GetGridColor(void);
|
||||||
void OnPaint(void);
|
void OnPaint(void);
|
||||||
void SetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor, bool bRefreshNow = false);
|
void SetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY, const wxColor& clsColor, bool bRefreshNow = false);
|
||||||
void DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor);
|
void DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor);
|
||||||
uint32_t GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY);
|
uint32_t GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY);
|
||||||
void RefreshDisplay(void);
|
void RefreshDisplay(void);
|
||||||
@ -69,14 +67,16 @@ public: // Public interface
|
|||||||
void ResizeParent(void);
|
void ResizeParent(void);
|
||||||
|
|
||||||
private: // Private process function.
|
private: // Private process function.
|
||||||
inline void DrawPointSinglePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
inline void _drawPointSinglePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
||||||
inline void DrawPointMultiplePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
inline void _drawPointMultiplePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
||||||
inline void DrawPointMultiplePixelWithGrid(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
inline void _drawPointMultiplePixelWithGrid(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize);
|
||||||
inline void ReleaseDC(wxMemoryDC& clsCDCObject) {clsCDCObject.SetBrush(wxNullBrush); clsCDCObject.SetPen(wxNullPen);}
|
inline void _releaseDC(wxMemoryDC& clsCDCObject) {clsCDCObject.SetBrush(wxNullBrush); clsCDCObject.SetPen(wxNullPen);}
|
||||||
inline void PrepareDC(wxMemoryDC& clsCDCObject) {clsCDCObject.SetBrush(m_clsBrush); clsCDCObject.SetPen(m_clsPen);}
|
inline void _prepareDC(wxMemoryDC& clsCDCObject) {clsCDCObject.SetBrush(m_clsBrush); clsCDCObject.SetPen(m_clsPen);}
|
||||||
inline void ReleaseDC(wxClientDC& clsCDCObject) {clsCDCObject.SetBrush(wxNullBrush); clsCDCObject.SetPen(wxNullPen);}
|
inline void _releaseDC(wxClientDC& clsCDCObject) {clsCDCObject.SetBrush(wxNullBrush); clsCDCObject.SetPen(wxNullPen);}
|
||||||
inline void PrepareDC(wxClientDC& clsCDCObject) {clsCDCObject.SetBrush(m_clsBrush); clsCDCObject.SetPen(m_clsPen);}
|
inline void _prepareDC(wxClientDC& clsCDCObject) {clsCDCObject.SetBrush(m_clsBrush); clsCDCObject.SetPen(m_clsPen);}
|
||||||
inline void SetDCColor(const wxColor& clsColour) {m_clsPen.SetColour(clsColour);m_clsBrush.SetColour(clsColour);}
|
inline void _setDCColor(const wxColor& clsColour) {m_clsPen.SetColour(clsColour);m_clsBrush.SetColour(clsColour);}
|
||||||
|
inline void _freeDisplayBuffer(uint32_t** ppuiDisplayBuffer);
|
||||||
|
inline uint32_t** _createNewDisplayBuffer(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
@ -2,23 +2,23 @@
|
|||||||
//= Include files. =//
|
//= Include files. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
#include "wxDotLCD.h"
|
#include "wxPixelatedPanel.h"
|
||||||
|
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
//= Event table. =//
|
//= Event table. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
BEGIN_EVENT_TABLE(wxDotLCD,wxPanel)
|
BEGIN_EVENT_TABLE(wxPixelatedPanel,wxPanel)
|
||||||
EVT_PAINT (wxDotLCD::_wxEvent_OnPaint)
|
EVT_PAINT (wxPixelatedPanel::_wxEvent_OnPaint)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
//= Function define. =//
|
//= Function define. =//
|
||||||
//=======================================================================//
|
//=======================================================================//
|
||||||
wxDotLCD::wxDotLCD(wxWindow *pclsParent, wxWindowID iWinID, const wxPoint& clsPosition):
|
wxPixelatedPanel::wxPixelatedPanel(wxWindow *pclsParent, wxWindowID iWinID, const wxPoint& clsPosition):
|
||||||
wxPanel(pclsParent, iWinID, clsPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxPanelNameStr),
|
wxPanel(pclsParent, iWinID, clsPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxPanelNameStr),
|
||||||
m_clsCDC(this)
|
m_clsCDC(this)
|
||||||
{
|
{
|
||||||
m_parrDisplayBuffer = NULL;
|
m_ppuiDisplayBuffer = NULL;
|
||||||
m_pfDrawPoint = NULL;
|
m_pfDrawPoint = NULL;
|
||||||
|
|
||||||
m_uiHorizontalPixelNumber = 0;
|
m_uiHorizontalPixelNumber = 0;
|
||||||
@ -32,51 +32,54 @@ m_clsCDC(this)
|
|||||||
m_pclsGridColor = new wxColor(0x80, 0x80, 0x80, 0x00);
|
m_pclsGridColor = new wxColor(0x80, 0x80, 0x80, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDotLCD::~wxDotLCD()
|
wxPixelatedPanel::~wxPixelatedPanel()
|
||||||
{
|
{
|
||||||
if(NULL != m_parrDisplayBuffer)
|
_freeDisplayBuffer(m_ppuiDisplayBuffer);
|
||||||
{
|
|
||||||
free(m_parrDisplayBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete m_pclsEdgeColor;
|
delete m_pclsEdgeColor;
|
||||||
delete m_pclsBaseColor;
|
delete m_pclsBaseColor;
|
||||||
delete m_pclsGridColor;
|
delete m_pclsGridColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetDisplaySizes(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber)
|
void wxPixelatedPanel::SetPixelNumber(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber)
|
||||||
{
|
{
|
||||||
|
/*----------------------------------*/
|
||||||
|
/* Variable Declaration */
|
||||||
|
/*----------------------------------*/
|
||||||
|
uint32_t** ppuiNewDisplayBuffer;
|
||||||
|
uint32_t uiCopiedRowNumber;
|
||||||
|
uint32_t uiCopiedColumnNumber;
|
||||||
|
|
||||||
|
/*----------------------------------*/
|
||||||
|
/* Initialize */
|
||||||
|
/*----------------------------------*/
|
||||||
|
ppuiNewDisplayBuffer = NULL;
|
||||||
|
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
// Free current buffer.
|
|
||||||
if(NULL != m_parrDisplayBuffer)
|
|
||||||
{
|
|
||||||
free(m_parrDisplayBuffer);
|
|
||||||
}
|
|
||||||
if((uiHorizontalPixelNumber > 0) && (uiVerticalPixelNumber > 0))
|
if((uiHorizontalPixelNumber > 0) && (uiVerticalPixelNumber > 0))
|
||||||
{
|
{
|
||||||
uint32_t uiDisplayBufferSize;
|
// Create a new display buffer
|
||||||
// Recalculate buffer size.
|
ppuiNewDisplayBuffer = _createNewDisplayBuffer(uiHorizontalPixelNumber, uiVerticalPixelNumber);
|
||||||
m_uiHorizontalPixelNumber = uiHorizontalPixelNumber;
|
if(NULL != ppuiNewDisplayBuffer)
|
||||||
m_uiVerticalPixelNumber = uiVerticalPixelNumber;
|
{
|
||||||
uiDisplayBufferSize = m_uiHorizontalPixelNumber*m_uiVerticalPixelNumber;
|
uiCopiedRowNumber = m_uiVerticalPixelNumber<uiVerticalPixelNumber?m_uiVerticalPixelNumber:uiVerticalPixelNumber;
|
||||||
// Reallocate display buffer;
|
uiCopiedColumnNumber = m_uiHorizontalPixelNumber<uiHorizontalPixelNumber?m_uiHorizontalPixelNumber:uiHorizontalPixelNumber;
|
||||||
m_parrDisplayBuffer = (uint32_t*)malloc(uiDisplayBufferSize*sizeof(uint32_t));
|
// Copy old buffer content to new buffer;
|
||||||
if(NULL != m_parrDisplayBuffer)
|
for(uint32_t uiIdxV=0; uiIdxV<uiCopiedRowNumber; uiIdxV++)
|
||||||
{
|
{
|
||||||
// Clear memory.
|
memcpy(*(ppuiNewDisplayBuffer+uiIdxV), *(m_ppuiDisplayBuffer+uiIdxV), sizeof(uint32_t)*uiCopiedColumnNumber);
|
||||||
memset(m_parrDisplayBuffer, 0x00, uiDisplayBufferSize);
|
}
|
||||||
}
|
// Free current buffer.
|
||||||
}
|
_freeDisplayBuffer(m_ppuiDisplayBuffer);
|
||||||
else
|
m_ppuiDisplayBuffer = ppuiNewDisplayBuffer;
|
||||||
{
|
m_uiHorizontalPixelNumber = uiHorizontalPixelNumber;
|
||||||
m_uiHorizontalPixelNumber = 0;
|
m_uiVerticalPixelNumber = uiVerticalPixelNumber;
|
||||||
m_uiVerticalPixelNumber = 0;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::GetDisplaySize(uint32_t* puiHorizontalPixelNumber, uint32_t* puiVerticalPixelNumber)
|
void wxPixelatedPanel::GetPixelNumber(uint32_t* puiHorizontalPixelNumber, uint32_t* puiVerticalPixelNumber)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -92,7 +95,7 @@ void wxDotLCD::GetDisplaySize(uint32_t* puiHorizontalPixelNumber, uint32_t* puiV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetDisplayColors(const wxColor& clsEdgeColor, const wxColor& clsBaseColor, const wxColor& clsGridColor)
|
void wxPixelatedPanel::SetColors(const wxColor& clsEdgeColor, const wxColor& clsBaseColor, const wxColor& clsGridColor)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -111,16 +114,7 @@ void wxDotLCD::SetDisplayColors(const wxColor& clsEdgeColor, const wxColor& clsB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetDisplayAreaSize( uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber)
|
void wxPixelatedPanel::SetEdgeWidth(uint32_t uiEdgeWidth)
|
||||||
{
|
|
||||||
/*----------------------------------*/
|
|
||||||
/* Process */
|
|
||||||
/*----------------------------------*/
|
|
||||||
m_uiHorizontalPixelNumber = uiHorizontalPixelNumber;
|
|
||||||
m_uiVerticalPixelNumber = uiVerticalPixelNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDotLCD::SetEdgeWidth(uint32_t uiEdgeWidth)
|
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -128,7 +122,7 @@ void wxDotLCD::SetEdgeWidth(uint32_t uiEdgeWidth)
|
|||||||
m_uiEdgeWidth = uiEdgeWidth;
|
m_uiEdgeWidth = uiEdgeWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetPixelSize(uint32_t uiPixelSize)
|
void wxPixelatedPanel::SetPixelSize(uint32_t uiPixelSize)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -147,27 +141,27 @@ void wxDotLCD::SetPixelSize(uint32_t uiPixelSize)
|
|||||||
else if(1 == m_uiPixelSize)
|
else if(1 == m_uiPixelSize)
|
||||||
// If pixel size is 1, the pixel drawing function will set to draw pixel unit by point.
|
// If pixel size is 1, the pixel drawing function will set to draw pixel unit by point.
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointSinglePixel;
|
m_pfDrawPoint = &_drawPointSinglePixel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointMultiplePixel;
|
m_pfDrawPoint = &_drawPointMultiplePixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(true == m_bGridVisible)
|
if(true == m_bGridVisible)
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointMultiplePixelWithGrid;
|
m_pfDrawPoint = &_drawPointMultiplePixelWithGrid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointMultiplePixel;
|
m_pfDrawPoint = &_drawPointMultiplePixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetGridVisibled(bool bGridVisible)
|
void wxPixelatedPanel::SetGridVisibled(bool bGridVisible)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -179,83 +173,76 @@ void wxDotLCD::SetGridVisibled(bool bGridVisible)
|
|||||||
{
|
{
|
||||||
if(true == m_bGridVisible)
|
if(true == m_bGridVisible)
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointMultiplePixelWithGrid;
|
m_pfDrawPoint = &_drawPointMultiplePixelWithGrid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pfDrawPoint = &DrawPointMultiplePixel;
|
m_pfDrawPoint = &_drawPointMultiplePixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::CleanPanel(void)
|
void wxPixelatedPanel::CleanPanel(void)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
|
||||||
/* Variable Declaration */
|
|
||||||
/*----------------------------------*/
|
|
||||||
uint32_t uiDisplayBufferSize;
|
|
||||||
|
|
||||||
/*----------------------------------*/
|
|
||||||
/* Initialize */
|
|
||||||
/*----------------------------------*/
|
|
||||||
uiDisplayBufferSize = m_uiHorizontalPixelNumber*m_uiVerticalPixelNumber;
|
|
||||||
|
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
memset(m_parrDisplayBuffer, 0x00, sizeof(uint32_t)*uiDisplayBufferSize);
|
for(uint32_t uiIdxV=0; uiIdxV<m_uiVerticalPixelNumber; uiIdxV++)
|
||||||
|
{
|
||||||
|
memset(*(m_ppuiDisplayBuffer+uiIdxV), 0x00, sizeof(uint32_t)*m_uiHorizontalPixelNumber);
|
||||||
|
}
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetEdgeColor(const wxColor& clsColor)
|
void wxPixelatedPanel::SetEdgeColor(const wxColor& clsColor)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if(NULL != m_pclsEdgeColor)
|
if(NULL != m_pclsEdgeColor)
|
||||||
{
|
{
|
||||||
m_pclsEdgeColor->SetRGB(clsColor.GetRGB());
|
*m_pclsEdgeColor = clsColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColor& wxDotLCD::GetEdgeColor(void)
|
wxColor& wxPixelatedPanel::GetEdgeColor(void)
|
||||||
{
|
{
|
||||||
return *m_pclsEdgeColor;
|
return *m_pclsEdgeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetBaseColor(const wxColor& clsColor)
|
void wxPixelatedPanel::SetBaseColor(const wxColor& clsColor)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if(NULL != m_pclsBaseColor)
|
if(NULL != m_pclsBaseColor)
|
||||||
{
|
{
|
||||||
m_pclsBaseColor->SetRGB(clsColor.GetRGB());
|
*m_pclsBaseColor = clsColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColor& wxDotLCD::GetBaseColor(void)
|
wxColor& wxPixelatedPanel::GetBaseColor(void)
|
||||||
{
|
{
|
||||||
return *m_pclsBaseColor;
|
return *m_pclsBaseColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::SetGridColor(const wxColor& clsColor)
|
void wxPixelatedPanel::SetGridColor(const wxColor& clsColor)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if(NULL != m_pclsGridColor)
|
if(NULL != m_pclsGridColor)
|
||||||
{
|
{
|
||||||
m_pclsGridColor->SetRGB(clsColor.GetRGB());
|
*m_pclsGridColor = clsColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColor& wxDotLCD::GetGridColor(void)
|
wxColor& wxPixelatedPanel::GetGridColor(void)
|
||||||
{
|
{
|
||||||
return *m_pclsGridColor;
|
return *m_pclsGridColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::OnPaint(void)
|
void wxPixelatedPanel::OnPaint(void)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -264,7 +251,7 @@ void wxDotLCD::OnPaint(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxDotLCD::DrawPointSinglePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
void wxPixelatedPanel::_drawPointSinglePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -272,7 +259,7 @@ void wxDotLCD::DrawPointSinglePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, u
|
|||||||
clsCDCObject.DrawPoint(wxPoint(m_uiEdgeWidth+uiPosX, m_uiEdgeWidth+uiPosY));
|
clsCDCObject.DrawPoint(wxPoint(m_uiEdgeWidth+uiPosX, m_uiEdgeWidth+uiPosY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::DrawPointMultiplePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
void wxPixelatedPanel::_drawPointMultiplePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -280,7 +267,7 @@ void wxDotLCD::DrawPointMultiplePixel(wxMemoryDC& clsCDCObject, uint32_t uiPosX,
|
|||||||
clsCDCObject.DrawRectangle(wxPoint(m_uiEdgeWidth+uiPosX*uiPixelSize, m_uiEdgeWidth+uiPosY*uiPixelSize), wxSize(uiPixelSize, uiPixelSize));
|
clsCDCObject.DrawRectangle(wxPoint(m_uiEdgeWidth+uiPosX*uiPixelSize, m_uiEdgeWidth+uiPosY*uiPixelSize), wxSize(uiPixelSize, uiPixelSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDotLCD::DrawPointMultiplePixelWithGrid(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
void wxPixelatedPanel::_drawPointMultiplePixelWithGrid(wxMemoryDC& clsCDCObject, uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelSize)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
@ -304,16 +291,16 @@ void wxDotLCD::DrawPointMultiplePixelWithGrid(wxMemoryDC& clsCDCObject, uint32_t
|
|||||||
/** only one pixel, please use the DrawPixel function **/
|
/** only one pixel, please use the DrawPixel function **/
|
||||||
/** directly. **/
|
/** directly. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void wxDotLCD::SetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor, bool bRefreshNow)
|
void wxPixelatedPanel::SetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY, const wxColor& clsColor, bool bRefreshNow)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if((uiPosX < m_uiHorizontalPixelNumber) && (uiPosY < m_uiVerticalPixelNumber))
|
if((uiPosX < m_uiHorizontalPixelNumber) && (uiPosY < m_uiVerticalPixelNumber))
|
||||||
{
|
{
|
||||||
if(NULL != m_parrDisplayBuffer)
|
if(NULL != m_ppuiDisplayBuffer)
|
||||||
{
|
{
|
||||||
*(m_parrDisplayBuffer+uiPosX+(uiPosY*m_uiHorizontalPixelNumber)) = clsColor.GetRGBA();
|
*(*(m_ppuiDisplayBuffer+uiPosY)+uiPosX) = clsColor.GetRGBA();
|
||||||
}
|
}
|
||||||
if(true == bRefreshNow)
|
if(true == bRefreshNow)
|
||||||
{
|
{
|
||||||
@ -331,7 +318,7 @@ void wxDotLCD::SetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsC
|
|||||||
/** Return: RGBA color value of the pixel unit. **/
|
/** Return: RGBA color value of the pixel unit. **/
|
||||||
/** Notice: None. **/
|
/** Notice: None. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
uint32_t wxDotLCD::GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY)
|
uint32_t wxPixelatedPanel::GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Variable Declaration */
|
/* Variable Declaration */
|
||||||
@ -343,9 +330,9 @@ uint32_t wxDotLCD::GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY)
|
|||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if((uiPosX < m_uiHorizontalPixelNumber) && (uiPosY < m_uiVerticalPixelNumber))
|
if((uiPosX < m_uiHorizontalPixelNumber) && (uiPosY < m_uiVerticalPixelNumber))
|
||||||
{
|
{
|
||||||
if(NULL != m_parrDisplayBuffer)
|
if(NULL != m_ppuiDisplayBuffer)
|
||||||
{
|
{
|
||||||
uiReturnValue = *(m_parrDisplayBuffer+uiPosX+(uiPosY*m_uiHorizontalPixelNumber));
|
uiReturnValue = *(*(m_ppuiDisplayBuffer+uiPosY)+uiPosX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,15 +349,15 @@ uint32_t wxDotLCD::GetPixelUnitColor(uint32_t uiPosX, uint32_t uiPosY)
|
|||||||
/** Return: None. **/
|
/** Return: None. **/
|
||||||
/** Notice: Draw only one pixel directly. **/
|
/** Notice: Draw only one pixel directly. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void wxDotLCD::DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor)
|
void wxPixelatedPanel::DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Process */
|
/* Process */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
if(m_uiPixelSize != 0)
|
if((uiPosX < m_uiHorizontalPixelNumber) && (uiPosY < m_uiVerticalPixelNumber) && (m_uiPixelSize != 0))
|
||||||
{
|
{
|
||||||
SetDCColor(clsColor);
|
_setDCColor(clsColor);
|
||||||
PrepareDC(m_clsCDC);
|
_prepareDC(m_clsCDC);
|
||||||
if(m_uiPixelSize == 1)
|
if(m_uiPixelSize == 1)
|
||||||
{
|
{
|
||||||
m_clsCDC.DrawPoint(wxPoint(m_uiEdgeWidth+uiPosX, m_uiEdgeWidth+uiPosY));
|
m_clsCDC.DrawPoint(wxPoint(m_uiEdgeWidth+uiPosX, m_uiEdgeWidth+uiPosY));
|
||||||
@ -387,14 +374,13 @@ void wxDotLCD::DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetPixelUnitColor(uiPosX, uiPosY, clsColor);
|
SetPixelUnitColor(uiPosX, uiPosY, clsColor);
|
||||||
ReleaseDC(m_clsCDC);
|
_releaseDC(m_clsCDC);
|
||||||
|
|
||||||
|
if(NULL != m_ppuiDisplayBuffer)
|
||||||
|
{
|
||||||
|
*(*(m_ppuiDisplayBuffer+uiPosY)+uiPosX) = clsColor.GetRGBA();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(NULL != m_parrDisplayBuffer)
|
|
||||||
{
|
|
||||||
*(m_parrDisplayBuffer+uiPosX+(uiPosY*m_uiHorizontalPixelNumber)) = clsColor.GetRGBA();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
@ -406,7 +392,7 @@ void wxDotLCD::DrawPixel(uint32_t uiPosX, uint32_t uiPosY, wxColor& clsColor)
|
|||||||
/** all pixels of the LCD panel will be repaint by the **/
|
/** all pixels of the LCD panel will be repaint by the **/
|
||||||
/** pixels's RGBA value register array. **/
|
/** pixels's RGBA value register array. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void wxDotLCD::RefreshDisplay(void)
|
void wxPixelatedPanel::RefreshDisplay(void)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Variable Declaration */
|
/* Variable Declaration */
|
||||||
@ -430,15 +416,15 @@ void wxDotLCD::RefreshDisplay(void)
|
|||||||
wxBufferedDC clsBufferedDC(&m_clsCDC, clsBufferImage);
|
wxBufferedDC clsBufferedDC(&m_clsCDC, clsBufferImage);
|
||||||
|
|
||||||
// Draw background.
|
// Draw background.
|
||||||
SetDCColor(*m_pclsEdgeColor);
|
_setDCColor(*m_pclsEdgeColor);
|
||||||
PrepareDC(clsBufferedDC);
|
_prepareDC(clsBufferedDC);
|
||||||
clsBufferedDC.DrawRectangle(wxPoint(0, 0),wxSize(uiPaintSizeWidth, uiPaintSizeHeight));
|
clsBufferedDC.DrawRectangle(wxPoint(0, 0),wxSize(uiPaintSizeWidth, uiPaintSizeHeight));
|
||||||
|
|
||||||
// Draw grid line.
|
// Draw grid line.
|
||||||
if((true == m_bGridVisible) && (2 < m_uiPixelSize))
|
if((true == m_bGridVisible) && (2 < m_uiPixelSize))
|
||||||
{
|
{
|
||||||
SetDCColor(*m_pclsGridColor);
|
_setDCColor(*m_pclsGridColor);
|
||||||
PrepareDC(clsBufferedDC);
|
_prepareDC(clsBufferedDC);
|
||||||
clsBufferedDC.DrawRectangle(wxPoint(m_uiEdgeWidth, m_uiEdgeWidth),
|
clsBufferedDC.DrawRectangle(wxPoint(m_uiEdgeWidth, m_uiEdgeWidth),
|
||||||
wxSize( m_uiHorizontalPixelNumber*m_uiPixelSize+1,
|
wxSize( m_uiHorizontalPixelNumber*m_uiPixelSize+1,
|
||||||
m_uiVerticalPixelNumber*m_uiPixelSize+1));
|
m_uiVerticalPixelNumber*m_uiPixelSize+1));
|
||||||
@ -451,8 +437,8 @@ void wxDotLCD::RefreshDisplay(void)
|
|||||||
{
|
{
|
||||||
for(uint32_t i_W=0; i_W<m_uiHorizontalPixelNumber; i_W++)
|
for(uint32_t i_W=0; i_W<m_uiHorizontalPixelNumber; i_W++)
|
||||||
{
|
{
|
||||||
SetDCColor(wxColor(*(m_parrDisplayBuffer+(i_W+i_H*m_uiHorizontalPixelNumber))));
|
_setDCColor(wxColor(*(*(m_ppuiDisplayBuffer+i_H)+i_W)));
|
||||||
PrepareDC(clsBufferedDC);
|
_prepareDC(clsBufferedDC);
|
||||||
(this->*m_pfDrawPoint)(clsBufferedDC, i_W, i_H, m_uiPixelSize);
|
(this->*m_pfDrawPoint)(clsBufferedDC, i_W, i_H, m_uiPixelSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,7 +454,7 @@ void wxDotLCD::RefreshDisplay(void)
|
|||||||
/** all pixels of the LCD panel will be repaint by the **/
|
/** all pixels of the LCD panel will be repaint by the **/
|
||||||
/** pixels's RGBA value register array. **/
|
/** pixels's RGBA value register array. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void wxDotLCD::ResizeParent(void)
|
void wxPixelatedPanel::ResizeParent(void)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Variable Declaration */
|
/* Variable Declaration */
|
||||||
@ -508,7 +494,7 @@ void wxDotLCD::ResizeParent(void)
|
|||||||
/** the wxApp Object. **/
|
/** the wxApp Object. **/
|
||||||
/** wxImage::AddHandler(new wxJPEGHandler) **/
|
/** wxImage::AddHandler(new wxJPEGHandler) **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
bool wxDotLCD::SaveScreenImageToFile(const wxString& strFilePath)
|
bool wxPixelatedPanel::SaveScreenImageToFile(const wxString& strFilePath)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Variable Declaration */
|
/* Variable Declaration */
|
||||||
@ -555,7 +541,7 @@ bool wxDotLCD::SaveScreenImageToFile(const wxString& strFilePath)
|
|||||||
/** @ false: Copy failed. **/
|
/** @ false: Copy failed. **/
|
||||||
/** Notice: None. **/
|
/** Notice: None. **/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
bool wxDotLCD::CopyScreenImageToClipBoard(void)
|
bool wxPixelatedPanel::CopyScreenImageToClipBoard(void)
|
||||||
{
|
{
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* Variable Declaration */
|
/* Variable Declaration */
|
||||||
@ -597,3 +583,58 @@ bool wxDotLCD::CopyScreenImageToClipBoard(void)
|
|||||||
return bReturn;
|
return bReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPixelatedPanel::_freeDisplayBuffer(uint32_t** ppuiDisplayBuffer)
|
||||||
|
{
|
||||||
|
if(NULL != ppuiDisplayBuffer)
|
||||||
|
{
|
||||||
|
for(uint32_t uiIdxV=0; uiIdxV<m_uiVerticalPixelNumber; uiIdxV++)
|
||||||
|
{
|
||||||
|
free(*(ppuiDisplayBuffer+uiIdxV));
|
||||||
|
}
|
||||||
|
free(ppuiDisplayBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t** wxPixelatedPanel::_createNewDisplayBuffer(uint32_t uiHorizontalPixelNumber, uint32_t uiVerticalPixelNumber)
|
||||||
|
{
|
||||||
|
/*----------------------------------*/
|
||||||
|
/* Variable Declaration */
|
||||||
|
/*----------------------------------*/
|
||||||
|
uint32_t** ppuiNewDisplayBuffer;
|
||||||
|
uint32_t* puiNewHorizontalPixelBuffer;
|
||||||
|
|
||||||
|
/*----------------------------------*/
|
||||||
|
/* Initialize */
|
||||||
|
/*----------------------------------*/
|
||||||
|
ppuiNewDisplayBuffer = NULL;
|
||||||
|
|
||||||
|
/*----------------------------------*/
|
||||||
|
/* Process */
|
||||||
|
/*----------------------------------*/
|
||||||
|
|
||||||
|
if((uiHorizontalPixelNumber > 0) && (uiVerticalPixelNumber > 0))
|
||||||
|
{
|
||||||
|
ppuiNewDisplayBuffer = (uint32_t**)malloc(sizeof(uint32_t*)*uiVerticalPixelNumber);
|
||||||
|
if(NULL != ppuiNewDisplayBuffer)
|
||||||
|
{
|
||||||
|
memset(ppuiNewDisplayBuffer, 0x00, sizeof(uint32_t*)*uiVerticalPixelNumber);
|
||||||
|
for(uint32_t uiIdxV=0; uiIdxV<uiVerticalPixelNumber; uiIdxV++)
|
||||||
|
{
|
||||||
|
puiNewHorizontalPixelBuffer = (uint32_t*)malloc(sizeof(uint32_t)*uiHorizontalPixelNumber);
|
||||||
|
if(NULL != puiNewHorizontalPixelBuffer)
|
||||||
|
{
|
||||||
|
memset(puiNewHorizontalPixelBuffer, 0x00, sizeof(uint32_t)*uiHorizontalPixelNumber);
|
||||||
|
*(ppuiNewDisplayBuffer+uiIdxV) = puiNewHorizontalPixelBuffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_freeDisplayBuffer(ppuiNewDisplayBuffer);
|
||||||
|
ppuiNewDisplayBuffer = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ppuiNewDisplayBuffer;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user