35void ChartPrintout::DrawPage(wxDC* dc,
int page) {
38 gFrame->GetFocusCanvas()->GetClientSize(&sx, &sy);
48 max_x += (2 * margin_x);
49 max_y += (2 * margin_y);
56 float scale_x = (float)(w / max_x);
57 float scale_y = (float)(h / max_y);
60 float actual_scale = wxMin(scale_x, scale_y);
63 float pos_x = (float)((w - (max_x * actual_scale)) / 2.0);
64 float pos_y = (float)((h - (max_y * actual_scale)) / 2.0);
66 pos_x = wxMax(pos_x, margin_x);
67 pos_y = wxMax(pos_y, margin_y);
70 dc->SetUserScale(actual_scale, actual_scale);
71 dc->SetDeviceOrigin((
long)pos_x, (
long)pos_y);
77 if (m_gl_bmp.IsOk()) {
79 mdc.SelectObject(m_gl_bmp);
80 dc->Blit(0, 0, m_gl_bmp.GetWidth(), m_gl_bmp.GetHeight(), &mdc, 0, 0);
81 mdc.SelectObject(wxNullBitmap);
87 mdc.SelectObject(*(gFrame->GetFocusCanvas()->pscratch_bm));
89 dc->Blit(0, 0, gFrame->GetFocusCanvas()->pscratch_bm->GetWidth(),
90 gFrame->GetFocusCanvas()->pscratch_bm->GetHeight(), &mdc, 0, 0);
92 mdc.SelectObject(wxNullBitmap);
99 int gsx = gFrame->GetFocusCanvas()->GetglCanvas()->GetSize().x;
100 int gsy = gFrame->GetFocusCanvas()->GetglCanvas()->GetSize().y;
102 unsigned char* buffer = (
unsigned char*)malloc(gsx * gsy * 4);
103 glReadPixels(0, 0, gsx, gsy, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
105 unsigned char* e = (
unsigned char*)malloc(gsx * gsy * 3);
108 for (
int p = 0; p < gsx * gsy; p++) {
109 e[3 * p + 0] = buffer[4 * p + 0];
110 e[3 * p + 1] = buffer[4 * p + 1];
111 e[3 * p + 2] = buffer[4 * p + 2];
116 wxImage image(gsx, gsy);
118 wxImage mir_imag = image.Mirror(
false);
119 m_gl_bmp = wxBitmap(mir_imag);
Generic Chart canvas base.
void GenerateGLbmp()
In OpenGL mode, make the bitmap capture of the screen before the print method starts as to be sure th...
Global variables stored in configuration file.
OpenGL chart rendering canvas.
Print chart canvas mix-in.