39 #if defined(__WXMSW__)
44 #elif defined(__WXGTK__)
49 #elif defined(__WXMAC__)
51 #include <OpenGL/gl.h>
52 #include <OpenGL/glu.h>
55 #ifdef CN3D_PNG_OSMESA
56 #include <GL/osmesa.h>
64 #include <wx/platform.h>
79 #include <wx/statline.h>
80 #include <wx/spinbutt.h>
81 #include <wx/spinctrl.h>
82 #include <wx/splitter.h>
83 #include <wx/listctrl.h>
84 #include <wx/treectrl.h>
85 #include <wx/notebook.h>
91 #define ID_B_BROWSE 10001
92 #define ID_T_NAME 10002
93 #define ID_T_WIDTH 10003
94 #define ID_T_HEIGHT 10004
95 #define ID_C_ASPECT 10005
96 #define ID_C_INTERLACE 10006
98 #define ID_B_CANCEL 10008
104 #if defined(_AIX43) && defined(jmpbuf)
122 bool Activate(
int initialWidth,
int initialHeight,
bool initialInterlaced);
123 bool GetValues(wxString *outputFilename,
int *width,
int *height,
bool *interlaced);
130 void OnButton(wxCommandEvent& event);
131 void OnChangeSize(wxCommandEvent& event);
132 void OnCheckbox(wxCommandEvent& event);
133 void OnCloseWindow(wxCloseEvent& event);
135 DECLARE_EVENT_TABLE()
138 #define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type) \
140 var = wxDynamicCast(FindWindow(id), type); \
142 ERRORMSG("Can't find window with id " << id); \
146 #define DECLARE_AND_FIND_WINDOW_RETURN_RESULT_ON_ERR(var, id, type, errResult) \
148 var = wxDynamicCast(FindWindow(id), type); \
150 ERRORMSG("Can't find window with id " << id); \
156 #define GET_AND_IS_VALID_SIZE(textctrl, var) \
157 (textctrl->GetValue().ToDouble(&var) && var >= 1 && fmod(var, 1.0) == 0.0 && var <= kMax_Int)
169 wxDialog(parent, -1, "Export Options", wxPoint(50, 50), wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
170 dontProcessChange(
false)
173 wxPanel *panel =
new wxPanel(
this, -1);
177 topSizer->Fit(panel);
178 SetClientSize(topSizer->GetMinSize());
183 switch (event.GetId()) {
186 wxString filename = wxFileSelector(
187 "Choose a filename for output",
GetUserDir().c_str(),
"",
188 ".png",
"All Files|*.*|PNG files (*.png)|*.png",
189 wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
190 if (filename.size() > 0) tName->SetValue(filename);
220 tWidth->Refresh(
true);
221 tHeight->Refresh(
true);
225 tWidth->SetBackgroundColour(*wxRED);
228 tWidth->SetBackgroundColour(*wxWHITE);
230 tHeight->SetBackgroundColour(*wxRED);
233 tHeight->SetBackgroundColour(*wxWHITE);
237 if (cAspect->GetValue()) {
241 num.Printf(
"%i", (
int) h);
242 tHeight->SetValue(num);
245 num.Printf(
"%i", (
int) w);
246 tWidth->SetValue(num);
253 if (cInterlace->IsEnabled()) {
254 cInterlace->Enable(
false);
255 cInterlace->SetValue(
false);
258 if (!cInterlace->IsEnabled()) {
259 cInterlace->Enable(
true);
260 cInterlace->SetValue(
true);
270 if (cAspect->GetValue()) {
279 num.Printf(
"%i", (
int) h);
280 tHeight->SetValue(num);
301 num.Printf(
"%i", initialWidth);
302 tWidth->SetValue(num);
303 num.Printf(
"%i", initialHeight);
304 tHeight->SetValue(num);
306 cAspect->SetValue(
true);
310 cInterlace->Enable(
false);
311 cInterlace->SetValue(
false);
313 cInterlace->SetValue(initialInterlaced);
316 wxCommandEvent browse(wxEVT_COMMAND_BUTTON_CLICKED,
ID_B_BROWSE);
318 if (tName->GetValue().size() == 0)
return false;
321 return (ShowModal() == wxOK);
331 *outputFilename = tName->GetValue();
337 *interlaced = (cInterlace->IsEnabled() && cInterlace->GetValue());
345 bool ok = dialog.
Activate(*width, *height, *interlaced);
346 if (
ok) dialog.
GetValues(outputFilename, width, height, interlaced);
353 ERRORMSG(
"PNG library error: " << msg);
357 static bool gotAnXError;
358 int X_error_handler(Display *dpy, XErrorEvent *
error)
374 case 1: start = 0; end = 1;
break;
375 case 2: start = 1; end = 2;
break;
376 case 3: start = 2; end = 3;
break;
377 case 4: start = 3; end = 5;
break;
378 case 5: start = 5; end = 7;
break;
379 case 6: start = 7; end = 11;
break;
380 case 7: start = 11; end = 15;
break;
384 ((start / 15) + (((
double) row) / (-
nRows)) * ((end - start) / 15)));
395 const string& outputFilename,
402 #if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)
403 ERRORMSG(
"PNG export not (yet) implemented on this platform");
406 if (!glCanvas || !glCanvas->
renderer) {
407 ERRORMSG(
"ExportPNG() - bad glCanvas parameter");
415 #ifndef CN3D_PNG_OSMESA
416 ERRORMSG(
"cn3d_png_nowin must be compiled with CN3D_PNG_OSMESA");
419 #if !defined(OSMESA_MAJOR_VERSION) || !defined(OSMESA_MINOR_VERSION) || !defined(OSMESA_RGB)
420 ERRORMSG(
"Non-windowed rendering currently requires Mesa");
423 if (glCanvas || !renderer) {
424 ERRORMSG(
"ExportPNG() - bad glCanvas/renderer parameters");
429 bool success =
false, shareDisplayLists =
true;
430 int bufferHeight, bytesPerPixel = 3, nChunks = 1;
433 unsigned char *rowStorage =
NULL;
434 png_structp png_ptr =
NULL;
435 png_infop info_ptr =
NULL;
438 outputWidth = glCanvas->GetClientSize().GetWidth();
439 outputHeight = glCanvas->GetClientSize().GetHeight();
443 filename = outputFilename.c_str();
447 INFOMSG(
"saving PNG file '" << filename.c_str() <<
"'");
457 bufferHeight = outputHeight;
460 nChunks = outputHeight / bufferHeight;
461 if (outputHeight % bufferHeight != 0) ++nChunks;
465 INFOMSG(
"output size: " << outputWidth <<
'x' << outputHeight <<
", interlaced=" << (interlaced ?
"yes" :
"no"));
470 message.Printf(
"Writing PNG file %s (%ix%i)",
471 (wxString(wxFileNameFromPath(filename.c_str()))).c_str(),
472 outputWidth, outputHeight);
477 out = fopen(filename.c_str(),
"wb");
478 if (!
out)
throw "can't open file for writing";
481 #ifdef CN3D_PNG_OSMESA
482 OSMesaContext mesaContext = 0;
483 unsigned char *mesaBuffer =
NULL;
485 if ((mesaContext = OSMesaCreateContext(OSMESA_RGBA,
NULL)) == 0)
486 throw "OSMesaCreateContext failed";
487 mesaBuffer =
new unsigned char[outputWidth * bufferHeight * 4 *
sizeof(GLubyte)];
488 if (OSMesaMakeCurrent(mesaContext, mesaBuffer, GL_UNSIGNED_BYTE, outputWidth, bufferHeight) != GL_TRUE)
489 throw "OSMesaMakeCurrent failed";
490 shareDisplayLists =
false;
491 TRACEMSG(
"Created OSMesa context and made it current");
497 #if defined(__WXMSW__)
499 HGLRC hglrc =
NULL, current_hglrc =
NULL;
500 HGDIOBJ current_hgdiobj =
NULL;
502 PIXELFORMATDESCRIPTOR pfd;
505 current_hglrc = wglGetCurrentContext();
506 current_hdc = wglGetCurrentDC();
509 hbm = CreateCompatibleBitmap(current_hdc, outputWidth, bufferHeight);
510 if (!hbm)
throw "failed to create rendering BITMAP";
511 hdc = CreateCompatibleDC(current_hdc);
512 if (!hdc)
throw "CreateCompatibleDC failed";
513 current_hgdiobj = SelectObject(hdc, hbm);
514 if (!current_hgdiobj)
throw "SelectObject failed";
516 memset(&pfd, 0,
sizeof(PIXELFORMATDESCRIPTOR));
517 pfd.nSize =
sizeof(PIXELFORMATDESCRIPTOR);
519 pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL;
520 pfd.iPixelType = PFD_TYPE_RGBA;
521 pfd.cColorBits = GetDeviceCaps(current_hdc, BITSPIXEL);
522 pfd.iLayerType = PFD_MAIN_PLANE;
523 nPixelFormat = ChoosePixelFormat(hdc, &pfd);
525 ERRORMSG(
"ChoosePixelFormat failed");
526 throw GetLastError();
528 if (!SetPixelFormat(hdc, nPixelFormat, &pfd)) {
530 throw GetLastError();
532 hglrc = wglCreateContext(hdc);
534 ERRORMSG(
"wglCreateContext failed");
535 throw GetLastError();
538 if (!wglShareLists(current_hglrc, hglrc)) {
539 WARNINGMSG(
"wglShareLists failed: " << GetLastError());
540 shareDisplayLists =
false;
542 if (!wglMakeCurrent(hdc, hglrc)) {
544 throw GetLastError();
547 #elif defined(__WXGTK__)
549 int nAttribs, attribs[20];
550 XVisualInfo *visinfo =
NULL;
551 bool localVI =
false;
553 GLXContext currentCtx =
NULL, glCtx =
NULL;
554 GLXPixmap glxPixmap = 0;
555 GLXDrawable currentXdrw = 0;
556 Display *display =
NULL;
557 int (*currentXErrHandler)(Display *, XErrorEvent *) =
NULL;
559 currentCtx = glXGetCurrentContext();
560 currentXdrw = glXGetCurrentDrawable();
561 display = (Display *) wxGetDisplay();
563 currentXErrHandler = XSetErrorHandler(X_error_handler);
568 attribs[nAttribs++] = GLX_USE_GL;
569 attribs[nAttribs++] = GLX_RGBA;
570 attribs[nAttribs++] = GLX_RED_SIZE;
571 glGetIntegerv(GL_RED_BITS, &glSize);
572 attribs[nAttribs++] = glSize;
573 attribs[nAttribs++] = GLX_GREEN_SIZE;
574 attribs[nAttribs++] = glSize;
575 attribs[nAttribs++] = GLX_BLUE_SIZE;
576 attribs[nAttribs++] = glSize;
577 attribs[nAttribs++] = GLX_DEPTH_SIZE;
578 glGetIntegerv(GL_DEPTH_BITS, &glSize);
579 attribs[nAttribs++] = glSize;
580 attribs[nAttribs++] = None;
581 visinfo = glXChooseVisual(display, DefaultScreen(display), attribs);
587 #if wxCHECK_VERSION(2,9,0)
588 visinfo = (XVisualInfo *) glCanvas->GetXVisualInfo();
590 visinfo = (XVisualInfo *) (glCanvas->m_vi);
594 xPixmap = XCreatePixmap(display,
595 RootWindow(display, DefaultScreen(display)),
596 outputWidth, bufferHeight, visinfo->depth);
597 if (!xPixmap)
throw "failed to create Pixmap";
598 glxPixmap = glXCreateGLXPixmap(display, visinfo, xPixmap);
599 if (!glxPixmap)
throw "failed to create GLXPixmap";
600 if (gotAnXError)
throw "Got an X error creating GLXPixmap";
608 shareDisplayLists =
false;
611 glCtx = glXCreateContext(display, visinfo,
NULL,
False);
612 if (!glCtx || !glXMakeCurrent(display, glxPixmap, glCtx))
613 throw "failed to make GLXPixmap rendering context without shared display lists";
615 if (gotAnXError)
throw "Got an X error setting GLX context";
617 #elif defined(__WXMAC__)
618 unsigned char *base =
NULL;
619 GLint attrib[20], glSize;
621 AGLPixelFormat fmt =
NULL;
622 AGLContext
ctx =
NULL, currentCtx;
624 currentCtx = aglGetCurrentContext();
629 base =
new unsigned char[outputWidth * bufferHeight * bytesPerPixel];
630 if (!base)
throw "failed to allocate image buffer";
633 attrib[na++] = AGL_OFFSCREEN;
634 attrib[na++] = AGL_RGBA;
635 glGetIntegerv(GL_RED_BITS, &glSize);
636 attrib[na++] = AGL_RED_SIZE;
637 attrib[na++] = glSize;
638 attrib[na++] = AGL_GREEN_SIZE;
639 attrib[na++] = glSize;
640 attrib[na++] = AGL_BLUE_SIZE;
641 attrib[na++] = glSize;
642 glGetIntegerv(GL_DEPTH_BITS, &glSize);
643 attrib[na++] = AGL_DEPTH_SIZE;
644 attrib[na++] = glSize;
645 attrib[na++] = AGL_NONE;
647 if ((fmt=aglChoosePixelFormat(
NULL, 0, attrib)) ==
NULL)
648 throw "aglChoosePixelFormat failed";
652 shareDisplayLists =
false;
654 throw "aglCreateContext without shared lists failed";
658 if (!aglSetOffScreen(
ctx, outputWidth, bufferHeight, bytesPerPixel * outputWidth, base))
659 throw "aglSetOffScreen failed";
660 if (!aglSetCurrentContext(
ctx))
661 throw "aglSetCurrentContext failed";
668 TRACEMSG(
"interlaced: " << interlaced <<
", nChunks: " << nChunks
669 <<
", buffer height: " << bufferHeight <<
", shared: " << shareDisplayLists);
672 rowStorage =
new unsigned char[outputWidth * bytesPerPixel];
673 if (!rowStorage)
throw "failed to allocate pixel row buffer";
677 if (!png_ptr)
throw "can't create PNG write structure";
678 info_ptr = png_create_info_struct(png_ptr);
679 if (!info_ptr)
throw "can't create PNG info structure";
680 if (setjmp(png_jmpbuf(png_ptr))) {
681 png_destroy_write_struct(&png_ptr, &info_ptr);
682 throw "png error encountered, jump point activated";
684 png_init_io(png_ptr,
out);
691 png_set_IHDR(png_ptr, info_ptr, outputWidth, outputHeight,
692 8, PNG_COLOR_TYPE_RGB,
693 interlaced ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE,
694 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
695 png_write_info(png_ptr, info_ptr);
706 if (!shareDisplayLists || outputHeight != glCanvas->GetClientSize().GetHeight()) {
715 glViewport(0, 0, outputWidth, outputHeight);
723 glPixelStorei(GL_PACK_ALIGNMENT, 1);
734 nRows = -outputHeight;
735 if (png_set_interlace_handling(png_ptr) != 7)
throw "confused by unkown PNG interlace scheme";
736 for (pass = 1; pass <= 7; ++pass) {
737 for (
int i = outputHeight - 1;
i >= 0; --
i) {
738 r = outputHeight -
i - 1;
742 ((pass == 1 || pass == 2) && (
r % 8 == 0)) ||
743 ((pass == 3) && ((
r - 4) % 8 == 0)) ||
744 ((pass == 4) && (
r % 4 == 0)) ||
745 ((pass == 5) && ((
r - 2) % 4 == 0)) ||
746 ((pass == 6) && (
r % 2 == 0)) ||
747 ((pass == 7) && ((
r - 1) % 2 == 0))
749 glReadPixels(0,
i, outputWidth, 1, GL_RGB, GL_UNSIGNED_BYTE, rowStorage);
751 png_write_row(png_ptr, rowStorage);
758 int bufferRow, bufferRowStart;
759 nRows = outputHeight;
760 for (
int chunk = nChunks - 1; chunk >= 0; --chunk) {
764 TRACEMSG(
"drawing chunk #" << (chunk + 1));
765 glViewport(0, -chunk*bufferHeight, outputWidth, outputHeight);
770 if (chunk == nChunks - 1)
771 bufferRowStart = outputHeight - 1 - bufferHeight * (nChunks - 1);
773 bufferRowStart = bufferHeight - 1;
776 for (bufferRow = bufferRowStart; bufferRow >= 0; --bufferRow) {
777 glReadPixels(0, bufferRow, outputWidth, 1, GL_RGB, GL_UNSIGNED_BYTE, rowStorage);
778 png_write_row(png_ptr, rowStorage);
784 png_write_end(png_ptr, info_ptr);
789 if (rowStorage)
delete rowStorage;
792 png_destroy_write_struct(&png_ptr, &info_ptr);
794 png_destroy_write_struct(&png_ptr,
NULL);
797 #ifdef CN3D_PNG_OSMESA
798 if (mesaBuffer)
delete[] mesaBuffer;
799 OSMesaDestroyContext(mesaContext);
809 #if defined(__WXMSW__)
810 if (current_hdc && current_hglrc) wglMakeCurrent(current_hdc, current_hglrc);
811 if (hglrc) wglDeleteContext(hglrc);
812 if (hbm) DeleteObject(hbm);
813 if (hdc) DeleteDC(hdc);
815 #elif defined(__WXGTK__)
818 glXMakeCurrent(display, currentXdrw, currentCtx);
819 glXDestroyContext(display, glCtx);
821 if (glxPixmap) glXDestroyGLXPixmap(display, glxPixmap);
822 if (xPixmap) XFreePixmap(display, xPixmap);
823 if (localVI && visinfo) XFree(visinfo);
824 if (gotAnXError)
WARNINGMSG(
"Got an X error destroying GLXPixmap context");
825 XSetErrorHandler(currentXErrHandler);
827 #elif defined(__WXMAC__)
828 aglSetCurrentContext(currentCtx);
829 if (
ctx) aglDestroyContext(
ctx);
830 if (fmt) aglDestroyPixelFormat(fmt);
831 if (base)
delete[] base;
837 }
catch (
const char *err) {
838 ERRORMSG(
"Error creating PNG: " << err);
839 }
catch (exception& e) {
840 ERRORMSG(
"Uncaught exception while creating PNG: " << e.what());
846 if (outputHeight != glCanvas->GetClientSize().GetHeight()) {
849 if (shareDisplayLists)
852 glCanvas->Refresh(
false);
867 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
869 wxStaticBox *item2 =
new wxStaticBox( parent, -1,
"Output Settings" );
870 wxStaticBoxSizer *item1 =
new wxStaticBoxSizer( item2, wxVERTICAL );
872 wxFlexGridSizer *item3 =
new wxFlexGridSizer( 1, 0, 0, 0 );
873 item3->AddGrowableCol( 1 );
875 wxStaticText *item4 =
new wxStaticText( parent,
ID_TEXT,
"File name:", wxDefaultPosition, wxDefaultSize, 0 );
876 item3->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 );
878 item3->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
880 wxButton *item5 =
new wxButton( parent,
ID_B_BROWSE,
"Browse", wxDefaultPosition, wxDefaultSize, 0 );
881 item3->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
883 item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
885 wxTextCtrl *item6 =
new wxTextCtrl( parent,
ID_T_NAME,
"", wxDefaultPosition, wxDefaultSize, 0 );
886 item1->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
888 wxFlexGridSizer *item7 =
new wxFlexGridSizer( 2, 0, 0, 0 );
889 item7->AddGrowableCol( 1 );
890 item7->AddGrowableRow( 1 );
892 wxStaticText *item8 =
new wxStaticText( parent,
ID_TEXT,
"Width:", wxDefaultPosition, wxDefaultSize, 0 );
893 item7->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
895 item7->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
897 wxStaticText *item9 =
new wxStaticText( parent,
ID_TEXT,
"Height:", wxDefaultPosition, wxDefaultSize, 0 );
898 item7->Add( item9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
900 wxTextCtrl *item10 =
new wxTextCtrl( parent,
ID_T_WIDTH,
"", wxDefaultPosition, wxDefaultSize, 0 );
901 item7->Add( item10, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
903 wxStaticText *item11 =
new wxStaticText( parent,
ID_TEXT,
"x", wxDefaultPosition, wxDefaultSize, 0 );
904 item7->Add( item11, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
906 wxTextCtrl *item12 =
new wxTextCtrl( parent,
ID_T_HEIGHT,
"", wxDefaultPosition, wxDefaultSize, 0 );
907 item7->Add( item12, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
909 item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
911 wxBoxSizer *item13 =
new wxBoxSizer( wxHORIZONTAL );
913 wxCheckBox *item14 =
new wxCheckBox( parent,
ID_C_ASPECT,
"Maintain original aspect ratio", wxDefaultPosition, wxDefaultSize, 0 );
914 item14->SetValue(
TRUE );
915 item13->Add( item14, 0, wxALIGN_CENTRE|wxALL, 5 );
917 item13->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
919 wxCheckBox *item15 =
new wxCheckBox( parent,
ID_C_INTERLACE,
"Interlaced", wxDefaultPosition, wxDefaultSize, 0 );
920 item15->SetValue(
TRUE );
921 item13->Add( item15, 0, wxALIGN_CENTRE|wxALL, 5 );
923 item1->Add( item13, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
925 item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
927 wxBoxSizer *item16 =
new wxBoxSizer( wxHORIZONTAL );
929 wxButton *item17 =
new wxButton( parent,
ID_B_OK,
"OK", wxDefaultPosition, wxDefaultSize, 0 );
930 item17->SetDefault();
931 item16->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 );
933 item16->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
935 wxButton *item18 =
new wxButton( parent,
ID_B_CANCEL,
"Cancel", wxDefaultPosition, wxDefaultSize, 0 );
936 item16->Add( item18, 0, wxALIGN_CENTRE|wxALL, 5 );
938 item0->Add( item16, 0, wxALIGN_CENTRE|wxALL, 5 );
942 parent->SetAutoLayout(
TRUE );
943 parent->SetSizer( item0 );
946 item0->Fit( parent );
947 item0->SetSizeHints( parent );
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
OpenGLRenderer * renderer
void SetGLFontFromRegistry(double fontScale=1.0)
void SuspendRendering(bool suspend)
void PostRedrawAllStructures(void)
void RecreateQuadric(void) const
void RestoreSavedView(void)
void NewView(double eyeTranslateToAngleDegrees=0.0) const
bool HasASNViewSettings(void) const
void ComputeBestView(void)
bool Activate(int initialWidth, int initialHeight, bool initialInterlaced)
void OnCloseWindow(wxCloseEvent &event)
void OnCheckbox(wxCommandEvent &event)
void OnChangeSize(wxCommandEvent &event)
void OnButton(wxCommandEvent &event)
bool GetValues(wxString *outputFilename, int *width, int *height, bool *interlaced)
void SetValue(int value, bool doYield=true)
bool IsWindowedMode(void)
static const int MAX_BUFFER_PIXELS
wxSizer * SetupPNGOptionsDialog(wxPanel *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
#define DECLARE_AND_FIND_WINDOW_RETURN_RESULT_ON_ERR(var, id, type, errResult)
const wxWindowID ButtonID
static bool GetOutputParameters(wxString *outputFilename, int *width, int *height, bool *interlaced)
#define GET_AND_IS_VALID_SIZE(textctrl, var)
bool ExportPNG(Cn3DGLCanvas *glCanvas, OpenGLRenderer *renderer, const string &outputFilename, int outputWidth, int outputHeight, bool interlaced)
static const int PROGRESS_RESOLUTION
static void write_row_callback(png_structp png_ptr, png_uint_32 row, int pass)
static ProgressMeter * progressMeter
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
unsigned int
A callback function used to compare two keys in a database.
Messenger * GlobalMessenger(void)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const char * str(char *buf, int n)
#define Z_BEST_COMPRESSION