home.cpp 615 B

123456789101112131415161718192021222324
  1. Home::Home(View* parent) : PanelItem(parent, Size{~0, ~0}) {
  2. setCollapsible().setVisible(false);
  3. image icon{Resource::Higan::Icon};
  4. icon.shrink();
  5. for(uint y : range(icon.height())) {
  6. auto data = icon.data() + y * icon.pitch();
  7. for(uint x : range(icon.width())) {
  8. uint8_t alpha = icon.read(data) >> 24;
  9. icon.write(data, uint8_t(alpha * 0.15) << 24);
  10. data += icon.stride();
  11. }
  12. }
  13. icon.scale(sx(icon.width() * 0.75), sy(icon.height() * 0.75));
  14. iconCanvas.setIcon(icon);
  15. }
  16. auto Home::show() -> void {
  17. setVisible(true);
  18. }
  19. auto Home::hide() -> void {
  20. setVisible(false);
  21. }