Convert internal images to xpm to png

This commit is contained in:
daleclack 2024-04-20 20:33:11 +08:00
parent b071c1ebaa
commit c8320fbf11
5 changed files with 11 additions and 5 deletions

View File

@ -49,6 +49,8 @@ set(RESOURCE_LIST
STRIPBLANKS win_input.ui STRIPBLANKS win_input.ui
STRIPBLANKS scoreswin.ui STRIPBLANKS scoreswin.ui
STRIPBLANKS mine_menu.xml STRIPBLANKS mine_menu.xml
img7.png
winpe.png
login_style.css login_style.css
mine_style.css mine_style.css
style.css style.css

BIN
Gtkmm3_Mac/res/img7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 KiB

BIN
Gtkmm3_Mac/res/winpe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

View File

@ -1,10 +1,13 @@
#include "MyPrefs.hh" #include "MyPrefs.hh"
#include "winpe.xpm" // #include "winpe.xpm"
#include "img7.xpm" // #include "img7.xpm"
#include "image_types.hh" #include "image_types.hh"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#define winpe "/org/gtk/daleclack/winpe.png"
#define img7 "/org/gtk/daleclack/img7.png"
MyPrefs::MyPrefs() MyPrefs::MyPrefs()
: main_box(Gtk::ORIENTATION_VERTICAL, 10), : main_box(Gtk::ORIENTATION_VERTICAL, 10),
views_box(Gtk::ORIENTATION_HORIZONTAL, 5), views_box(Gtk::ORIENTATION_HORIZONTAL, 5),
@ -398,10 +401,11 @@ void MyPrefs::images_view_changed()
} }
} }
void MyPrefs::set_background_internal(const char *const *data) void MyPrefs::set_background_internal(const char *data)
{ {
// Set a internal background // Set a internal background
auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(data); // auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(data);
auto pixbuf = Gdk::Pixbuf::create_from_resource(data);
auto sized = pixbuf->scale_simple(width, height, Gdk::INTERP_BILINEAR); auto sized = pixbuf->scale_simple(width, height, Gdk::INTERP_BILINEAR);
gtk_image_set_from_pixbuf(background1->gobj(), sized->gobj()); gtk_image_set_from_pixbuf(background1->gobj(), sized->gobj());
pixbuf.reset(); pixbuf.reset();

View File

@ -114,7 +114,7 @@ private:
// Update the background // Update the background
void update_images_view(std::string &folder_path); void update_images_view(std::string &folder_path);
void set_background_internal(const char *const *data); void set_background_internal(const char *data);
void set_background_file(); void set_background_file();
// Resoulution page // Resoulution page