本文整理汇总了C++中wxBitmap::LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ wxBitmap::LoadFile方法的具体用法?C++ wxBitmap::LoadFile怎么用?C++ wxBitmap::LoadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxBitmap
的用法示例。
在下文中一共展示了wxBitmap::LoadFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
bool LatexPreviewWindow::Build(
const wxString& text,
const wxString& texplate,
wxBitmap& img,
execution_info& info )
{
// to do: generate less files?
wxFileName name;
if (m_make_filename) {
name.AssignTempFileName(wxT("latex_preview_"));
wxRemoveFile(name.GetFullPath());
} else
name = m_filename;
wxString basename = name.GetPath() + wxT("/") + name.GetName();
int ft = m_filetype;
bool tr = m_transparent;
wxString file_tex = basename + wxT(".tex"),
file_dvi = basename + wxT(".dvi"),
file_png = basename + wxT(".png"),
file_gif = basename + wxT(".gif"),
file_img = ft == filetype::gif ? file_gif : file_png;
ChangeCwd dummy(name.GetPath());
bool success =
BuildTex(text, texplate, file_tex, info) &&
BuildDvi(file_tex, file_dvi, info) &&
BuildImg(file_dvi, file_img, ft, tr, info);
wxRemoveFile(basename + wxT(".tex"));
wxRemoveFile(basename + wxT(".log"));
wxRemoveFile(basename + wxT(".dvi"));
wxRemoveFile(basename + wxT(".aux"));
if (!success) {
return false;
}
m_make_filename = false;
m_filename = basename;
m_filename_img = file_img;
if (ft == filetype::gif)
return img.LoadFile(file_gif, wxBITMAP_TYPE_GIF);
return img.LoadFile(file_png, wxBITMAP_TYPE_PNG);
}
示例2: setImage
void setImage(wxString path)
{
m_image_path = path;
if(path.EndsWith(wxT(".icns"))) {
wxExecute(wxT("sips -s format png '") + path + wxT("' --out /tmp/tmpicon.png"), wxEXEC_SYNC);
path = wxT("/tmp/tmpicon.png");
}
m_image.LoadFile(path, wxBITMAP_TYPE_ANY);
if(m_image.IsOk()) {
if(m_image.GetWidth() > 50 or m_image.GetHeight() > 50) {
wxImage tmp = m_image.ConvertToImage();
tmp.Rescale(50, 50, wxIMAGE_QUALITY_HIGH);
m_image = wxBitmap(tmp);
}
const int w = m_image.GetWidth();
const int h = m_image.GetHeight();
SetMinSize(wxSize(w + 20, h + 20));
SetMaxSize(wxSize(w + 20, h + 20));
Refresh(); // repaint needed to see change
} else {
wxMessageBox(_("Failed to load image"));
}
}
示例3: LoadPNG
static void LoadPNG(wxBitmap& bmp, const wxString& section, const wxString& filename)
{
wxString path = wxString::FromUTF8(GNC::GCS::IEntorno::Instance()->GetGinkgoResourcesDir().c_str()) + wxFileName::GetPathSeparator() + bundleDir + wxFileName::GetPathSeparator() + section + wxFileName::GetPathSeparator() + filename;
if (!bmp.LoadFile(path, wxBITMAP_TYPE_PNG)) {
LOG_ERROR("Visualizator/Resources", _Std("Unable to load PNG bitmap resource") << ": " << std::string(path.ToUTF8()));
}
}
示例4: OnInit
bool CEditorApp::OnInit()
{
plClearLog(EDITOR_LOG);
plWriteLog(EDITOR_LOG, "Initializing engine interface...\n");
EngineInterface_Load();
g_apptitle = EDITOR_TITLE " (" EDITOR_VERSION ")";
wxImage::AddHandler(new wxPNGHandler);
wxImage::AddHandler(new wxGIFHandler);
wxImage::AddHandler(new wxICOHandler);
bSplashScreen.LoadFile("resource/splash-editor.png", wxBITMAP_TYPE_PNG);
bSmallMDL.LoadFile("resource/icon-mdl-small.png", wxBITMAP_TYPE_PNG);
bSmallAuto.LoadFile("resource/view-auto.png", wxBITMAP_TYPE_PNG);
bSmallWAD.LoadFile("resource/icon-wad-small.png", wxBITMAP_TYPE_PNG);
bSmallPrefIcon.LoadFile(PATH_16ICONS"actions/configure.png", wxBITMAP_TYPE_PNG);
smallDocumentNew.LoadFile(PATH_16ICONS"actions/document-new.png", wxBITMAP_TYPE_PNG);
smallDocumentOpen.LoadFile(PATH_16ICONS"actions/document-open.png", wxBITMAP_TYPE_PNG);
smallDocumentSave.LoadFile(PATH_16ICONS"actions/document-save.png", wxBITMAP_TYPE_PNG);
smallDocumentClose.LoadFile(PATH_16ICONS"actions/document-close.png", wxBITMAP_TYPE_PNG);
smallDocumentSaveAs.LoadFile(PATH_16ICONS"actions/document-save-as.png", wxBITMAP_TYPE_PNG);
iconDocumentUndo.LoadFile(PATH_16ICONS"actions/edit-undo.png", wxBITMAP_TYPE_PNG);
iconDocumentRedo.LoadFile(PATH_16ICONS"actions/edit-redo.png", wxBITMAP_TYPE_PNG);
iconMediaPause.LoadFile(PATH_16ICONS"actions/media-playback-pause.png", wxBITMAP_TYPE_PNG);
iconMediaPlay.LoadFile(PATH_16ICONS"actions/media-playback-start.png", wxBITMAP_TYPE_PNG);
iconDocumentRefresh.LoadFile(PATH_16ICONS"actions/view-refresh.png", wxBITMAP_TYPE_PNG);
iconShapeCube.LoadFile("resource/shape-cube.png", wxBITMAP_TYPE_PNG);
iconShapeSphere.LoadFile("resource/shape-sphere.png", wxBITMAP_TYPE_PNG);
bSmallPlaneIcon.LoadFile("resource/shape-plane.png", wxBITMAP_TYPE_PNG);
iconScriptEdit.LoadFile(PATH_16ICONS"apps/accessories-text-editor.png", wxBITMAP_TYPE_PNG);
smallTransform.LoadFile(PATH_16ICONS"actions/transform-move.png", wxBITMAP_TYPE_PNG);
smallApplicationExit.LoadFile(PATH_16ICONS"actions/application-exit.png", wxBITMAP_TYPE_PNG);
plWriteLog(EDITOR_LOG, "Creating main frame...\n");
editor_frame = new CEditorFrame(g_apptitle, wxPoint(50, 50), wxSize(1024, 768));
if (!editor_frame)
{
EngineInterface_Unload();
wxMessageBox("Failed to create main frame!", EDITOR_TITLE" Error");
wxExit();
}
if (!engine->Initialize(argc, argv, true))
{
EngineInterface_Unload();
wxMessageBox("Failed to initialize engine!", EDITOR_TITLE" Error");
wxExit();
}
engine->MaterialEditorInitialize();
sEditorMaterialPath = engine->GetMaterialPath();
editor_frame->Initialize();
plWriteLog(EDITOR_LOG, "Starting main loop...\n");
// Start rendering.
editor_frame->StartEngineLoop();
return true;
}