本文整理汇总了C++中Mol::GetFilenameSnap方法的典型用法代码示例。如果您正苦于以下问题:C++ Mol::GetFilenameSnap方法的具体用法?C++ Mol::GetFilenameSnap怎么用?C++ Mol::GetFilenameSnap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mol
的用法示例。
在下文中一共展示了Mol::GetFilenameSnap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSaveSnap
void MyFrame::OnSaveSnap (wxCommandEvent & event)
{
int sx,sy;
static const wxString FILETYPES = _T(
"PNG (lossless)|*.png|"
"JPEG (lossy)|*.jpg|"
"GIF animation|*.gif"
);
wxFileDialog * saveSnapDialog =
new wxFileDialog ( this,
wxString (_T("Save a snapshot")),
wxString(), // def path
wxString(),
FILETYPES,
wxSAVE | /*wxCHANGE_DIR |*/ wxOVERWRITE_PROMPT
);
static int lastFilterIndex=-1;
if (lastFilterIndex==-1) lastFilterIndex=saveSnapDialog->GetFilterIndex();
saveSnapDialog->SetFilterIndex( lastFilterIndex );
wxString ext;
if (lastFilterIndex==1) ext=_T(".jpg");
else if (lastFilterIndex==2) ext=_T(".gif");
else ext=_T(".png");
saveSnapDialog->SetFilename( wxString( mol.GetFilenameSnap(), wxConvUTF8 )+ ext );
static wxString CANNOT_SAVE = _T("Could not save snap!\n\nYou might try setting\na lower resolution\nor removing AntiAliasing...");
if (saveSnapDialog->ShowModal() == wxID_OK)
if ((new savesnapDialog(this,saveSnapDialog->GetFilterIndex()))->ShowModal() == wxID_OK )
{
int jj=saveSnapDialog->GetFilterIndex();
lastFilterIndex=jj;
Byte* snap;
int AAMult=(hardSettings.SNAP_ANTIALIAS)?2:1;
bool useTransp=(hardSettings.PNG_TRANSPARENT==1) && (jj==0);
if (jj!=2) {
sx=sy=hardSettings.SNAP_SIZE*AAMult;
if ((useTransp) && (cgSettings.UseHalo()>0)) {
cgSettings.doingAlphaSnapshot=true;
cgSettings.ResetHalo();
cgSettings.UpdateShaders();
}
snap= GetSnapshot(sx,sy, useTransp );
if (cgSettings.doingAlphaSnapshot) {
cgSettings.doingAlphaSnapshot=false;
cgSettings.ResetHalo();
cgSettings.UpdateShaders();
}
if (!snap) {
wxMessageBox(CANNOT_SAVE, _T("OpenGL problems?"), wxOK | wxICON_EXCLAMATION, this);
return;
}
} else sx=sy=hardSettings.GIF_SNAP_SIZE*AAMult;
{
wxString fn=saveSnapDialog->GetPath();
// fix filename Extension
//////////////////////////
//wxString ext[3]={ _T("png"), _T("jpg") , _T("png") };
//wxString cext=fn.AfterLast('.');
//if (cext.CmpNoCase(ext[0])||cext.CmpNoCase(ext[1])) fn=fn.BeforeLast('.');
//fn=fn+_T('.')+ext[ jj ];
switch (jj) {
case 0:
case 1:
if (!useTransp) {
StartProgress("Saving snap!", 2);
wxImage snapi(sx,sy,snap);
if (AAMult!=1) snapi=snapi.Scale(sx/AAMult,sy/AAMult);
UpdateProgress(1);
wxBitmap(snapi.Mirror(false)).SaveFile(
fn,
(jj==0)?wxBITMAP_TYPE_PNG:wxBITMAP_TYPE_JPEG
);
UpdateProgress(2);
EndProgress();
}
else {
if (AAMult!=1) downsample2x2(snap, sx, sy);
PNGSaveWithAlpha((const char*)fn.mb_str(wxConvUTF8),snap,sx/AAMult,sy/AAMult,1);
};
break;
case 2: {
GifWrapper gifw;
int N;
double totalTime;
double subStepTime=0;
double startTime;startTime=hardSettings.GIF_INITIAL_PAUSE/1000.0;
if (hardSettings.GIF_ANIMATION_MODE==0) {
//.........这里部分代码省略.........