summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-20 20:06:05 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-26 20:24:37 +0000
commit82a152b69602de05a28034864185545207639a8c (patch)
tree308eb816ef76a6579934786822d39f186bad385b /Userland
parent1971bff31455306b6976fe7e69db851c94a30794 (diff)
downloadserenity-82a152b69602de05a28034864185545207639a8c.zip
LibGfx: Remove `try_` prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit it.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applets/Audio/main.cpp10
-rw-r--r--Userland/Applets/ClipboardHistory/main.cpp2
-rw-r--r--Userland/Applets/Keymap/KeymapStatusWidget.cpp2
-rw-r--r--Userland/Applets/Network/main.cpp4
-rw-r--r--Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp2
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp6
-rw-r--r--Userland/Applications/Assistant/main.cpp4
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp2
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp2
-rw-r--r--Userland/Applications/Browser/IconBag.cpp62
-rw-r--r--Userland/Applications/Browser/StorageWidget.cpp2
-rw-r--r--Userland/Applications/Calculator/main.cpp8
-rw-r--r--Userland/Applications/Calendar/main.cpp16
-rw-r--r--Userland/Applications/CharacterMap/CharacterMapWidget.cpp10
-rw-r--r--Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp4
-rw-r--r--Userland/Applications/CrashReporter/main.cpp4
-rw-r--r--Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp2
-rw-r--r--Userland/Applications/DisplaySettings/MonitorWidget.cpp8
-rw-r--r--Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp2
-rw-r--r--Userland/Applications/FileManager/DirectoryView.cpp12
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.cpp2
-rw-r--r--Userland/Applications/FileManager/main.cpp36
-rw-r--r--Userland/Applications/FontEditor/MainWidget.cpp22
-rw-r--r--Userland/Applications/Help/MainWidget.cpp2
-rw-r--r--Userland/Applications/Help/ManualModel.cpp6
-rw-r--r--Userland/Applications/HexEditor/HexEditorWidget.cpp16
-rw-r--r--Userland/Applications/ImageViewer/main.cpp18
-rw-r--r--Userland/Applications/Magnifier/main.cpp4
-rw-r--r--Userland/Applications/Mail/MailboxTreeModel.cpp6
-rw-r--r--Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp2
-rw-r--r--Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp4
-rw-r--r--Userland/Applications/MouseSettings/ThemeWidget.cpp2
-rw-r--r--Userland/Applications/PDFViewer/OutlineModel.cpp4
-rw-r--r--Userland/Applications/PDFViewer/PDFViewer.cpp2
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp6
-rw-r--r--Userland/Applications/Piano/MainWidget.cpp4
-rw-r--r--Userland/Applications/Piano/PlayerWidget.cpp12
-rw-r--r--Userland/Applications/Piano/RollWidget.cpp2
-rw-r--r--Userland/Applications/Piano/SamplerWidget.cpp2
-rw-r--r--Userland/Applications/Piano/main.cpp2
-rw-r--r--Userland/Applications/PixelPaint/FilterTreeModel.cpp2
-rw-r--r--Userland/Applications/PixelPaint/IconBag.cpp68
-rw-r--r--Userland/Applications/PixelPaint/Image.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Layer.cpp12
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.cpp8
-rw-r--r--Userland/Applications/PixelPaint/ToolboxWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/BrushTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/BucketTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/EraseTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/GuideTool.cpp4
-rw-r--r--Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp4
-rw-r--r--Userland/Applications/PixelPaint/Tools/MoveTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/TextTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/VectorscopeWidget.cpp2
-rw-r--r--Userland/Applications/Presenter/PresenterWidget.cpp8
-rw-r--r--Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp4
-rw-r--r--Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp10
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp4
-rw-r--r--Userland/Applications/Spreadsheet/HelpWindow.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp12
-rw-r--r--Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp8
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp8
-rw-r--r--Userland/Applications/Terminal/main.cpp10
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp16
-rw-r--r--Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp4
-rw-r--r--Userland/Demos/CatDog/CatDog.cpp2
-rw-r--r--Userland/Demos/GradientScreensaver/GradientScreensaver.cpp2
-rw-r--r--Userland/Demos/LibGfxDemo/main.cpp6
-rw-r--r--Userland/Demos/LibGfxScaleDemo/main.cpp12
-rw-r--r--Userland/Demos/Mandelbrot/Mandelbrot.cpp4
-rw-r--r--Userland/Demos/ModelGallery/GalleryWidget.cpp4
-rw-r--r--Userland/Demos/Starfield/Starfield.cpp2
-rw-r--r--Userland/Demos/Tubes/Tubes.cpp2
-rw-r--r--Userland/Demos/WidgetGallery/GalleryModels.h6
-rw-r--r--Userland/Demos/WidgetGallery/GalleryWidget.cpp14
-rw-r--r--Userland/DevTools/GMLPlayground/main.cpp2
-rw-r--r--Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp8
-rw-r--r--Userland/DevTools/HackStudio/Debugger/VariablesModel.h2
-rw-r--r--Userland/DevTools/HackStudio/Editor.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Git/GitWidget.cpp8
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp44
-rw-r--r--Userland/DevTools/HackStudio/LanguageClient.cpp4
-rw-r--r--Userland/DevTools/HackStudio/ProjectDeclarations.cpp14
-rw-r--r--Userland/DevTools/HackStudio/ProjectTemplate.cpp2
-rw-r--r--Userland/DevTools/HackStudio/main.cpp4
-rw-r--r--Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp8
-rw-r--r--Userland/DevTools/Inspector/main.cpp2
-rw-r--r--Userland/DevTools/Profiler/Gradient.cpp2
-rw-r--r--Userland/DevTools/Profiler/ProfileModel.cpp4
-rw-r--r--Userland/DevTools/Profiler/SamplesModel.cpp4
-rw-r--r--Userland/DevTools/Profiler/main.cpp8
-rw-r--r--Userland/DevTools/SQLStudio/MainWidget.cpp6
-rw-r--r--Userland/Games/2048/main.cpp4
-rw-r--r--Userland/Games/BrickGame/main.cpp2
-rw-r--r--Userland/Games/Chess/ChessWidget.cpp2
-rw-r--r--Userland/Games/Chess/main.cpp4
-rw-r--r--Userland/Games/ColorLines/ColorLines.cpp2
-rw-r--r--Userland/Games/ColorLines/main.cpp2
-rw-r--r--Userland/Games/FlappyBug/Game.h12
-rw-r--r--Userland/Games/Flood/main.cpp4
-rw-r--r--Userland/Games/GameOfLife/main.cpp12
-rw-r--r--Userland/Games/Hearts/main.cpp4
-rw-r--r--Userland/Games/Minesweeper/Field.cpp16
-rw-r--r--Userland/Games/Minesweeper/main.cpp2
-rw-r--r--Userland/Games/Snake/Game.cpp2
-rw-r--r--Userland/Games/Snake/main.cpp8
-rw-r--r--Userland/Games/Solitaire/main.cpp2
-rw-r--r--Userland/Games/Spider/main.cpp2
-rw-r--r--Userland/Libraries/LibCards/CardGame.cpp2
-rw-r--r--Userland/Libraries/LibCards/CardPainter.cpp4
-rw-r--r--Userland/Libraries/LibGUI/AbstractThemePreview.cpp12
-rw-r--r--Userland/Libraries/LibGUI/AutocompleteProvider.cpp4
-rw-r--r--Userland/Libraries/LibGUI/Button.cpp2
-rw-r--r--Userland/Libraries/LibGUI/Clipboard.cpp4
-rw-r--r--Userland/Libraries/LibGUI/ColorPicker.cpp6
-rw-r--r--Userland/Libraries/LibGUI/ComboBox.cpp2
-rw-r--r--Userland/Libraries/LibGUI/CommonActions.cpp56
-rw-r--r--Userland/Libraries/LibGUI/DragOperation.cpp2
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.cpp4
-rw-r--r--Userland/Libraries/LibGUI/FilePicker.cpp8
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.cpp4
-rw-r--r--Userland/Libraries/LibGUI/FontPicker.cpp2
-rw-r--r--Userland/Libraries/LibGUI/Icon.cpp4
-rw-r--r--Userland/Libraries/LibGUI/Label.cpp2
-rw-r--r--Userland/Libraries/LibGUI/LinkLabel.cpp2
-rw-r--r--Userland/Libraries/LibGUI/MessageBox.cpp8
-rw-r--r--Userland/Libraries/LibGUI/MultiView.cpp6
-rw-r--r--Userland/Libraries/LibGUI/PasswordInputDialog.cpp2
-rw-r--r--Userland/Libraries/LibGUI/SpinBox.cpp4
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp2
-rw-r--r--Userland/Libraries/LibGUI/Toolbar.cpp2
-rw-r--r--Userland/Libraries/LibGUI/TreeView.cpp4
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp4
-rw-r--r--Userland/Libraries/LibGfx/AntiAliasingPainter.cpp2
-rw-r--r--Userland/Libraries/LibGfx/BMPLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.cpp58
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.h16
-rw-r--r--Userland/Libraries/LibGfx/DDSLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h2
-rw-r--r--Userland/Libraries/LibGfx/Font/Emoji.cpp2
-rw-r--r--Userland/Libraries/LibGfx/Font/PathRasterizer.cpp2
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp4
-rw-r--r--Userland/Libraries/LibGfx/JPGLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp6
-rw-r--r--Userland/Libraries/LibGfx/PortableImageLoaderCommon.h2
-rw-r--r--Userland/Libraries/LibGfx/QOILoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/ShareableBitmap.cpp2
-rw-r--r--Userland/Libraries/LibGfx/TGALoader.cpp4
-rw-r--r--Userland/Libraries/LibPDF/Renderer.cpp4
-rw-r--r--Userland/Libraries/LibSoftGPU/Image.cpp2
-rw-r--r--Userland/Libraries/LibVT/TerminalWidget.cpp4
-rw-r--r--Userland/Libraries/LibVideo/VideoFrame.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/ImageData.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Painting/BorderPainting.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp4
-rw-r--r--Userland/Libraries/LibWebView/DOMTreeModel.cpp6
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.cpp4
-rw-r--r--Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp4
-rw-r--r--Userland/Services/Taskbar/ClockWidget.cpp10
-rw-r--r--Userland/Services/Taskbar/QuickLaunchWidget.cpp2
-rw-r--r--Userland/Services/Taskbar/ShutdownDialog.cpp4
-rw-r--r--Userland/Services/Taskbar/TaskbarWindow.cpp2
-rw-r--r--Userland/Services/Taskbar/main.cpp14
-rw-r--r--Userland/Services/WebContent/ConnectionFromClient.cpp2
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp12
-rw-r--r--Userland/Services/WindowServer/ConnectionFromClient.cpp6
-rw-r--r--Userland/Services/WindowServer/Cursor.cpp2
-rw-r--r--Userland/Services/WindowServer/MultiScaleBitmaps.cpp2
-rw-r--r--Userland/Services/WindowServer/Overlays.cpp4
-rw-r--r--Userland/Services/WindowServer/Window.cpp16
-rw-r--r--Userland/Services/WindowServer/WindowFrame.cpp6
-rw-r--r--Userland/Utilities/headless-browser.cpp2
-rw-r--r--Userland/Utilities/image2bin.cpp2
-rw-r--r--Userland/Utilities/notify.cpp2
-rw-r--r--Userland/Utilities/wallpaper.cpp4
179 files changed, 586 insertions, 586 deletions
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp
index 238561c4b8..a7607a9bdd 100644
--- a/Userland/Applets/Audio/main.cpp
+++ b/Userland/Applets/Audio/main.cpp
@@ -37,11 +37,11 @@ public:
static ErrorOr<NonnullRefPtr<AudioWidget>> try_create()
{
Array<VolumeBitmapPair, 5> volume_level_bitmaps = {
- { { 66, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-high.png"sv)) },
- { 33, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-medium.png"sv)) },
- { 1, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-low.png"sv)) },
- { 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-zero.png"sv)) },
- { 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-muted.png"sv)) } }
+ { { 66, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/audio-volume-high.png"sv)) },
+ { 33, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/audio-volume-medium.png"sv)) },
+ { 1, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/audio-volume-low.png"sv)) },
+ { 0, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/audio-volume-zero.png"sv)) },
+ { 0, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/audio-volume-muted.png"sv)) } }
};
auto audio_client = TRY(Audio::ConnectionToServer::try_create());
NonnullRefPtr<AudioWidget> audio_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AudioWidget(move(audio_client), move(volume_level_bitmaps))));
diff --git a/Userland/Applets/ClipboardHistory/main.cpp b/Userland/Applets/ClipboardHistory/main.cpp
index 2add7e8011..bea6d1f8e6 100644
--- a/Userland/Applets/ClipboardHistory/main.cpp
+++ b/Userland/Applets/ClipboardHistory/main.cpp
@@ -67,7 +67,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
});
});
- auto clear_action = GUI::Action::create("Clear history", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"sv)), [&](const GUI::Action&) {
+ auto clear_action = GUI::Action::create("Clear history", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/trash-can.png"sv)), [&](const GUI::Action&) {
model->clear();
GUI::Clipboard::the().clear();
});
diff --git a/Userland/Applets/Keymap/KeymapStatusWidget.cpp b/Userland/Applets/Keymap/KeymapStatusWidget.cpp
index 7a1b274347..d2b5aa68a6 100644
--- a/Userland/Applets/Keymap/KeymapStatusWidget.cpp
+++ b/Userland/Applets/Keymap/KeymapStatusWidget.cpp
@@ -48,7 +48,7 @@ ErrorOr<void> KeymapStatusWidget::refresh_menu()
m_context_menu->add_separator();
- auto settings_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv));
+ auto settings_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv));
m_context_menu->add_action(GUI::Action::create("Keyboard &Settings",
settings_icon,
diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp
index 7a9aca3e34..3680d9f6e2 100644
--- a/Userland/Applets/Network/main.cpp
+++ b/Userland/Applets/Network/main.cpp
@@ -24,8 +24,8 @@ class NetworkWidget final : public GUI::ImageWidget {
public:
static ErrorOr<NonnullRefPtr<NetworkWidget>> try_create(bool notifications)
{
- NonnullRefPtr<Gfx::Bitmap> connected_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network.png"sv));
- NonnullRefPtr<Gfx::Bitmap> disconnected_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png"sv));
+ NonnullRefPtr<Gfx::Bitmap> connected_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/network.png"sv));
+ NonnullRefPtr<Gfx::Bitmap> disconnected_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/network-disconnected.png"sv));
return adopt_nonnull_ref_or_enomem(new (nothrow) NetworkWidget(notifications, move(connected_icon), move(disconnected_icon)));
}
diff --git a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp
index 0f67aac595..03997022f2 100644
--- a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp
+++ b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp
@@ -109,7 +109,7 @@ public:
if (!m_context_menu) {
m_context_menu = GUI::Menu::construct();
- auto settings_icon = MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv));
+ auto settings_icon = MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv));
auto open_workspace_settings_action = GUI::Action::create("Workspace &Settings", *settings_icon, [](auto&) {
auto result = Core::Process::spawn("/bin/DisplaySettings"sv, Array { "--open-tab", "workspaces" }.span());
if (result.is_error()) {
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp
index 911d764823..27442da718 100644
--- a/Userland/Applications/3DFileViewer/main.cpp
+++ b/Userland/Applications/3DFileViewer/main.cpp
@@ -58,7 +58,7 @@ private:
{
constexpr u16 RENDER_WIDTH = 640;
constexpr u16 RENDER_HEIGHT = 480;
- m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { RENDER_WIDTH, RENDER_HEIGHT }).release_value_but_fixme_should_propagate_errors();
+ m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { RENDER_WIDTH, RENDER_HEIGHT }).release_value_but_fixme_should_propagate_errors();
m_context = MUST(GL::create_context(*m_bitmap));
start_timer(20);
@@ -335,14 +335,14 @@ bool GLContextWidget::load_file(Core::File& file)
// Attempt to open the texture file from disk
RefPtr<Gfx::Bitmap> texture_image;
if (Core::File::exists(texture_path)) {
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(texture_path);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path);
if (!bitmap_or_error.is_error())
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
} else {
auto response = FileSystemAccessClient::Client::the().try_request_file_deprecated(window(), builder.string_view(), Core::OpenMode::ReadOnly);
if (!response.is_error()) {
auto texture_file = response.value();
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_fd_and_close(texture_file->leak_fd(), texture_file->filename());
+ auto bitmap_or_error = Gfx::Bitmap::load_from_fd_and_close(texture_file->leak_fd(), texture_file->filename());
if (!bitmap_or_error.is_error())
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
}
diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp
index 028893d0a1..260ff7e754 100644
--- a/Userland/Applications/Assistant/main.cpp
+++ b/Userland/Applications/Assistant/main.cpp
@@ -58,13 +58,13 @@ class ResultRow final : public GUI::Button {
m_context_menu = GUI::Menu::construct();
if (LexicalPath path { text() }; path.is_absolute()) {
- m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) {
+ m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
}));
m_context_menu->add_separator();
}
- m_context_menu->add_action(GUI::Action::create("&Copy as Text", MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) {
+ m_context_menu->add_action(GUI::Action::create("&Copy as Text", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) {
GUI::Clipboard::the().set_plain_text(text());
}));
}
diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp
index a86e06c01d..efaef4a5f6 100644
--- a/Userland/Applications/Browser/BookmarksBarWidget.cpp
+++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp
@@ -111,7 +111,7 @@ BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, b
m_additional = GUI::Button::construct();
m_additional->set_tooltip("Show hidden bookmarks");
m_additional->set_menu(m_additional_menu);
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/overflow-menu.png"sv);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file("/res/icons/16x16/overflow-menu.png"sv);
if (!bitmap_or_error.is_error())
m_additional->set_icon(bitmap_or_error.release_value());
m_additional->set_button_style(Gfx::ButtonStyle::Coolbar);
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index dfa73d0acc..26acac1a76 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -355,7 +355,7 @@ void BrowserWindow::build_menus()
}
settings_menu.add_separator();
- auto open_settings_action = GUI::Action::create("Browser &Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv).release_value_but_fixme_should_propagate_errors(),
+ auto open_settings_action = GUI::Action::create("Browser &Settings", Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv).release_value_but_fixme_should_propagate_errors(),
[this](auto&) {
GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings"sv);
});
diff --git a/Userland/Applications/Browser/IconBag.cpp b/Userland/Applications/Browser/IconBag.cpp
index 037d26fef1..f9a85ad1d4 100644
--- a/Userland/Applications/Browser/IconBag.cpp
+++ b/Userland/Applications/Browser/IconBag.cpp
@@ -12,37 +12,37 @@ ErrorOr<IconBag> IconBag::try_create()
{
IconBag icon_bag;
- icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv));
- icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"sv));
- icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"sv));
- icon_bag.filetype_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-image.png"sv));
- icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png"sv));
- icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png"sv));
- icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv));
- icon_bag.go_home = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv));
- icon_bag.find = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv));
- icon_bag.color_chooser = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv));
- icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv));
- icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv));
- icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png"sv));
- icon_bag.close_other_tabs = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-other-tabs.png"sv));
- icon_bag.new_window = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-window.png"sv));
- icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png"sv));
- icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png"sv));
- icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv));
- icon_bag.layers = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layers.png"sv));
- icon_bag.filetype_css = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-css.png"sv));
- icon_bag.inspect = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspect.png"sv));
- icon_bag.history = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/history.png"sv));
- icon_bag.cookie = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/cookie.png"sv));
- icon_bag.local_storage = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/local-storage.png"sv));
- icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"sv));
- icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png"sv));
- icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png"sv));
- icon_bag.go_to = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv));
- icon_bag.download = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/download.png"sv));
- icon_bag.copy = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv));
- icon_bag.rename = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png"sv));
+ icon_bag.filetype_html = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"sv));
+ icon_bag.filetype_text = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-text.png"sv));
+ icon_bag.filetype_javascript = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-javascript.png"sv));
+ icon_bag.filetype_image = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-image.png"sv));
+ icon_bag.bookmark_contour = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/bookmark-contour.png"sv));
+ icon_bag.bookmark_filled = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/bookmark-filled.png"sv));
+ icon_bag.inspector_object = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv));
+ icon_bag.go_home = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-home.png"sv));
+ icon_bag.find = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv));
+ icon_bag.color_chooser = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/color-chooser.png"sv));
+ icon_bag.delete_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv));
+ icon_bag.new_tab = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"sv));
+ icon_bag.duplicate_tab = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/duplicate-tab.png"sv));
+ icon_bag.close_other_tabs = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/close-other-tabs.png"sv));
+ icon_bag.new_window = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new-window.png"sv));
+ icon_bag.code = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/code.png"sv));
+ icon_bag.dom_tree = TRY(Gfx::Bitmap::load_from_file("/res/icons/browser/dom-tree.png"sv));
+ icon_bag.layout = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/layout.png"sv));
+ icon_bag.layers = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/layers.png"sv));
+ icon_bag.filetype_css = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-css.png"sv));
+ icon_bag.inspect = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspect.png"sv));
+ icon_bag.history = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/history.png"sv));
+ icon_bag.cookie = TRY(Gfx::Bitmap::load_from_file("/res/icons/browser/cookie.png"sv));
+ icon_bag.local_storage = TRY(Gfx::Bitmap::load_from_file("/res/icons/browser/local-storage.png"sv));
+ icon_bag.trash_can = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/trash-can.png"sv));
+ icon_bag.clear_cache = TRY(Gfx::Bitmap::load_from_file("/res/icons/browser/clear-cache.png"sv));
+ icon_bag.spoof = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/spoof.png"sv));
+ icon_bag.go_to = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv));
+ icon_bag.download = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/download.png"sv));
+ icon_bag.copy = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv));
+ icon_bag.rename = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/rename.png"sv));
return icon_bag;
}
diff --git a/Userland/Applications/Browser/StorageWidget.cpp b/Userland/Applications/Browser/StorageWidget.cpp
index ea5424cae0..4c7314fd87 100644
--- a/Userland/Applications/Browser/StorageWidget.cpp
+++ b/Userland/Applications/Browser/StorageWidget.cpp
@@ -39,7 +39,7 @@ StorageWidget::StorageWidget()
m_cookies_table_view->set_alternating_row_colors(true);
auto delete_cookie_action = GUI::Action::create(
- "&Delete Cookie", { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto const&) {
+ "&Delete Cookie", { Key_Delete }, Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto const&) {
auto cookie_index = m_cookies_table_view->selection().first();
delete_cookie(m_cookies_model->take_cookie(cookie_index));
},
diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp
index 275d10b071..fc82d6e23a 100644
--- a/Userland/Applications/Calculator/main.cpp
+++ b/Userland/Applications/Calculator/main.cpp
@@ -61,13 +61,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& constants_menu = window->add_menu("&Constants");
auto const power = Crypto::NumberTheory::Power("10"_bigint, "10"_bigint);
- constants_menu.add_action(GUI::Action::create("&Pi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/pi.png"sv)), [&](auto&) {
+ constants_menu.add_action(GUI::Action::create("&Pi", TRY(Gfx::Bitmap::load_from_file("/res/icons/calculator/pi.png"sv)), [&](auto&) {
widget->set_entry(Crypto::BigFraction { Crypto::SignedBigInteger(31415926535), power });
}));
- constants_menu.add_action(GUI::Action::create("&Euler's Number", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/eulers_number.png"sv)), [&](auto&) {
+ constants_menu.add_action(GUI::Action::create("&Euler's Number", TRY(Gfx::Bitmap::load_from_file("/res/icons/calculator/eulers_number.png"sv)), [&](auto&) {
widget->set_entry(Crypto::BigFraction { Crypto::SignedBigInteger(27182818284), power });
}));
- constants_menu.add_action(GUI::Action::create("&Phi", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/calculator/phi.png"sv)), [&](auto&) {
+ constants_menu.add_action(GUI::Action::create("&Phi", TRY(Gfx::Bitmap::load_from_file("/res/icons/calculator/phi.png"sv)), [&](auto&) {
widget->set_entry(Crypto::BigFraction { Crypto::SignedBigInteger(16180339887), power });
}));
@@ -102,7 +102,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
widget->set_rounding_custom(round_custom, format);
- auto shrink_action = GUI::Action::create("&Shrink...", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-cut.png"sv)), [&](auto&) {
+ auto shrink_action = GUI::Action::create("&Shrink...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv)), [&](auto&) {
unsigned shrink_length = widget->rounding_length();
if (RoundingDialog::show(window, "Choose shrinking length"sv, shrink_length) == GUI::Dialog::ExecResult::OK) {
diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp
index 705e09c32a..8fe3886026 100644
--- a/Userland/Applications/Calendar/main.cpp
+++ b/Userland/Applications/Calendar/main.cpp
@@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto toolbar = main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar");
auto calendar = main_widget->find_descendant_of_type_named<GUI::Calendar>("calendar");
- auto prev_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](const GUI::Action&) {
+ auto prev_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv)), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
calendar->update_tiles(view_year, view_month);
});
- auto next_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](const GUI::Action&) {
+ auto next_date_action = GUI::Action::create({}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -78,22 +78,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
calendar->update_tiles(view_year, view_month);
});
- auto add_event_action = GUI::Action::create("&Add Event", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"sv)), [&](const GUI::Action&) {
+ auto add_event_action = GUI::Action::create("&Add Event", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/add-event.png"sv)), [&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
});
- auto jump_to_action = GUI::Action::create("Jump to &Today", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"sv)), [&](const GUI::Action&) {
+ auto jump_to_action = GUI::Action::create("Jump to &Today", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-date.png"sv)), [&](const GUI::Action&) {
calendar->set_selected_date(Core::DateTime::now());
calendar->update_tiles(Core::DateTime::now().year(), Core::DateTime::now().month());
});
- auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-month-view.png"sv)), [&](const GUI::Action&) {
+ auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-month-view.png"sv)), [&](const GUI::Action&) {
if (calendar->mode() == GUI::Calendar::Year)
calendar->toggle_mode();
});
view_month_action->set_checked(true);
- auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv)), [&](const GUI::Action&) {
+ auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"sv)), [&](const GUI::Action&) {
if (calendar->mode() == GUI::Calendar::Month)
calendar->toggle_mode();
});
@@ -106,7 +106,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (default_view == "Year")
view_year_action->set_checked(true);
- auto open_settings_action = GUI::Action::create("&Settings", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-settings.png"sv)), [&](GUI::Action const&) {
+ auto open_settings_action = GUI::Action::create("&Settings", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-settings.png"sv)), [&](GUI::Action const&) {
GUI::Process::spawn_or_show_error(window, "/bin/CalendarSettings"sv);
});
@@ -129,7 +129,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto& file_menu = window->add_menu("&File");
- file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"sv)),
+ file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/add-event.png"sv)),
[&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
}));
diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp
index 120b7f052e..108cae277f 100644
--- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp
+++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp
@@ -37,7 +37,7 @@ CharacterMapWidget::CharacterMapWidget()
m_statusbar = find_descendant_of_type_named<GUI::Statusbar>("statusbar");
m_unicode_block_listview = find_descendant_of_type_named<GUI::ListView>("unicode_block_listview");
- m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
auto font_picker = GUI::FontPicker::construct(window(), &font(), false);
if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
auto& font = *font_picker->font();
@@ -58,17 +58,17 @@ CharacterMapWidget::CharacterMapWidget()
});
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
- m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_previous_existing_glyph();
});
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph");
- m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_next_existing_glyph();
});
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
- m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
DeprecatedString input;
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
@@ -83,7 +83,7 @@ CharacterMapWidget::CharacterMapWidget()
});
m_go_to_glyph_action->set_status_tip("Go to the specified code point");
- m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
if (m_find_window.is_null()) {
m_find_window = GUI::Window::construct(window());
auto search_widget = m_find_window->set_main_widget<CharacterSearchWidget>().release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
index 98682bcad2..a302f583b9 100644
--- a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
+++ b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
@@ -44,14 +44,14 @@ ErrorOr<NonnullRefPtr<TimeZoneSettingsWidget>> TimeZoneSettingsWidget::create()
{
auto timezonesettings_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) TimeZoneSettingsWidget));
- auto time_zone_map_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/graphics/map.png"sv));
+ auto time_zone_map_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/graphics/map.png"sv));
auto time_zone_rect = time_zone_map_bitmap->rect().shrunken(TIME_ZONE_MAP_NORTHERN_TRIM, 0, TIME_ZONE_MAP_SOUTHERN_TRIM, 0);
time_zone_map_bitmap = TRY(time_zone_map_bitmap->cropped(time_zone_rect));
timezonesettings_widget->m_time_zone_map = *timezonesettings_widget->find_descendant_of_type_named<GUI::ImageWidget>("time_zone_map");
timezonesettings_widget->m_time_zone_map->set_bitmap(time_zone_map_bitmap);
- auto time_zone_marker = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/ladyball.png"sv));
+ auto time_zone_marker = TRY(Gfx::Bitmap::load_from_file("/res/icons/32x32/ladyball.png"sv));
timezonesettings_widget->m_time_zone_marker = TRY(time_zone_marker->scaled(0.75f, 0.75f));
timezonesettings_widget->set_time_zone_location();
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp
index feb28fd3a3..d0b9b5368a 100644
--- a/Userland/Applications/CrashReporter/main.cpp
+++ b/Userland/Applications/CrashReporter/main.cpp
@@ -265,13 +265,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
close_button.set_focus(true);
auto& debug_button = *widget->find_descendant_of_type_named<GUI::Button>("debug_button");
- debug_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv)));
+ debug_button.set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"sv)));
debug_button.on_click = [&](int) {
GUI::Process::spawn_or_show_error(window, "/bin/HackStudio"sv, Array { "-c", coredump_path.characters() });
};
auto& save_backtrace_button = *widget->find_descendant_of_type_named<GUI::Button>("save_backtrace_button");
- save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv)));
+ save_backtrace_button.set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv)));
save_backtrace_button.on_click = [&](auto) {
LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name));
auto file_or_error = FileSystemAccessClient::Client::the().save_file(window, lexical_path.title(), lexical_path.extension());
diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp
index 2c9503ce9d..03233fbadb 100644
--- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp
@@ -63,7 +63,7 @@ void BackgroundSettingsWidget::create_frame()
};
m_context_menu = GUI::Menu::construct();
- m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
+ m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
LexicalPath path { m_monitor_widget->wallpaper() };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
});
diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp
index 6a25b53237..169178a860 100644
--- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp
+++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp
@@ -19,8 +19,8 @@ namespace DisplaySettings {
MonitorWidget::MonitorWidget()
{
m_desktop_resolution = GUI::Desktop::the().rect().size();
- m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png"sv).release_value_but_fixme_should_propagate_errors();
- m_desktop_bitmap = Gfx::Bitmap::try_create(m_monitor_bitmap->format(), { 280, 158 }).release_value_but_fixme_should_propagate_errors();
+ m_monitor_bitmap = Gfx::Bitmap::load_from_file("/res/graphics/monitor.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_desktop_bitmap = Gfx::Bitmap::create(m_monitor_bitmap->format(), { 280, 158 }).release_value_but_fixme_should_propagate_errors();
m_monitor_rect = { { 12, 13 }, m_desktop_bitmap->size() };
set_fixed_size(304, 201);
}
@@ -34,7 +34,7 @@ bool MonitorWidget::set_wallpaper(DeprecatedString path)
[path](auto&) -> ErrorOr<NonnullRefPtr<Gfx::Bitmap>> {
if (path.is_empty())
return Error::from_errno(ENOENT);
- return Gfx::Bitmap::try_load_from_file(path);
+ return Gfx::Bitmap::load_from_file(path);
},
[this, path](ErrorOr<NonnullRefPtr<Gfx::Bitmap>> bitmap_or_error) -> ErrorOr<void> {
@@ -155,7 +155,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
// Render text label scaled with scale factor to hint at its effect.
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
// and that should give us the same effect with less code.
- auto text_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
+ auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
GUI::Painter text_painter(*text_bitmap);
text_painter.set_font(painter.font());
diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
index fa5036834e..3f66e7f301 100644
--- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
@@ -48,7 +48,7 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
};
m_themes_combo->set_selected_index(current_theme_index, GUI::AllowCallback::No);
- auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mouse.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto mouse_settings_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/app-mouse.png"sv).release_value_but_fixme_should_propagate_errors();
m_cursor_themes_button = *find_descendant_of_type_named<GUI::Button>("cursor_themes_button");
m_cursor_themes_button->set_icon(mouse_settings_icon);
m_cursor_themes_button->on_click = [&](auto) {
diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp
index 4048d48955..491ef9fe10 100644
--- a/Userland/Applications/FileManager/DirectoryView.cpp
+++ b/Userland/Applications/FileManager/DirectoryView.cpp
@@ -575,7 +575,7 @@ void DirectoryView::handle_selection_change()
void DirectoryView::setup_actions()
{
- m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
+ m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
DeprecatedString value;
if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value));
@@ -587,7 +587,7 @@ void DirectoryView::setup_actions()
}
});
- m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
+ m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
DeprecatedString value;
if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
auto new_file_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value));
@@ -613,7 +613,7 @@ void DirectoryView::setup_actions()
}
});
- m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_open_terminal_action = GUI::Action::create("Open &Terminal Here", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
spawn_terminal(path());
});
@@ -630,21 +630,21 @@ void DirectoryView::setup_actions()
window());
m_view_as_icons_action = GUI::Action::create_checkable(
- "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
+ "View as &Icons", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
set_view_mode(DirectoryView::ViewMode::Icon);
Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Icon"sv);
},
window());
m_view_as_table_action = GUI::Action::create_checkable(
- "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
+ "View as &Table", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
set_view_mode(DirectoryView::ViewMode::Table);
Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Table"sv);
},
window());
m_view_as_columns_action = GUI::Action::create_checkable(
- "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
+ "View as &Columns", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
set_view_mode(DirectoryView::ViewMode::Columns);
Config::write_string("FileManager"sv, "DirectoryView"sv, "ViewMode"sv, "Columns"sv);
},
diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp
index e4b65ab8db..ac5706d068 100644
--- a/Userland/Applications/FileManager/PropertiesWindow.cpp
+++ b/Userland/Applications/FileManager/PropertiesWindow.cpp
@@ -40,7 +40,7 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_re
set_rect({ 0, 0, 360, 420 });
set_resizable(false);
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors());
auto& tab_widget = main_widget->add<GUI::TabWidget>();
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index 8bb260206a..906098fb25 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -252,7 +252,7 @@ void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window)
GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error);
};
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(file_path);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(file_path);
if (bitmap_or_error.is_error()) {
show_error();
return;
@@ -379,7 +379,7 @@ ErrorOr<int> run_in_desktop_mode()
auto create_archive_action
= GUI::Action::create(
"Create &Archive",
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
[&](GUI::Action const&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty())
@@ -404,7 +404,7 @@ ErrorOr<int> run_in_desktop_mode()
auto set_wallpaper_action
= GUI::Action::create(
"Set as Desktop &Wallpaper",
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
[&](GUI::Action const&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty())
@@ -441,7 +441,7 @@ ErrorOr<int> run_in_desktop_mode()
auto desktop_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
- auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [&](auto&) {
+ auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [&](auto&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty()) {
Desktop::Launcher::open(URL::create_with_file_scheme(directory_view->path()));
@@ -454,7 +454,7 @@ ErrorOr<int> run_in_desktop_mode()
}
});
- auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
+ auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty()) {
spawn_terminal(directory_view->path());
@@ -468,7 +468,7 @@ ErrorOr<int> run_in_desktop_mode()
}
});
- auto display_properties_action = GUI::Action::create("&Display Settings", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)), [&](GUI::Action const&) {
+ auto display_properties_action = GUI::Action::create("&Display Settings", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)), [&](GUI::Action const&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/bin/DisplaySettings"));
});
@@ -544,7 +544,7 @@ ErrorOr<int> run_in_desktop_mode()
GUI::Desktop::the().set_wallpaper(nullptr, {});
return;
}
- auto wallpaper_bitmap_or_error = Gfx::Bitmap::try_load_from_file(value);
+ auto wallpaper_bitmap_or_error = Gfx::Bitmap::load_from_file(value);
if (wallpaper_bitmap_or_error.is_error())
dbgln("Failed to load wallpaper bitmap from path: {}", wallpaper_bitmap_or_error.error());
else
@@ -556,7 +556,7 @@ ErrorOr<int> run_in_desktop_mode()
auto selected_wallpaper = Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv);
RefPtr<Gfx::Bitmap> wallpaper_bitmap {};
if (!selected_wallpaper.is_empty()) {
- wallpaper_bitmap = TRY(Gfx::Bitmap::try_load_from_file(selected_wallpaper));
+ wallpaper_bitmap = TRY(Gfx::Bitmap::load_from_file(selected_wallpaper));
}
// This sets the wallpaper at startup, even if there is no wallpaper, the
// desktop should still show the background color. It's fine to pass a
@@ -670,7 +670,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
auto directory_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
auto tree_view_directory_context_menu = TRY(GUI::Menu::try_create("Tree View Directory"));
- auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"sv)), [&](GUI::Action const&) {
+ auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv)), [&](GUI::Action const&) {
directory_view->open_parent_directory();
});
@@ -798,7 +798,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
= GUI::Action::create(
"Open in New &Window",
{},
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)),
[&](GUI::Action const& action) {
Vector<DeprecatedString> paths;
if (action.activator() == tree_view_directory_context_menu)
@@ -817,7 +817,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
= GUI::Action::create(
"Open in &Terminal",
{},
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)),
[&](GUI::Action const& action) {
Vector<DeprecatedString> paths;
if (action.activator() == tree_view_directory_context_menu)
@@ -837,7 +837,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
= GUI::Action::create(
"Create Desktop &Shortcut",
{},
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-symlink.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-symlink.png"sv)),
[&](GUI::Action const&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty()) {
@@ -850,7 +850,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
auto create_archive_action
= GUI::Action::create(
"Create &Archive",
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-archive.png"sv)),
[&](GUI::Action const&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty())
@@ -877,7 +877,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
auto set_wallpaper_action
= GUI::Action::create(
"Set as Desktop &Wallpaper",
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
[&](GUI::Action const&) {
auto paths = directory_view->selected_file_paths();
if (paths.is_empty())
@@ -971,12 +971,12 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
});
focus_dependent_delete_action->set_enabled(false);
- auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv)), [&](GUI::Action const&) {
+ auto mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv)), [&](GUI::Action const&) {
directory_view->mkdir_action().activate();
refresh_tree_view();
});
- auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv)), [&](GUI::Action const&) {
+ auto touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv)), [&](GUI::Action const&) {
directory_view->touch_action().activate();
refresh_tree_view();
});
@@ -1031,7 +1031,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
TRY(view_menu->try_add_separator());
TRY(view_menu->try_add_action(show_dotfiles_action));
- auto go_to_location_action = GUI::Action::create("Go to &Location...", { Mod_Ctrl, Key_L }, Key_F6, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
+ auto go_to_location_action = GUI::Action::create("Go to &Location...", { Mod_Ctrl, Key_L }, Key_F6, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
toolbar_container.set_visible(true);
location_toolbar.set_visible(true);
breadcrumb_toolbar.set_visible(false);
@@ -1181,7 +1181,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|| (!directory_view->current_view().selection().is_empty() && access(directory_view->path().characters(), W_OK) == 0));
};
- auto directory_open_action = GUI::Action::create("Open", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv)), [&](auto&) {
+ auto directory_open_action = GUI::Action::create("Open", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv)), [&](auto&) {
directory_view->open(directory_view->selected_file_paths().first());
});
diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp
index ef70c30878..dd4ba1fa1e 100644
--- a/Userland/Applications/FontEditor/MainWidget.cpp
+++ b/Userland/Applications/FontEditor/MainWidget.cpp
@@ -92,7 +92,7 @@ ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window()
ErrorOr<void> MainWidget::create_actions()
{
- m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-font.png"sv)), [&](auto&) {
+ m_new_action = GUI::Action::create("&New Font...", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-font.png"sv)), [&](auto&) {
if (!request_close())
return;
auto new_font_wizard = NewFontDialog::construct(window());
@@ -175,7 +175,7 @@ ErrorOr<void> MainWidget::create_actions()
update_statusbar();
});
- m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)), [&](auto&) {
+ m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv)), [&](auto&) {
if (!m_font_preview_window) {
if (auto maybe_window = create_preview_window(); maybe_window.is_error())
show_error(maybe_window.error(), "Creating preview window failed"sv);
@@ -241,7 +241,7 @@ ErrorOr<void> MainWidget::create_actions()
m_show_system_emoji_action->set_checked(show_system_emoji);
m_show_system_emoji_action->set_status_tip("Show or hide system emoji");
- m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
+ m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) {
DeprecatedString input;
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
@@ -256,12 +256,12 @@ ErrorOr<void> MainWidget::create_actions()
});
m_go_to_glyph_action->set_status_tip("Go to the specified code point");
- m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) {
+ m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) {
m_glyph_map_widget->select_previous_existing_glyph();
});
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph");
- m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) {
+ m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) {
m_glyph_map_widget->select_next_existing_glyph();
});
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
@@ -289,12 +289,12 @@ ErrorOr<void> MainWidget::create_actions()
m_glyph_editor_scale_actions.add_action(*m_scale_fifteen_action);
m_glyph_editor_scale_actions.set_exclusive(true);
- m_paint_glyph_action = GUI::Action::create_checkable("Paint Glyph", { Mod_Ctrl, KeyCode::Key_J }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/pen.png"sv)), [&](auto&) {
+ m_paint_glyph_action = GUI::Action::create_checkable("Paint Glyph", { Mod_Ctrl, KeyCode::Key_J }, TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/pen.png"sv)), [&](auto&) {
m_glyph_editor_widget->set_mode(GlyphEditorWidget::Paint);
});
m_paint_glyph_action->set_checked(true);
- m_move_glyph_action = GUI::Action::create_checkable("Move Glyph", { Mod_Ctrl, KeyCode::Key_K }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png"sv)), [&](auto&) {
+ m_move_glyph_action = GUI::Action::create_checkable("Move Glyph", { Mod_Ctrl, KeyCode::Key_K }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/selection-move.png"sv)), [&](auto&) {
m_glyph_editor_widget->set_mode(GlyphEditorWidget::Move);
});
@@ -310,15 +310,15 @@ ErrorOr<void> MainWidget::create_actions()
m_glyph_editor_widget->rotate_90(Gfx::RotationDirection::Clockwise);
});
- m_flip_horizontal_action = GUI::Action::create("Flip Horizontally", { Mod_Ctrl | Mod_Shift, Key_Q }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)), [&](auto&) {
+ m_flip_horizontal_action = GUI::Action::create("Flip Horizontally", { Mod_Ctrl | Mod_Shift, Key_Q }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)), [&](auto&) {
m_glyph_editor_widget->flip(Gfx::Orientation::Horizontal);
});
- m_flip_vertical_action = GUI::Action::create("Flip Vertically", { Mod_Ctrl | Mod_Shift, Key_W }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)), [&](auto&) {
+ m_flip_vertical_action = GUI::Action::create("Flip Vertically", { Mod_Ctrl | Mod_Shift, Key_W }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)), [&](auto&) {
m_glyph_editor_widget->flip(Gfx::Orientation::Vertical);
});
- m_copy_text_action = GUI::Action::create("Copy as Te&xt", { Mod_Ctrl, Key_T }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) {
+ m_copy_text_action = GUI::Action::create("Copy as Te&xt", { Mod_Ctrl, Key_T }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) {
StringBuilder builder;
auto selection = m_glyph_map_widget->selection().normalized();
for (auto code_point = selection.start(); code_point < selection.start() + selection.size(); ++code_point) {
@@ -709,7 +709,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
TRY(view_menu->try_add_action(*m_show_system_emoji_action));
TRY(view_menu->try_add_separator());
auto scale_menu = TRY(view_menu->try_add_submenu("&Scale"));
- scale_menu->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/scale.png"sv)));
+ scale_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/scale.png"sv)));
TRY(scale_menu->try_add_action(*m_scale_five_action));
TRY(scale_menu->try_add_action(*m_scale_ten_action));
TRY(scale_menu->try_add_action(*m_scale_fifteen_action));
diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp
index 8f2fb0037f..65453b39e4 100644
--- a/Userland/Applications/Help/MainWidget.cpp
+++ b/Userland/Applications/Help/MainWidget.cpp
@@ -216,7 +216,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
auto help_menu = TRY(window.try_add_menu("&Help"));
String help_page_path = TRY(TRY(try_make_ref_counted<Manual::PageNode>(Manual::sections[1 - 1], TRY(String::from_utf8("Help"sv))))->path());
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window)));
- TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [this, help_page_path = move(help_page_path)](auto&) {
+ TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [this, help_page_path = move(help_page_path)](auto&) {
open_page(help_page_path);
})));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Help", TRY(GUI::Icon::try_create_default_icon("app-help"sv)), &window)));
diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp
index 49c80f2ced..906a3ad730 100644
--- a/Userland/Applications/Help/ManualModel.cpp
+++ b/Userland/Applications/Help/ManualModel.cpp
@@ -14,9 +14,9 @@
ManualModel::ManualModel()
{
- m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors());
- m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png"sv).release_value_but_fixme_should_propagate_errors());
- m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_section_open_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_section_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/book.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
}
Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const
diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp
index 5f7f8d296a..bc6f490da6 100644
--- a/Userland/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp
@@ -98,7 +98,7 @@ HexEditorWidget::HexEditorWidget()
m_editor->update();
};
- m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
+ m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
DeprecatedString value;
if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:"sv, "New file size"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
auto file_size = value.to_uint();
@@ -166,7 +166,7 @@ HexEditorWidget::HexEditorWidget()
});
m_redo_action->set_enabled(false);
- m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
auto old_buffer = m_search_buffer;
bool find_all = false;
if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecResult::OK) {
@@ -203,7 +203,7 @@ HexEditorWidget::HexEditorWidget()
}
});
- m_goto_offset_action = GUI::Action::create("&Go to Offset ...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
+ m_goto_offset_action = GUI::Action::create("&Go to Offset ...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
int new_offset;
auto result = GoToOffsetDialog::show(
window(),
@@ -226,17 +226,17 @@ HexEditorWidget::HexEditorWidget()
set_search_results_visible(action.is_checked());
});
- m_copy_hex_action = GUI::Action::create("Copy &Hex", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hex.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ m_copy_hex_action = GUI::Action::create("Copy &Hex", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/hex.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
m_editor->copy_selected_hex_to_clipboard();
});
m_copy_hex_action->set_enabled(false);
- m_copy_text_action = GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ m_copy_text_action = GUI::Action::create("Copy &Text", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
m_editor->copy_selected_text_to_clipboard();
});
m_copy_text_action->set_enabled(false);
- m_copy_as_c_code_action = GUI::Action::create("Copy as &C Code", { Mod_Alt | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/c.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ m_copy_as_c_code_action = GUI::Action::create("Copy as &C Code", { Mod_Alt | Mod_Shift, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/c.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
m_editor->copy_selected_hex_to_clipboard_as_c_code();
});
m_copy_as_c_code_action->set_enabled(false);
@@ -412,7 +412,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window)
edit_menu.add_action(*m_copy_as_c_code_action);
edit_menu.add_separator();
edit_menu.add_action(*m_find_action);
- edit_menu.add_action(GUI::Action::create("Find &Next", { Mod_None, Key_F3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ edit_menu.add_action(GUI::Action::create("Find &Next", { Mod_None, Key_F3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
if (m_search_text.is_empty() || m_search_buffer.is_empty()) {
GUI::MessageBox::show(&window, "Nothing to search for"sv, "Not found"sv, GUI::MessageBox::Type::Warning);
return;
@@ -427,7 +427,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window)
m_last_found_index = result.value();
}));
- edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
int min_length = 4;
auto matches = m_editor->find_all_strings(min_length);
m_search_results->set_model(*new SearchResultsModel(move(matches)));
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index 0e914e144c..baec115700 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -157,17 +157,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
widget->rotate(Gfx::RotationDirection::Clockwise);
});
- auto vertical_flip_action = GUI::Action::create("Flip &Vertically", { Mod_None, Key_V }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)),
+ auto vertical_flip_action = GUI::Action::create("Flip &Vertically", { Mod_None, Key_V }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)),
[&](auto&) {
widget->flip(Gfx::Orientation::Vertical);
});
- auto horizontal_flip_action = GUI::Action::create("Flip &Horizontally", { Mod_None, Key_H }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)),
+ auto horizontal_flip_action = GUI::Action::create("Flip &Horizontally", { Mod_None, Key_H }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv)),
[&](auto&) {
widget->flip(Gfx::Orientation::Horizontal);
});
- auto desktop_wallpaper_action = GUI::Action::create("Set as Desktop &Wallpaper", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
+ auto desktop_wallpaper_action = GUI::Action::create("Set as Desktop &Wallpaper", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"sv)),
[&](auto&) {
if (!GUI::Desktop::the().set_wallpaper(widget->bitmap(), widget->path())) {
GUI::MessageBox::show(window,
@@ -177,22 +177,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
});
- auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-first.png"sv)),
+ auto go_first_action = GUI::Action::create("&Go to First", { Mod_None, Key_Home }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-first.png"sv)),
[&](auto&) {
widget->navigate(ViewWidget::Directions::First);
});
- auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)),
+ auto go_back_action = GUI::Action::create("Go &Back", { Mod_None, Key_Left }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv)),
[&](auto&) {
widget->navigate(ViewWidget::Directions::Back);
});
- auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)),
+ auto go_forward_action = GUI::Action::create("Go &Forward", { Mod_None, Key_Right }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)),
[&](auto&) {
widget->navigate(ViewWidget::Directions::Forward);
});
- auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv)),
+ auto go_last_action = GUI::Action::create("Go to &Last", { Mod_None, Key_End }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-last.png"sv)),
[&](auto&) {
widget->navigate(ViewWidget::Directions::Last);
});
@@ -215,7 +215,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window);
auto fit_image_to_view_action = GUI::Action::create(
- "Fit Image To &View", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fit-image-to-view.png"sv)), [&](auto&) {
+ "Fit Image To &View", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/fit-image-to-view.png"sv)), [&](auto&) {
widget->fit_content_to_view();
});
@@ -314,7 +314,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_separator());
auto scaling_mode_menu = TRY(view_menu->try_add_submenu("&Scaling Mode"));
- scaling_mode_menu->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/scale.png"sv)));
+ scaling_mode_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/scale.png"sv)));
auto scaling_mode_group = make<GUI::ActionGroup>();
scaling_mode_group->set_exclusive(true);
diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp
index b65dbaa53b..5cceafd8a7 100644
--- a/Userland/Applications/Magnifier/main.cpp
+++ b/Userland/Applications/Magnifier/main.cpp
@@ -155,13 +155,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto timeline_menu = TRY(window->try_add_menu("&Timeline"));
auto previous_frame_action = GUI::Action::create(
- "&Previous frame", { Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) {
+ "&Previous frame", { Key_Left }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv)), [&](auto&) {
pause_action->set_checked(true);
magnifier->pause_capture(true);
magnifier->display_previous_frame();
});
auto next_frame_action = GUI::Action::create(
- "&Next frame", { Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) {
+ "&Next frame", { Key_Right }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](auto&) {
pause_action->set_checked(true);
magnifier->pause_capture(true);
magnifier->display_next_frame();
diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp
index d432b10ce5..44b16b6ea2 100644
--- a/Userland/Applications/Mail/MailboxTreeModel.cpp
+++ b/Userland/Applications/Mail/MailboxTreeModel.cpp
@@ -11,9 +11,9 @@
MailboxTreeModel::MailboxTreeModel(AccountHolder const& account_holder)
: m_account_holder(account_holder)
{
- m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mail.png"sv).release_value_but_fixme_should_propagate_errors());
- m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors());
- m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/home-directory.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_mail_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-mail.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_folder_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_account_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/home-directory.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex MailboxTreeModel::index(int row, int column, GUI::ModelIndex const& parent) const
diff --git a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp
index 73fa86d754..69d45e258b 100644
--- a/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp
+++ b/Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp
@@ -24,7 +24,7 @@ void DoubleClickArrowWidget::set_double_click_speed(int speed)
DoubleClickArrowWidget::DoubleClickArrowWidget()
{
- m_arrow_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/double-click-down-arrow.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_arrow_bitmap = Gfx::Bitmap::load_from_file("/res/graphics/double-click-down-arrow.png"sv).release_value_but_fixme_should_propagate_errors();
}
void DoubleClickArrowWidget::paint_event(GUI::PaintEvent& event)
diff --git a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp
index 7699d29725..f51142d333 100644
--- a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp
+++ b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp
@@ -25,10 +25,10 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini");
auto cursor_theme_config = TRY(Core::ConfigFile::open(theme_path));
auto load_bitmap = [](StringView path, StringView default_path) {
- auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path);
+ auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
if (!maybe_bitmap.is_error())
return maybe_bitmap;
- return Gfx::Bitmap::try_load_from_file(default_path);
+ return Gfx::Bitmap::load_from_file(default_path);
};
constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv;
auto cursor_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}",
diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp
index 3ac7a93153..4309ae2fa3 100644
--- a/Userland/Applications/MouseSettings/ThemeWidget.cpp
+++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp
@@ -64,7 +64,7 @@ void MouseCursorModel::invalidate()
cursor.name = LexicalPath::basename(cursor.path);
// FIXME: Animated cursor bitmaps
- auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path).release_value_but_fixme_should_propagate_errors();
+ auto cursor_bitmap = Gfx::Bitmap::load_from_file(cursor.path).release_value_but_fixme_should_propagate_errors();
auto cursor_bitmap_rect = cursor_bitmap->rect();
cursor.params = Gfx::CursorParams::parse_from_filename(cursor.name, cursor_bitmap_rect.center()).constrained(*cursor_bitmap);
cursor.bitmap = cursor_bitmap->cropped(Gfx::IntRect(Gfx::FloatRect(cursor_bitmap_rect).scaled(1.0 / cursor.params.frames(), 1.0))).release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp
index 27f5b99b30..2884aae681 100644
--- a/Userland/Applications/PDFViewer/OutlineModel.cpp
+++ b/Userland/Applications/PDFViewer/OutlineModel.cpp
@@ -21,8 +21,8 @@ enum Columns {
ErrorOr<NonnullRefPtr<OutlineModel>> OutlineModel::create(NonnullRefPtr<PDF::OutlineDict> const& outline)
{
auto outline_model = adopt_ref(*new OutlineModel(outline));
- outline_model->m_closed_item_icon.set_bitmap_for_size(16, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png"sv)));
- outline_model->m_open_item_icon.set_bitmap_for_size(16, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv)));
+ outline_model->m_closed_item_icon.set_bitmap_for_size(16, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/book.png"sv)));
+ outline_model->m_open_item_icon.set_bitmap_for_size(16, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/book-open.png"sv)));
return outline_model;
}
diff --git a/Userland/Applications/PDFViewer/PDFViewer.cpp b/Userland/Applications/PDFViewer/PDFViewer.cpp
index 746442f386..ae3cc54b3e 100644
--- a/Userland/Applications/PDFViewer/PDFViewer.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewer.cpp
@@ -317,7 +317,7 @@ PDF::PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> PDFViewer::render_page(u32 page_inde
{
auto page = TRY(m_document->get_page(page_index));
auto& page_size = m_page_dimension_cache.render_info[page_index].size;
- auto bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, page_size.to_type<int>()));
+ auto bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, page_size.to_type<int>()));
auto maybe_errors = PDF::Renderer::render(*m_document, page, bitmap, m_rendering_preferences);
if (maybe_errors.is_error()) {
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index d0e5063341..990995856e 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -239,7 +239,7 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window)
void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
{
auto open_outline_action = GUI::Action::create(
- "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/sidebar.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_sidebar_open = !m_sidebar_open;
m_sidebar->set_visible(m_sidebar_open);
},
@@ -250,13 +250,13 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
toolbar.add_action(*open_outline_action);
toolbar.add_separator();
- m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-up.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::load_from_file("/res/icons/16x16/go-up.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
VERIFY(m_viewer->current_page() > 0);
m_page_text_box->set_current_number(m_viewer->current_page());
});
m_go_to_prev_page_action->set_enabled(false);
- m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-down.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::load_from_file("/res/icons/16x16/go-down.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
VERIFY(m_viewer->current_page() < m_viewer->document()->get_page_count() - 1);
m_page_text_box->set_current_number(m_viewer->current_page() + 2);
});
diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp
index be60e544d9..3a8a0a8505 100644
--- a/Userland/Applications/Piano/MainWidget.cpp
+++ b/Userland/Applications/Piano/MainWidget.cpp
@@ -55,11 +55,11 @@ MainWidget::MainWidget(TrackManager& track_manager, AudioPlayerLoop& loop)
void MainWidget::add_track_actions(GUI::Menu& menu)
{
- menu.add_action(GUI::Action::create("&Add Track", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ menu.add_action(GUI::Action::create("&Add Track", { Mod_Ctrl, Key_T }, Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_player_widget->add_track();
}));
- menu.add_action(GUI::Action::create("&Next Track", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ menu.add_action(GUI::Action::create("&Next Track", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
turn_off_pressed_keys();
m_player_widget->next_track();
turn_on_pressed_keys();
diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp
index 36409a0be8..656c067a22 100644
--- a/Userland/Applications/Piano/PlayerWidget.cpp
+++ b/Userland/Applications/Piano/PlayerWidget.cpp
@@ -24,12 +24,12 @@ PlayerWidget::PlayerWidget(TrackManager& manager, AudioPlayerLoop& loop)
set_fill_with_background_color(true);
m_track_number_choices.append("1");
- m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors();
- m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors();
- m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(); // Go back a note
- m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(); // Advance a note
- m_add_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors();
- m_next_track_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_play_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_pause_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_back_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(); // Go back a note
+ m_next_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(); // Advance a note
+ m_add_track_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_next_track_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-last.png"sv).release_value_but_fixme_should_propagate_errors();
RefPtr<GUI::Label> label = add<GUI::Label>("Track");
label->set_max_width(75);
diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp
index 25043abe66..91eabadb8b 100644
--- a/Userland/Applications/Piano/RollWidget.cpp
+++ b/Userland/Applications/Piano/RollWidget.cpp
@@ -70,7 +70,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
// Draw the background, if necessary.
if (viewport_changed() || paint_area != m_background->height()) {
- m_background = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(m_roll_width, paint_area)).release_value_but_fixme_should_propagate_errors();
+ m_background = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(m_roll_width, paint_area)).release_value_but_fixme_should_propagate_errors();
Gfx::Painter background_painter(*m_background);
background_painter.translate(frame_thickness(), frame_thickness());
diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp
index f4d3c426ff..26ac5fdb6c 100644
--- a/Userland/Applications/Piano/SamplerWidget.cpp
+++ b/Userland/Applications/Piano/SamplerWidget.cpp
@@ -53,7 +53,7 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager)
m_open_button = m_open_button_and_recorded_sample_name_container->add<GUI::Button>();
m_open_button->set_fixed_size(24, 24);
m_open_button->set_focus_policy(GUI::FocusPolicy::TabFocus);
- m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_open_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
m_open_button->on_click = [this](auto) {
Optional<DeprecatedString> open_path = GUI::FilePicker::get_open_filepath(window());
if (!open_path.has_value())
diff --git a/Userland/Applications/Piano/main.cpp b/Userland/Applications/Piano/main.cpp
index 1b72d7c78e..f6049ab223 100644
--- a/Userland/Applications/Piano/main.cpp
+++ b/Userland/Applications/Piano/main.cpp
@@ -54,7 +54,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
main_widget_updater->start();
auto& file_menu = window->add_menu("&File");
- file_menu.add_action(GUI::Action::create("Export", { Mod_Ctrl, Key_E }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png"sv)), [&](const GUI::Action&) {
+ file_menu.add_action(GUI::Action::create("Export", { Mod_Ctrl, Key_E }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/file-export.png"sv)), [&](const GUI::Action&) {
save_path = GUI::FilePicker::get_save_filepath(window, "Untitled", "wav");
if (!save_path.has_value())
return;
diff --git a/Userland/Applications/PixelPaint/FilterTreeModel.cpp b/Userland/Applications/PixelPaint/FilterTreeModel.cpp
index d22bc1a880..056b6c1e0d 100644
--- a/Userland/Applications/PixelPaint/FilterTreeModel.cpp
+++ b/Userland/Applications/PixelPaint/FilterTreeModel.cpp
@@ -28,7 +28,7 @@ namespace PixelPaint {
ErrorOr<NonnullRefPtr<GUI::TreeViewModel>> create_filter_tree_model(ImageEditor* editor)
{
auto directory_icon = GUI::FileIconProvider::directory_icon();
- auto filter_icon = GUI::Icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv)));
+ auto filter_icon = GUI::Icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/filter.png"sv)));
auto filter_tree_model = GUI::TreeViewModel::create();
diff --git a/Userland/Applications/PixelPaint/IconBag.cpp b/Userland/Applications/PixelPaint/IconBag.cpp
index 2393979915..1d17cf90fd 100644
--- a/Userland/Applications/PixelPaint/IconBag.cpp
+++ b/Userland/Applications/PixelPaint/IconBag.cpp
@@ -12,40 +12,40 @@ ErrorOr<IconBag> IconBag::try_create()
{
IconBag icon_bag;
- icon_bag.filetype_pixelpaint = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-pixelpaint.png"sv));
- icon_bag.new_clipboard = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/new-clipboard.png"sv));
- icon_bag.file_export = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/file-export.png"sv));
- icon_bag.close_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"sv));
- icon_bag.edit_copy = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv));
- icon_bag.clear_selection = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/clear-selection.png"sv));
- icon_bag.invert_selection = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/invert-selection.png"sv));
- icon_bag.swap_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/swap-colors.png"sv));
- icon_bag.default_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/default-colors.png"sv));
- icon_bag.load_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/load-color-palette.png"sv));
- icon_bag.save_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/save-color-palette.png"sv));
- icon_bag.fit_image_to_view = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fit-image-to-view.png"sv));
- icon_bag.add_guide = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-guide.png"sv));
- icon_bag.clear_guides = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/clear-guides.png"sv));
- icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv));
- icon_bag.edit_flip_horizontal = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv));
- icon_bag.resize_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png"sv));
- icon_bag.crop = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/crop.png"sv));
- icon_bag.new_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-layer.png"sv));
- icon_bag.previous_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/previous-layer.png"sv));
- icon_bag.next_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/next-layer.png"sv));
- icon_bag.top_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/top-layer.png"sv));
- icon_bag.bottom_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bottom-layer.png"sv));
- icon_bag.active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-up.png"sv));
- icon_bag.active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-down.png"sv));
- icon_bag.delete_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv));
- icon_bag.flatten_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/flatten-image.png"sv));
- icon_bag.merge_visible = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-visible.png"sv));
- icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png"sv));
- icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png"sv));
- icon_bag.filter = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv));
- icon_bag.generic_5x5_convolution = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/generic-5x5-convolution.png"sv));
- icon_bag.levels = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/levels.png"sv));
- icon_bag.add_mask = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-mask.png"sv));
+ icon_bag.filetype_pixelpaint = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-pixelpaint.png"sv));
+ icon_bag.new_clipboard = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/new-clipboard.png"sv));
+ icon_bag.file_export = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/file-export.png"sv));
+ icon_bag.close_image = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv));
+ icon_bag.edit_copy = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv));
+ icon_bag.clear_selection = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/clear-selection.png"sv));
+ icon_bag.invert_selection = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/invert-selection.png"sv));
+ icon_bag.swap_colors = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/swap-colors.png"sv));
+ icon_bag.default_colors = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/default-colors.png"sv));
+ icon_bag.load_color_palette = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/load-color-palette.png"sv));
+ icon_bag.save_color_palette = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/save-color-palette.png"sv));
+ icon_bag.fit_image_to_view = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/fit-image-to-view.png"sv));
+ icon_bag.add_guide = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/add-guide.png"sv));
+ icon_bag.clear_guides = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/clear-guides.png"sv));
+ icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv));
+ icon_bag.edit_flip_horizontal = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-flip-horizontal.png"sv));
+ icon_bag.resize_image = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/selection-move.png"sv));
+ icon_bag.crop = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/crop.png"sv));
+ icon_bag.new_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new-layer.png"sv));
+ icon_bag.previous_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/previous-layer.png"sv));
+ icon_bag.next_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/next-layer.png"sv));
+ icon_bag.top_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/top-layer.png"sv));
+ icon_bag.bottom_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/bottom-layer.png"sv));
+ icon_bag.active_layer_up = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/active-layer-up.png"sv));
+ icon_bag.active_layer_down = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/active-layer-down.png"sv));
+ icon_bag.delete_layer = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv));
+ icon_bag.flatten_image = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/flatten-image.png"sv));
+ icon_bag.merge_visible = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/merge-visible.png"sv));
+ icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png"sv));
+ icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png"sv));
+ icon_bag.filter = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/filter.png"sv));
+ icon_bag.generic_5x5_convolution = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/generic-5x5-convolution.png"sv));
+ icon_bag.levels = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/levels.png"sv));
+ icon_bag.add_mask = TRY(Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/add-mask.png"sv));
return icon_bag;
}
diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp
index c8e27caa07..004c1d938a 100644
--- a/Userland/Applications/PixelPaint/Image.cpp
+++ b/Userland/Applications/PixelPaint/Image.cpp
@@ -147,7 +147,7 @@ ErrorOr<void> Image::serialize_as_json(JsonObjectSerializer<StringBuilder>& json
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Image::try_compose_bitmap(Gfx::BitmapFormat format) const
{
- auto bitmap = TRY(Gfx::Bitmap::try_create(format, m_size));
+ auto bitmap = TRY(Gfx::Bitmap::create(format, m_size));
GUI::Painter painter(bitmap);
paint_into(painter, { 0, 0, m_size.width(), m_size.height() });
return bitmap;
diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp
index e7535bff92..1b2b73707d 100644
--- a/Userland/Applications/PixelPaint/Layer.cpp
+++ b/Userland/Applications/PixelPaint/Layer.cpp
@@ -23,7 +23,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_size(Image& image, Gfx::Int
if (size.width() > 16384 || size.height() > 16384)
return Error::from_string_literal("Layer size too large");
- auto bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size));
+ auto bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size));
return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, move(bitmap), move(name)));
}
@@ -134,7 +134,7 @@ RefPtr<Gfx::Bitmap> Layer::try_copy_bitmap(Selection const& selection) const
}
auto selection_rect = selection.bounding_rect();
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, selection_rect.size());
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, selection_rect.size());
if (bitmap_or_error.is_error())
return nullptr;
auto result = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
@@ -238,7 +238,7 @@ ErrorOr<void> Layer::resize(Gfx::IntSize new_size, Gfx::IntPoint new_location, G
auto src_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), size());
auto dst_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), new_size);
- auto resized_content_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, new_size));
+ auto resized_content_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, new_size));
{
Gfx::Painter painter(resized_content_bitmap);
@@ -250,7 +250,7 @@ ErrorOr<void> Layer::resize(Gfx::IntSize new_size, Gfx::IntPoint new_location, G
}
if (m_mask_bitmap) {
- auto dst = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, new_size));
+ auto dst = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, new_size));
Gfx::Painter painter(dst);
if (scaling_mode == Gfx::Painter::ScalingMode::None) {
@@ -290,7 +290,7 @@ void Layer::update_cached_bitmap()
}
if (m_cached_display_bitmap.ptr() == m_content_bitmap.ptr() || m_cached_display_bitmap->size() != size()) {
- m_cached_display_bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size()));
+ m_cached_display_bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size()));
}
// FIXME: This can probably be done nicer
@@ -307,7 +307,7 @@ void Layer::update_cached_bitmap()
void Layer::create_mask()
{
- m_mask_bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size()));
+ m_mask_bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size()));
m_mask_bitmap->fill(Gfx::Color::White);
update_cached_bitmap();
}
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp
index a9f8420989..bcdb856732 100644
--- a/Userland/Applications/PixelPaint/MainWidget.cpp
+++ b/Userland/Applications/PixelPaint/MainWidget.cpp
@@ -611,7 +611,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
}));
m_image_menu->add_separator();
- m_image_menu->add_action(GUI::Action::create("Rotate Image &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv)),
+ m_image_menu->add_action(GUI::Action::create("Rotate Image &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv)),
[&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
@@ -623,7 +623,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
editor->did_complete_action("Rotate Image Counterclockwise"sv);
}));
- m_image_menu->add_action(GUI::Action::create("Rotate Image Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv)),
+ m_image_menu->add_action(GUI::Action::create("Rotate Image Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv)),
[&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
@@ -910,7 +910,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
}));
m_layer_menu->add_separator();
- m_layer_menu->add_action(GUI::Action::create("Rotate Layer &Counterclockwise", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv)),
+ m_layer_menu->add_action(GUI::Action::create("Rotate Layer &Counterclockwise", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv)),
[&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
@@ -925,7 +925,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
editor->did_complete_action("Rotate Layer Counterclockwise"sv);
}));
- m_layer_menu->add_action(GUI::Action::create("Rotate Layer Clock&wise", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv)),
+ m_layer_menu->add_action(GUI::Action::create("Rotate Layer Clock&wise", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv)),
[&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
index c2e4e8defd..f116871d60 100644
--- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp
+++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
@@ -55,7 +55,7 @@ ToolboxWidget::ToolboxWidget()
void ToolboxWidget::setup_tools()
{
auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool, bool is_default_tool = false) {
- auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
+ auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
[this, tool = tool.ptr()](auto& action) {
if (action.is_checked()) {
on_tool_selection(tool);
diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
index a1337f36d8..4c4ced3b6f 100644
--- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
@@ -189,7 +189,7 @@ NonnullRefPtr<Gfx::Bitmap> BrushTool::build_cursor()
m_scale_last_created_cursor = m_editor ? m_editor->scale() : 1;
auto scaled_size = size() * m_scale_last_created_cursor;
auto containing_box_size = 2 * scaled_size;
- NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(containing_box_size, containing_box_size)).release_value_but_fixme_should_propagate_errors();
+ NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(containing_box_size, containing_box_size)).release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter { new_cursor };
Gfx::AntiAliasingPainter aa_painter { painter };
diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
index b48480004c..0d0c42ff8d 100644
--- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
@@ -24,7 +24,7 @@ namespace PixelPaint {
BucketTool::BucketTool()
{
- m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_cursor = Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
}
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint start_position, Color fill_color, int threshold)
diff --git a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp
index 6f3ad00a75..faf0c65327 100644
--- a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp
@@ -144,7 +144,7 @@ NonnullRefPtr<Gfx::Bitmap> EraseTool::build_cursor()
m_scale_last_created_cursor = m_editor ? m_editor->scale() : 1;
int scaled_size = size() * m_scale_last_created_cursor;
- NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(scaled_size, scaled_size)).release_value_but_fixme_should_propagate_errors();
+ NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(scaled_size, scaled_size)).release_value_but_fixme_should_propagate_errors();
Gfx::IntRect rect { 0, 0, scaled_size, scaled_size };
Gfx::Painter painter { new_cursor };
diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp
index 0bf61aaa9d..1b1eb3bc0c 100644
--- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp
@@ -135,7 +135,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
if (!m_context_menu) {
m_context_menu = GUI::Menu::construct();
m_context_menu->add_action(GUI::Action::create(
- "Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "Set &Offset", Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (!m_context_menu_guide)
return;
auto dialog = EditGuideDialog::construct(
@@ -153,7 +153,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
},
editor()));
m_context_menu->add_action(GUI::Action::create(
- "&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "&Delete Guide", Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (!m_context_menu_guide)
return;
editor()->remove_guide(*m_context_menu_guide);
diff --git a/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp
index bd26d086a9..a30efbfcb1 100644
--- a/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp
@@ -28,7 +28,7 @@ void LassoSelectTool::on_mousedown(Layer* layer, MouseEvent& event)
if (!layer->rect().contains(layer_event.position()))
return;
- auto selection_bitmap_result = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, layer->content_bitmap().size());
+ auto selection_bitmap_result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, layer->content_bitmap().size());
if (selection_bitmap_result.is_error())
return;
@@ -99,7 +99,7 @@ void LassoSelectTool::on_mouseup(Layer*, MouseEvent&)
auto cropped_selection = cropped_selection_result.release_value();
// We create a bitmap that is bigger by 1 pixel on each side
- auto lasso_bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (m_bottom_right.x() - m_top_left.x()) + 2, (m_bottom_right.y() - m_top_left.y()) + 2 });
+ auto lasso_bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (m_bottom_right.x() - m_top_left.x()) + 2, (m_bottom_right.y() - m_top_left.y()) + 2 });
if (lasso_bitmap_or_error.is_error())
return;
diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp
index d2b46a8388..086eab9e13 100644
--- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp
@@ -207,7 +207,7 @@ ErrorOr<void> MoveTool::update_cached_preview_bitmap(Layer const* layer)
auto const& source_bitmap = layer->content_bitmap();
auto preview_bitmap_size = editor_rect_size.contains(source_bitmap.size()) ? source_bitmap.size() : editor_rect_size;
- m_cached_preview_bitmap = TRY(Gfx::Bitmap::try_create(source_bitmap.format(), preview_bitmap_size));
+ m_cached_preview_bitmap = TRY(Gfx::Bitmap::create(source_bitmap.format(), preview_bitmap_size));
GUI::Painter preview_painter(*m_cached_preview_bitmap);
preview_painter.draw_scaled_bitmap(m_cached_preview_bitmap->rect(), source_bitmap, source_bitmap.rect(), 0.8f, Gfx::Painter::ScalingMode::BilinearBlend);
Gfx::ContrastFilter preview_filter(0.5f);
diff --git a/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp
index 218d54322e..998b74fadf 100644
--- a/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp
@@ -57,7 +57,7 @@ void PolygonalSelectTool::process_polygon()
// We create a bitmap that is bigger by 1 pixel on each side (+2) and need to account for the 0 indexed
// pixel positions (+1) so we make the bitmap size the delta of x/y min/max + 3.
- auto polygon_bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (max_x_seen - min_x_seen) + 3, (max_y_seen - min_y_seen) + 3 });
+ auto polygon_bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (max_x_seen - min_x_seen) + 3, (max_y_seen - min_y_seen) + 3 });
if (polygon_bitmap_or_error.is_error())
return;
diff --git a/Userland/Applications/PixelPaint/Tools/TextTool.cpp b/Userland/Applications/PixelPaint/Tools/TextTool.cpp
index f825ce224a..115cc6b66d 100644
--- a/Userland/Applications/PixelPaint/Tools/TextTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/TextTool.cpp
@@ -134,7 +134,7 @@ void TextTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
// Since ImageEditor can be zoomed in/out, we need to be able to render the preview properly scaled
// GUI::Painter doesn't have a way to draw a font scaled directly, so we draw the text to a bitmap
// and then scale the bitmap and blit the result to the ImageEditor.
- auto text_bitmap_result = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { text_width, text_height });
+ auto text_bitmap_result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { text_width, text_height });
if (text_bitmap_result.is_error())
return;
auto text_bitmap = text_bitmap_result.release_value();
diff --git a/Userland/Applications/PixelPaint/VectorscopeWidget.cpp b/Userland/Applications/PixelPaint/VectorscopeWidget.cpp
index d3b2cd32c7..d5263ec803 100644
--- a/Userland/Applications/PixelPaint/VectorscopeWidget.cpp
+++ b/Userland/Applications/PixelPaint/VectorscopeWidget.cpp
@@ -60,7 +60,7 @@ ErrorOr<void> VectorscopeWidget::rebuild_vectorscope_data()
void VectorscopeWidget::rebuild_vectorscope_image()
{
- m_vectorscope_image = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size()));
+ m_vectorscope_image = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size()));
m_vectorscope_image->fill(Color::Transparent);
Gfx::Painter base_painter(*m_vectorscope_image);
diff --git a/Userland/Applications/Presenter/PresenterWidget.cpp b/Userland/Applications/Presenter/PresenterWidget.cpp
index 7bf8752f1f..c9cf6e5fc6 100644
--- a/Userland/Applications/Presenter/PresenterWidget.cpp
+++ b/Userland/Applications/Presenter/PresenterWidget.cpp
@@ -69,24 +69,24 @@ ErrorOr<void> PresenterWidget::initialize_menubar()
})));
auto presentation_menu = TRY(window->try_add_menu("&Presentation"));
- m_next_slide_action = GUI::Action::create("&Next", { KeyCode::Key_Right }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [this](auto&) {
+ m_next_slide_action = GUI::Action::create("&Next", { KeyCode::Key_Right }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)), [this](auto&) {
if (m_current_presentation) {
m_current_presentation->next_frame();
update_web_view();
update_slides_actions();
}
});
- m_previous_slide_action = GUI::Action::create("&Previous", { KeyCode::Key_Left }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv)), [this](auto&) {
+ m_previous_slide_action = GUI::Action::create("&Previous", { KeyCode::Key_Left }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv)), [this](auto&) {
if (m_current_presentation) {
m_current_presentation->previous_frame();
update_web_view();
update_slides_actions();
}
});
- m_full_screen_action = GUI::Action::create("&Full Screen", { KeyModifier::Mod_Shift, KeyCode::Key_F5 }, { KeyCode::Key_F11 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fullscreen.png"sv)), [this](auto&) {
+ m_full_screen_action = GUI::Action::create("&Full Screen", { KeyModifier::Mod_Shift, KeyCode::Key_F5 }, { KeyCode::Key_F11 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/fullscreen.png"sv)), [this](auto&) {
this->window()->set_fullscreen(true);
});
- m_present_from_first_slide_action = GUI::Action::create("Present From First &Slide", { KeyCode::Key_F5 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv)), [this](auto&) {
+ m_present_from_first_slide_action = GUI::Action::create("Present From First &Slide", { KeyCode::Key_F5 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv)), [this](auto&) {
if (m_current_presentation) {
m_current_presentation->go_to_first_slide();
update_web_view();
diff --git a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
index 152fa32b67..8d3cdbb693 100644
--- a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
+++ b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
@@ -36,7 +36,7 @@ void AlbumCoverVisualizationWidget::paint_event(GUI::PaintEvent& event)
painter.draw_scaled_bitmap(fitted_rect, *cover, cover->rect(), 1.0f);
} else {
if (!m_serenity_bg)
- m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_serenity_bg = Gfx::Bitmap::load_from_file("/res/wallpapers/sunset-retro.png"sv).release_value_but_fixme_should_propagate_errors();
painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f);
}
}
@@ -49,7 +49,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> AlbumCoverVisualizationWidget::get_album_cov
for (auto& it : possible_cover_filenames) {
LexicalPath cover_path = LexicalPath::join(directory, it);
if (Core::File::exists(cover_path.string()))
- return Gfx::Bitmap::try_load_from_file(cover_path.string());
+ return Gfx::Bitmap::load_from_file(cover_path.string());
}
return Error::from_string_literal("No cover file found");
diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
index 4850544eaf..8e26933c5e 100644
--- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
+++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
@@ -42,11 +42,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window
m_player_view->set_layout<GUI::VerticalBoxLayout>();
- m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors();
- m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors();
- m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png"sv).release_value_but_fixme_should_propagate_errors();
- m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors();
- m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_play_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_pause_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_stop_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_back_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_next_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors();
m_visualization = m_player_view->add<BarsVisualizationWidget>();
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index 4ed24cdb7d..9c2213849a 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -189,7 +189,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action(APP_NAME, app_icon, window));
- auto open_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv));
+ auto open_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv));
// Configure the nodes context menu.
auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, open_icon, [&](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme(get_absolute_path_to_selected_node(treemapwidget)));
@@ -199,7 +199,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
});
- auto copy_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv));
+ auto copy_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv));
auto copy_path_action = GUI::Action::create("Copy Path to Clipboard", { Mod_Ctrl, Key_C }, copy_icon, [&](auto&) {
GUI::Clipboard::the().set_plain_text(get_absolute_path_to_selected_node(treemapwidget));
});
diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp
index 6b5dfe3a3d..6a96765c94 100644
--- a/Userland/Applications/Spreadsheet/HelpWindow.cpp
+++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp
@@ -65,7 +65,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
{
resize(530, 365);
set_title("Spreadsheet Functions Help");
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->set_layout<GUI::VerticalBoxLayout>();
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
index c69a732a1c..d9800ee320 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
@@ -45,7 +45,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
current_cell_label.set_fixed_width(50);
auto& help_button = top_bar.add<GUI::Button>("");
- help_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors());
+ help_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors());
help_button.set_tooltip("Functions Help");
help_button.set_fixed_size(20, 20);
help_button.on_click = [&](auto) {
@@ -108,7 +108,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
}
});
m_tab_context_menu->add_action(*m_rename_action);
- m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
DeprecatedString name;
if (GUI::InputBox::show(window(), name, "Name for new sheet"sv, "Create sheet"sv) == GUI::Dialog::ExecResult::OK) {
NonnullRefPtrVector<Sheet> new_sheets;
@@ -119,7 +119,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
setup_tabs(m_workbook->sheets());
- m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
add_sheet();
});
@@ -252,13 +252,13 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
m_redo_action->set_enabled(false);
m_change_background_color_action = GUI::Action::create(
- "&Change Background Color", { Mod_Ctrl, Key_B }, Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ "&Change Background Color", { Mod_Ctrl, Key_B }, Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
change_cell_static_color_format(Spreadsheet::FormatType::Background);
},
window());
m_change_foreground_color_action = GUI::Action::create(
- "&Change Foreground Color", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/text-color.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ "&Change Foreground Color", { Mod_Ctrl, Key_T }, Gfx::Bitmap::load_from_file("/res/icons/16x16/text-color.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
change_cell_static_color_format(Spreadsheet::FormatType::Foreground);
},
window());
@@ -267,7 +267,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
m_change_foreground_color_action->set_enabled(false);
m_functions_help_action = GUI::Action::create(
- "&Functions Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ "&Functions Help", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
if (auto* worksheet_ptr = current_worksheet_if_available()) {
auto docs = worksheet_ptr->gather_documentation();
auto help_window = Spreadsheet::HelpWindow::the(window());
diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index 5d9ff30240..9d2adf3ad2 100644
--- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -26,10 +26,10 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
layout()->set_margins(4);
set_fill_with_background_color(true);
- m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors();
- m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_network_connected_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_network_disconnected_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/network-disconnected.png"sv).release_value_but_fixme_should_propagate_errors();
- m_network_link_down_bitmap = Gfx::Bitmap::try_create(m_network_connected_bitmap->format(), m_network_connected_bitmap->size()).release_value_but_fixme_should_propagate_errors();
+ m_network_link_down_bitmap = Gfx::Bitmap::create(m_network_connected_bitmap->format(), m_network_connected_bitmap->size()).release_value_but_fixme_should_propagate_errors();
{
Gfx::Painter painter(*m_network_link_down_bitmap);
painter.blit_filtered(Gfx::IntPoint {}, *m_network_connected_bitmap, m_network_connected_bitmap->rect(), [](Color color) {
@@ -75,7 +75,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
m_adapter_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_adapter_model)));
m_adapter_context_menu = MUST(GUI::Menu::try_create());
m_adapter_context_menu->add_action(GUI::Action::create(
- "Open in Network Settings...", MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network.png"sv)), [this](GUI::Action&) {
+ "Open in Network Settings...", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/network.png"sv)), [this](GUI::Action&) {
m_adapter_table_view->selection().for_each_index([this](GUI::ModelIndex const& index) {
auto adapter_name = index.sibling_at_column(1).data().as_string();
GUI::Process::spawn_or_show_error(window(), "/bin/Escalator"sv, Array { "/bin/NetworkSettings", adapter_name.characters() });
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index bbd0545d6b..f08193c628 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -345,7 +345,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto kill_action = GUI::Action::create(
- "&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png"sv)), [&](const GUI::Action&) {
+ "&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/kill.png"sv)), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
@@ -356,7 +356,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
&process_table_view);
auto stop_action = GUI::Action::create(
- "&Stop Process", { Mod_Ctrl, Key_S }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png"sv)), [&](const GUI::Action&) {
+ "&Stop Process", { Mod_Ctrl, Key_S }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/stop-hand.png"sv)), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
@@ -367,7 +367,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
&process_table_view);
auto continue_action = GUI::Action::create(
- "&Continue Process", { Mod_Ctrl, Key_C }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png"sv)), [&](const GUI::Action&) {
+ "&Continue Process", { Mod_Ctrl, Key_C }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/continue.png"sv)), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGCONT);
@@ -376,7 +376,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto profile_action = GUI::Action::create(
"&Profile Process", { Mod_Ctrl, Key_P },
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv)), [&](auto&) {
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv)), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp
index 429a8380b7..775f69cafd 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -190,10 +190,10 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
find_textbox->set_text(terminal.selected_text().replace("\n"sv, " "sv, ReplaceMode::All));
auto find_backwards = TRY(find->try_add<GUI::Button>());
find_backwards->set_fixed_width(25);
- find_backwards->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv)));
+ find_backwards->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv)));
auto find_forwards = TRY(find->try_add<GUI::Button>());
find_forwards->set_fixed_width(25);
- find_forwards->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv)));
+ find_forwards->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv)));
find_textbox->on_return_pressed = [find_backwards] {
find_backwards->click();
@@ -335,7 +335,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto show_scroll_bar = Config::read_bool("Terminal"sv, "Terminal"sv, "ShowScrollBar"sv, true);
terminal->set_show_scrollbar(show_scroll_bar);
- auto open_settings_action = GUI::Action::create("Terminal &Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)),
+ auto open_settings_action = GUI::Action::create("Terminal &Settings", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv)),
[&](auto&) {
GUI::Process::spawn_or_show_error(window, "/bin/TerminalSettings"sv);
});
@@ -344,7 +344,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(terminal->context_menu().try_add_action(open_settings_action));
auto file_menu = TRY(window->try_add_menu("&File"));
- TRY(file_menu->try_add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
+ TRY(file_menu->try_add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(window, "/bin/Terminal"sv);
})));
@@ -394,7 +394,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(edit_menu->try_add_action(terminal->copy_action()));
TRY(edit_menu->try_add_action(terminal->paste_action()));
TRY(edit_menu->try_add_separator());
- TRY(edit_menu->try_add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)),
+ TRY(edit_menu->try_add_action(GUI::Action::create("&Find...", { Mod_Ctrl | Mod_Shift, Key_F }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv)),
[&](auto&) {
find_window->show();
find_window->move_to_front();
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index c7eb8d4e62..dac25b150f 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -105,11 +105,11 @@ MainWidget::MainWidget()
};
m_wrap_around_checkbox->set_checked(true);
- m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
find_text(GUI::TextEditor::SearchDirection::Forward, ShowMessageIfNoResults::Yes);
});
- m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find-previous.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
find_text(GUI::TextEditor::SearchDirection::Backward, ShowMessageIfNoResults::Yes);
});
@@ -160,11 +160,11 @@ MainWidget::MainWidget()
m_find_previous_button = *find_descendant_of_type_named<GUI::Button>("find_previous_button");
m_find_previous_button->set_action(*m_find_previous_action);
- m_find_previous_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_find_previous_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/find-previous.png"sv).release_value_but_fixme_should_propagate_errors());
m_find_next_button = *find_descendant_of_type_named<GUI::Button>("find_next_button");
m_find_next_button->set_action(*m_find_next_action);
- m_find_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_find_next_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/find-next.png"sv).release_value_but_fixme_should_propagate_errors());
m_find_textbox->on_return_pressed = [this] {
m_find_next_button->click();
@@ -204,7 +204,7 @@ MainWidget::MainWidget()
});
m_vim_emulation_setting_action->set_checked(false);
- m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
m_find_replace_widget->set_visible(true);
m_find_widget->set_visible(true);
m_replace_widget->set_visible(true);
@@ -249,7 +249,7 @@ MainWidget::MainWidget()
m_editor->on_selection_change = [this] { update_statusbar(); };
m_editor->on_highlighter_change = [this] { update_statusbar(); };
- m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
+ m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
if (editor().document().is_modified()) {
auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp());
if (save_document_first_result == GUI::Dialog::ExecResult::Yes)
@@ -312,7 +312,7 @@ MainWidget::MainWidget()
}
});
- auto file_manager_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto file_manager_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors();
m_open_folder_action = GUI::Action::create("Open Containing Folder", { Mod_Ctrl | Mod_Shift, Key_O }, file_manager_icon, [&](auto&) {
auto lexical_path = LexicalPath(m_path);
Desktop::Launcher::open(URL::create_with_file_scheme(lexical_path.dirname(), lexical_path.basename()));
@@ -452,7 +452,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
view_menu.add_separator();
- view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(),
+ view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(),
[&](auto&) {
auto picker = GUI::FontPicker::construct(&window, &m_editor->font(), false);
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
index 09f193a7b4..ddc6040c82 100644
--- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
+++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
@@ -48,8 +48,8 @@ ErrorOr<void> VideoPlayerWidget::setup_interface()
m_playback_manager->seek_to_timestamp(timestamp);
};
- m_play_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv));
- m_pause_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv));
+ m_play_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv));
+ m_pause_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png"sv));
m_play_pause_action = GUI::Action::create("Play", { Key_Space }, m_play_icon, [&](auto&) {
toggle_pause();
diff --git a/Userland/Demos/CatDog/CatDog.cpp b/Userland/Demos/CatDog/CatDog.cpp
index 5c84970112..c276704ffe 100644
--- a/Userland/Demos/CatDog/CatDog.cpp
+++ b/Userland/Demos/CatDog/CatDog.cpp
@@ -49,7 +49,7 @@ ErrorOr<NonnullRefPtr<CatDog>> CatDog::create()
auto catdog = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) CatDog));
for (auto const& image_source : image_sources)
- TRY(catdog->m_images.try_append({ image_source.state, *TRY(Gfx::Bitmap::try_load_from_file(image_source.path)) }));
+ TRY(catdog->m_images.try_append({ image_source.state, *TRY(Gfx::Bitmap::load_from_file(image_source.path)) }));
return catdog;
}
diff --git a/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp b/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp
index bfd8d38f1d..a5259ffd7e 100644
--- a/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp
+++ b/Userland/Demos/GradientScreensaver/GradientScreensaver.cpp
@@ -34,7 +34,7 @@ private:
Screensaver::Screensaver(int width, int height, int interval)
{
on_screensaver_exit = []() { GUI::Application::the()->quit(); };
- m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height }).release_value_but_fixme_should_propagate_errors();
+ m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height }).release_value_but_fixme_should_propagate_errors();
srand(time(nullptr));
stop_timer();
start_timer(interval);
diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp
index 5721c6ff56..3209290ffc 100644
--- a/Userland/Demos/LibGfxDemo/main.cpp
+++ b/Userland/Demos/LibGfxDemo/main.cpp
@@ -39,7 +39,7 @@ private:
Canvas::Canvas()
{
- m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }).release_value_but_fixme_should_propagate_errors();
+ m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }).release_value_but_fixme_should_propagate_errors();
draw();
}
@@ -107,7 +107,7 @@ void Canvas::draw()
painter.draw_line({ 740, 140 }, { 640, 240 }, Color::Red, 5, Gfx::Painter::LineStyle::Solid);
painter.draw_line({ 690, 140 }, { 640, 240 }, Color::Blue, 10, Gfx::Painter::LineStyle::Solid);
- auto bg = Gfx::Bitmap::try_load_from_file("/res/html/misc/90s-bg.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto bg = Gfx::Bitmap::load_from_file("/res/html/misc/90s-bg.png"sv).release_value_but_fixme_should_propagate_errors();
painter.draw_tiled_bitmap({ 20, 260, 480, 320 }, *bg);
painter.draw_line({ 40, 480 }, { 20, 260 }, Color::Red);
@@ -128,7 +128,7 @@ void Canvas::draw()
path.close();
painter.fill_path(path, Color::Yellow, Gfx::Painter::WindingRule::EvenOdd);
- auto buggie = Gfx::Bitmap::try_load_from_file("/res/graphics/buggie.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto buggie = Gfx::Bitmap::load_from_file("/res/graphics/buggie.png"sv).release_value_but_fixme_should_propagate_errors();
painter.blit({ 280, 280 }, *buggie, buggie->rect(), 0.5);
painter.draw_scaled_bitmap({ 360, 280, buggie->rect().width() * 2, buggie->rect().height() * 2 }, *buggie, buggie->rect());
diff --git a/Userland/Demos/LibGfxScaleDemo/main.cpp b/Userland/Demos/LibGfxScaleDemo/main.cpp
index 0c9b6a5b7d..8e54da69b7 100644
--- a/Userland/Demos/LibGfxScaleDemo/main.cpp
+++ b/Userland/Demos/LibGfxScaleDemo/main.cpp
@@ -44,15 +44,15 @@ private:
Canvas::Canvas()
{
- m_bitmap_1x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { WIDTH, HEIGHT }, 1).release_value_but_fixme_should_propagate_errors();
- m_bitmap_2x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { WIDTH, HEIGHT }, 2).release_value_but_fixme_should_propagate_errors();
+ m_bitmap_1x = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { WIDTH, HEIGHT }, 1).release_value_but_fixme_should_propagate_errors();
+ m_bitmap_2x = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { WIDTH, HEIGHT }, 2).release_value_but_fixme_should_propagate_errors();
// m_bitmap_1x and m_bitmap_2x have the same logical size, so LibGfx will try to draw them at the same physical size:
// When drawing on a 2x backing store it'd scale m_bitmap_1x up 2x and paint m_bitmap_2x at its physical size.
// When drawing on a 1x backing store it'd draw m_bitmap_1x at its physical size, and it would have to scale down m_bitmap_2x to 0.5x its size.
// But the system can't current scale down, and we want to draw the 2x bitmap at twice the size of the 1x bitmap in this particular application,
// so make a 1x alias of the 2x bitmap to make LibGfx paint it without any scaling at paint time, mapping once pixel to one pixel.
- m_bitmap_2x_as_1x = Gfx::Bitmap::try_create_wrapper(Gfx::BitmapFormat::BGRA8888, m_bitmap_2x->physical_size(), 1, m_bitmap_2x->pitch(), m_bitmap_2x->scanline(0)).release_value_but_fixme_should_propagate_errors();
+ m_bitmap_2x_as_1x = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRA8888, m_bitmap_2x->physical_size(), 1, m_bitmap_2x->pitch(), m_bitmap_2x->scanline(0)).release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter_1x(*m_bitmap_1x);
draw(painter_1x);
@@ -74,7 +74,7 @@ void Canvas::paint_event(GUI::PaintEvent& event)
void Canvas::draw(Gfx::Painter& painter)
{
- auto active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto active_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
Gfx::WindowTheme::current().paint_normal_frame(painter, Gfx::WindowTheme::WindowState::Active, Gfx::WindowTheme::WindowMode::Other, { 4, 18, WIDTH - 8, HEIGHT - 29 }, "Well hello friends 🐞"sv, *active_window_icon, palette(), { WIDTH - 20, 6, 16, 16 }, 0, false);
@@ -83,7 +83,7 @@ void Canvas::draw(Gfx::Painter& painter)
painter.draw_rect({ 24, 38, WIDTH - 48, HEIGHT - 53 }, palette().color(Gfx::ColorRole::Selection));
// buggie.png has an alpha channel.
- auto buggie = Gfx::Bitmap::try_load_from_file("/res/graphics/buggie.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto buggie = Gfx::Bitmap::load_from_file("/res/graphics/buggie.png"sv).release_value_but_fixme_should_propagate_errors();
painter.blit({ 25, 39 }, *buggie, { 2, 30, 62, 20 });
painter.draw_scaled_bitmap({ 88, 39, 62 * 2, 20 * 2 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
painter.draw_scaled_bitmap({ 202, 39, 80, 40 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
@@ -93,7 +93,7 @@ void Canvas::draw(Gfx::Painter& painter)
painter.blit({ 25, 101 }, *buggie, { 2, 30, 3 * buggie->width(), 20 });
// grid does not have an alpha channel.
- auto grid = Gfx::Bitmap::try_load_from_file("/res/wallpapers/grid.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto grid = Gfx::Bitmap::load_from_file("/res/wallpapers/grid.png"sv).release_value_but_fixme_should_propagate_errors();
VERIFY(!grid->has_alpha_channel());
painter.fill_rect({ 25, 122, 62, 20 }, Color::Green);
painter.blit({ 25, 122 }, *grid, { (grid->width() - 62) / 2, (grid->height() - 20) / 2 + 40, 62, 20 }, 0.9);
diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp
index c7538d2925..cf65d28df6 100644
--- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp
+++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp
@@ -39,7 +39,7 @@ public:
void resize(Gfx::IntSize size)
{
- m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size).release_value_but_fixme_should_propagate_errors();
+ m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size).release_value_but_fixme_should_propagate_errors();
correct_aspect();
calculate();
}
@@ -444,7 +444,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
GUI::MessageBox::show_error(window, DeprecatedString::formatted("{}", result.error()));
})));
- export_submenu.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv)));
+ export_submenu.set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv)));
TRY(file_menu->try_add_separator());
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
diff --git a/Userland/Demos/ModelGallery/GalleryWidget.cpp b/Userland/Demos/ModelGallery/GalleryWidget.cpp
index 6235cc252a..5effbd5781 100644
--- a/Userland/Demos/ModelGallery/GalleryWidget.cpp
+++ b/Userland/Demos/ModelGallery/GalleryWidget.cpp
@@ -47,8 +47,8 @@ ErrorOr<void> GalleryWidget::load_basic_model_tab()
m_add_new_item = *tab->find_descendant_of_type_named<GUI::Button>("add_new_item");
m_remove_selected_item = *tab->find_descendant_of_type_named<GUI::Button>("remove_selected_item");
- m_add_new_item->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
- m_remove_selected_item->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/minus.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_add_new_item->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_remove_selected_item->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/minus.png"sv).release_value_but_fixme_should_propagate_errors());
m_new_item_name->on_return_pressed = [&] { add_textbox_contents_to_basic_model(); };
m_add_new_item->on_click = [&](auto) { add_textbox_contents_to_basic_model(); };
diff --git a/Userland/Demos/Starfield/Starfield.cpp b/Userland/Demos/Starfield/Starfield.cpp
index 90eda0ba7e..a7c1f95459 100644
--- a/Userland/Demos/Starfield/Starfield.cpp
+++ b/Userland/Demos/Starfield/Starfield.cpp
@@ -63,7 +63,7 @@ Starfield::Starfield(int interval)
ErrorOr<void> Starfield::create_stars(int width, int height, int stars)
{
- m_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height }));
+ m_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height }));
m_stars.grow_capacity(stars);
for (int i = 0; i < stars; i++) {
diff --git a/Userland/Demos/Tubes/Tubes.cpp b/Userland/Demos/Tubes/Tubes.cpp
index f710cff2e2..8fa6680dbe 100644
--- a/Userland/Demos/Tubes/Tubes.cpp
+++ b/Userland/Demos/Tubes/Tubes.cpp
@@ -124,7 +124,7 @@ void Tubes::choose_new_direction_for_tube(Tube& tube)
ErrorOr<void> Tubes::create_buffer(Gfx::IntSize size)
{
- m_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size));
+ m_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size));
m_gl_context = TRY(GL::create_context(*m_bitmap));
return {};
}
diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h
index 9b3979f9c8..f4f3049624 100644
--- a/Userland/Demos/WidgetGallery/GalleryModels.h
+++ b/Userland/Demos/WidgetGallery/GalleryModels.h
@@ -73,7 +73,7 @@ public:
cursor.name = LexicalPath::basename(cursor.path);
// FIXME: Animated cursor bitmaps
- auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path).release_value_but_fixme_should_propagate_errors();
+ auto cursor_bitmap = Gfx::Bitmap::load_from_file(cursor.path).release_value_but_fixme_should_propagate_errors();
auto cursor_bitmap_rect = cursor_bitmap->rect();
cursor.params = Gfx::CursorParams::parse_from_filename(cursor.name, cursor_bitmap_rect.center()).constrained(*cursor_bitmap);
@@ -158,7 +158,7 @@ public:
if (!path.contains("filetype-"sv) && !path.contains("app-"sv))
continue;
IconSet icon_set;
- icon_set.big_icon = Gfx::Bitmap::try_load_from_file(path).release_value_but_fixme_should_propagate_errors();
+ icon_set.big_icon = Gfx::Bitmap::load_from_file(path).release_value_but_fixme_should_propagate_errors();
icon_set.name = LexicalPath::basename(path);
m_icon_sets.append(move(icon_set));
}
@@ -172,7 +172,7 @@ public:
if (!path.contains("filetype-"sv) && !path.contains("app-"sv))
continue;
IconSet icon_set;
- icon_set.little_icon = Gfx::Bitmap::try_load_from_file(path).release_value_but_fixme_should_propagate_errors();
+ icon_set.little_icon = Gfx::Bitmap::load_from_file(path).release_value_but_fixme_should_propagate_errors();
icon_set.name = LexicalPath::basename(path);
for (size_t i = 0; i < big_icons_found; i++) {
if (icon_set.name == m_icon_sets[i].name) {
diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp
index 97a7131975..30a6dd77d3 100644
--- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp
+++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp
@@ -73,9 +73,9 @@ GalleryWidget::GalleryWidget()
m_label_frame->set_frame_thickness(value);
};
- m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors());
- m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
- m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladybug.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/ladybug.png"sv).release_value_but_fixme_should_propagate_errors());
m_icon_button = basics_tab->find_descendant_of_type_named<GUI::Button>("icon_button");
m_icon_button->set_icon(*m_button_icons[2]);
@@ -95,7 +95,7 @@ GalleryWidget::GalleryWidget()
m_text_editor = basics_tab->find_descendant_of_type_named<GUI::TextEditor>("text_editor");
m_font_button = basics_tab->find_descendant_of_type_named<GUI::Button>("font_button");
- m_font_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_font_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
m_font_button->on_click = [&](auto) {
auto picker = GUI::FontPicker::try_create(window(), &m_text_editor->font(), false).release_value_but_fixme_should_propagate_errors();
@@ -105,7 +105,7 @@ GalleryWidget::GalleryWidget()
};
m_file_button = basics_tab->find_descendant_of_type_named<GUI::Button>("file_button");
- m_file_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_file_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
m_file_button->on_click = [&](auto) {
auto response = FileSystemAccessClient::Client::the().open_file(window());
@@ -115,7 +115,7 @@ GalleryWidget::GalleryWidget()
};
m_input_button = basics_tab->find_descendant_of_type_named<GUI::Button>("input_button");
- m_input_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_input_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors());
m_input_button->on_click = [&](auto) {
DeprecatedString value;
@@ -133,7 +133,7 @@ GalleryWidget::GalleryWidget()
};
m_msgbox_button = basics_tab->find_descendant_of_type_named<GUI::Button>("msgbox_button");
- m_msgbox_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-browser.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_msgbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-browser.png"sv).release_value_but_fixme_should_propagate_errors());
m_msgbox_type = GUI::MessageBox::Type::None;
m_msgbox_input_type = GUI::MessageBox::InputType::OK;
diff --git a/Userland/DevTools/GMLPlayground/main.cpp b/Userland/DevTools/GMLPlayground/main.cpp
index 6b9c09ae0e..4bb2bb2246 100644
--- a/Userland/DevTools/GMLPlayground/main.cpp
+++ b/Userland/DevTools/GMLPlayground/main.cpp
@@ -215,7 +215,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(edit_menu->try_add_action(editor->go_to_line_action()));
TRY(edit_menu->try_add_separator());
- auto format_gml_action = GUI::Action::create("&Format GML", { Mod_Ctrl | Mod_Shift, Key_I }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reformat.png"sv)), [&](auto&) {
+ auto format_gml_action = GUI::Action::create("&Format GML", { Mod_Ctrl | Mod_Shift, Key_I }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reformat.png"sv)), [&](auto&) {
auto formatted_gml_or_error = GUI::GML::format_gml(editor->text());
if (!formatted_gml_or_error.is_error()) {
editor->replace_all_text_without_resetting_undo_stack(formatted_gml_or_error.release_value());
diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
index ad9abd77f3..ba03e124c4 100644
--- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
@@ -24,19 +24,19 @@ namespace HackStudio {
ErrorOr<void> DebugInfoWidget::init_toolbar()
{
- m_continue_action = GUI::Action::create("Continue", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-continue.png"sv)), [](auto&) {
+ m_continue_action = GUI::Action::create("Continue", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-continue.png"sv)), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::Continue);
});
- m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-over.png"sv)), [](auto&) {
+ m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-over.png"sv)), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOver);
});
- m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-in.png"sv)), [](auto&) {
+ m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-in.png"sv)), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceSingleStep);
});
- m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-out.png"sv)), [](auto&) {
+ m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-out.png"sv)), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOut);
});
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
index 6350e99b8e..b2fc5a6850 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
@@ -33,7 +33,7 @@ private:
, m_regs(regs)
, m_inspector(inspector)
{
- m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
}
NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
PtraceRegisters m_regs;
diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp
index c119c2a42f..c56edd7790 100644
--- a/Userland/DevTools/HackStudio/Editor.cpp
+++ b/Userland/DevTools/HackStudio/Editor.cpp
@@ -470,13 +470,13 @@ void Editor::clear_execution_position()
Gfx::Bitmap const& Editor::breakpoint_icon_bitmap()
{
- static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/breakpoint.png"sv).release_value_but_fixme_should_propagate_errors();
+ static auto bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/breakpoint.png"sv).release_value_but_fixme_should_propagate_errors();
return *bitmap;
}
Gfx::Bitmap const& Editor::current_position_icon_bitmap()
{
- static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors();
+ static auto bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors();
return *bitmap;
}
diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
index 81778cad46..8c2a159051 100644
--- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp
+++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
@@ -32,7 +32,7 @@ GitWidget::GitWidget()
unstaged_header.set_layout<GUI::HorizontalBoxLayout>();
auto& refresh_button = unstaged_header.add<GUI::Button>();
- refresh_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors());
+ refresh_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors());
refresh_button.set_fixed_size(16, 16);
refresh_button.set_tooltip("refresh");
refresh_button.on_click = [this](int) { refresh(); };
@@ -43,7 +43,7 @@ GitWidget::GitWidget()
unstaged_header.set_fixed_height(20);
m_unstaged_files = unstaged.add<GitFilesView>(
[this](auto const& file) { stage_file(file); },
- Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
+ Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
m_unstaged_files->on_selection_change = [this] {
const auto& index = m_unstaged_files->selection().first();
if (!index.is_valid())
@@ -60,7 +60,7 @@ GitWidget::GitWidget()
staged_header.set_layout<GUI::HorizontalBoxLayout>();
auto& commit_button = staged_header.add<GUI::Button>();
- commit_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/commit.png"sv).release_value_but_fixme_should_propagate_errors());
+ commit_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/commit.png"sv).release_value_but_fixme_should_propagate_errors());
commit_button.set_fixed_size(16, 16);
commit_button.set_tooltip("commit");
commit_button.on_click = [this](int) { commit(); };
@@ -71,7 +71,7 @@ GitWidget::GitWidget()
staged_header.set_fixed_height(20);
m_staged_files = staged.add<GitFilesView>(
[this](auto const& file) { unstage_file(file); },
- Gfx::Bitmap::try_load_from_file("/res/icons/16x16/minus.png"sv).release_value_but_fixme_should_propagate_errors());
+ Gfx::Bitmap::load_from_file("/res/icons/16x16/minus.png"sv).release_value_but_fixme_should_propagate_errors());
}
bool GitWidget::initialize()
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 2cad952518..0132cc71d2 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -500,7 +500,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> HackStudioWidget::create_project_tree_view_con
for (auto& new_file_action : m_new_file_actions) {
new_file_submenu.add_action(new_file_action);
}
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv));
new_file_submenu.set_icon(icon);
new_file_submenu.add_action(*m_new_plain_file_action);
new_file_submenu.add_separator();
@@ -519,7 +519,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> HackStudioWidget::create_project_tree_view_con
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(DeprecatedString const& label, DeprecatedString const& icon, DeprecatedString const& extension)
{
- auto icon_no_shadow = TRY(Gfx::Bitmap::try_load_from_file(icon));
+ auto icon_no_shadow = TRY(Gfx::Bitmap::load_from_file(icon));
return GUI::Action::create(label, icon_no_shadow, [this, extension](const GUI::Action&) {
DeprecatedString filename;
if (GUI::InputBox::show(window(), filename, "Enter name of new file:"sv, "Add new file to project"sv) != GUI::InputBox::ExecResult::OK)
@@ -561,7 +561,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(Dep
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv));
return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, icon, [this](const GUI::Action&) {
DeprecatedString directory_name;
if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:"sv, "Add new folder to project"sv) != GUI::InputBox::ExecResult::OK)
@@ -598,7 +598,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_selected_actio
for (auto& file : files)
open_file(file);
});
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv));
open_selected_action->set_icon(icon);
open_selected_action->set_enabled(true);
return open_selected_action;
@@ -705,7 +705,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_project_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/hackstudio-project.png"sv));
return GUI::Action::create(
"&Project...", icon,
[this](const GUI::Action&) {
@@ -856,7 +856,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_previous_editor_ac
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_remove_current_editor_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-editor.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/remove-editor.png"sv));
return GUI::Action::create("&Remove Current Editor", { Mod_Alt | Mod_Shift, Key_E }, icon, [this](auto&) {
if (m_all_editor_wrappers.size() <= 1)
return;
@@ -870,7 +870,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_remove_current_edit
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv));
return GUI::Action::create("&Open Project...", { Mod_Ctrl | Mod_Shift, Key_O }, icon, [this](auto&) {
auto open_path = GUI::FilePicker::get_open_filepath(window(), "Open project", m_project->root_path(), true);
if (!open_path.has_value())
@@ -937,7 +937,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_remove_current_terminal_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-terminal.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/remove-terminal.png"sv));
return GUI::Action::create("Remove &Current Terminal", { Mod_Alt | Mod_Shift, Key_T }, icon, [this](auto&) {
auto widget = m_action_tab_widget->active_widget();
if (!widget)
@@ -963,7 +963,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_tab_widget_action
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_add_editor_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-editor.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/add-editor.png"sv));
return GUI::Action::create("Add New &Editor", { Mod_Ctrl | Mod_Alt, Key_E },
icon,
[this](auto&) {
@@ -974,7 +974,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_add_editor_action()
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_add_terminal_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-terminal.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/add-terminal.png"sv));
return GUI::Action::create("Add New &Terminal", { Mod_Ctrl | Mod_Alt, Key_T },
icon,
[this](auto&) {
@@ -999,7 +999,7 @@ void HackStudioWidget::reveal_action_tab(GUI::Widget& widget)
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_debug_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-run.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"sv));
return GUI::Action::create("&Debug", icon, [this](auto&) {
if (!Core::File::exists(get_project_executable_path())) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error);
@@ -1298,7 +1298,7 @@ void HackStudioWidget::create_toolbar(GUI::Widget& parent)
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_build_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/build.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/build.png"sv));
return GUI::Action::create("&Build", { Mod_Ctrl, Key_B }, icon, [this](auto&) {
if (warn_unsaved_changes("There are unsaved changes, do you want to save before building?") == ContinueDecision::No)
return;
@@ -1310,7 +1310,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_build_action()
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_run_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-run.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/program-run.png"sv));
return GUI::Action::create("&Run", { Mod_Ctrl, Key_R }, icon, [this](auto&) {
reveal_action_tab(*m_terminal_wrapper);
run();
@@ -1415,7 +1415,7 @@ ErrorOr<void> HackStudioWidget::create_file_menu(GUI::Window& window)
}
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv));
new_submenu.set_icon(icon);
}
new_submenu.add_action(*m_new_plain_file_action);
@@ -1425,7 +1425,7 @@ ErrorOr<void> HackStudioWidget::create_file_menu(GUI::Window& window)
file_menu.add_action(*m_open_action);
m_recent_projects_submenu = &file_menu.add_submenu("Open &Recent");
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-recent.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open-recent.png"sv));
m_recent_projects_submenu->set_icon(icon);
}
update_recent_projects_submenu();
@@ -1441,7 +1441,7 @@ ErrorOr<void> HackStudioWidget::create_file_menu(GUI::Window& window)
ErrorOr<void> HackStudioWidget::create_edit_menu(GUI::Window& window)
{
auto& edit_menu = window.add_menu("&Edit");
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv));
edit_menu.add_action(GUI::Action::create("&Find in Files...", { Mod_Ctrl | Mod_Shift, Key_F }, icon, [this](auto&) {
reveal_action_tab(*m_find_in_files_widget);
m_find_in_files_widget->focus_textbox_and_select_all();
@@ -1524,7 +1524,7 @@ ErrorOr<void> HackStudioWidget::create_view_menu(GUI::Window& window)
m_no_wrapping_action->set_checked(true);
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv));
m_editor_font_action = GUI::Action::create("Editor &Font...", icon,
[&](auto&) {
auto picker = GUI::FontPicker::construct(&window, m_editor_font, false);
@@ -1564,7 +1564,7 @@ void HackStudioWidget::create_help_menu(GUI::Window& window)
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_stop_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-stop.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/program-stop.png"sv));
auto action = GUI::Action::create("&Stop", icon, [this](auto&) {
if (!Debugger::the().session()) {
if (auto result = m_terminal_wrapper->kill_running_command(); result.is_error())
@@ -1734,7 +1734,7 @@ void HackStudioWidget::on_cursor_change()
ErrorOr<void> HackStudioWidget::create_location_history_actions()
{
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv));
m_locations_history_back_action = GUI::Action::create("Go Back", { Mod_Alt | Mod_Shift, Key_Left }, icon, [this](auto&) {
if (m_locations_history_end_index <= 1)
return;
@@ -1751,7 +1751,7 @@ ErrorOr<void> HackStudioWidget::create_location_history_actions()
}
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv));
m_locations_history_forward_action = GUI::Action::create("Go Forward", { Mod_Alt | Mod_Shift, Key_Right }, icon, [this](auto&) {
if (m_locations_history_end_index == m_locations_history.size())
return;
@@ -1772,7 +1772,7 @@ ErrorOr<void> HackStudioWidget::create_location_history_actions()
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_project_configuration_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv));
return GUI::Action::create("Project Configuration", icon, [&](auto&) {
auto parent_directory = LexicalPath::dirname(Project::config_file_path);
auto absolute_config_file_path = LexicalPath::absolute_path(m_project->root_path(), Project::config_file_path);
@@ -1876,7 +1876,7 @@ void HackStudioWidget::for_each_open_file(Function<void(ProjectFile const&)> fun
ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_toggle_syntax_highlighting_mode_action()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-cplusplus.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"sv));
auto action = GUI::Action::create_checkable("&Semantic Highlighting", icon, [this](auto& action) {
for (auto& editor_wrapper : m_all_editor_wrappers)
editor_wrapper.editor().set_semantic_syntax_highlighting(action.is_checked());
diff --git a/Userland/DevTools/HackStudio/LanguageClient.cpp b/Userland/DevTools/HackStudio/LanguageClient.cpp
index 11c02c46e3..499ea5edfa 100644
--- a/Userland/DevTools/HackStudio/LanguageClient.cpp
+++ b/Userland/DevTools/HackStudio/LanguageClient.cpp
@@ -211,7 +211,7 @@ void ConnectionToServerWrapper::on_crash()
void ConnectionToServerWrapper::show_frequent_crashes_notification() const
{
auto notification = GUI::Notification::construct();
- notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
+ notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
notification->set_title("LanguageServer Crashes too much!");
notification->set_text("LanguageServer aided features will not be available in this session");
notification->show();
@@ -219,7 +219,7 @@ void ConnectionToServerWrapper::show_frequent_crashes_notification() const
void ConnectionToServerWrapper::show_crash_notification() const
{
auto notification = GUI::Notification::construct();
- notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
+ notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
notification->set_title("Oops!");
notification->set_text(DeprecatedString::formatted("LanguageServer has crashed"));
notification->show();
diff --git a/Userland/DevTools/HackStudio/ProjectDeclarations.cpp b/Userland/DevTools/HackStudio/ProjectDeclarations.cpp
index 422cba72fe..dff6118a07 100644
--- a/Userland/DevTools/HackStudio/ProjectDeclarations.cpp
+++ b/Userland/DevTools/HackStudio/ProjectDeclarations.cpp
@@ -20,13 +20,13 @@ void HackStudio::ProjectDeclarations::set_declared_symbols(DeprecatedString cons
Optional<GUI::Icon> HackStudio::ProjectDeclarations::get_icon_for(CodeComprehension::DeclarationType type)
{
- static GUI::Icon struct_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Struct.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon class_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Class.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon function_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Function.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon variable_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Variable.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon preprocessor_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Preprocessor.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon member_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Member.png"sv).release_value_but_fixme_should_propagate_errors());
- static GUI::Icon namespace_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Namespace.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon struct_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Struct.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon class_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Class.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon function_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Function.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon variable_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Variable.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon preprocessor_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Preprocessor.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon member_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Member.png"sv).release_value_but_fixme_should_propagate_errors());
+ static GUI::Icon namespace_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Namespace.png"sv).release_value_but_fixme_should_propagate_errors());
switch (type) {
case CodeComprehension::DeclarationType::Struct:
return struct_icon;
diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.cpp b/Userland/DevTools/HackStudio/ProjectTemplate.cpp
index ef0ebbf755..66c7f39a83 100644
--- a/Userland/DevTools/HackStudio/ProjectTemplate.cpp
+++ b/Userland/DevTools/HackStudio/ProjectTemplate.cpp
@@ -53,7 +53,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(DeprecatedString con
auto bitmap_path_32 = DeprecatedString::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x"));
if (Core::File::exists(bitmap_path_32)) {
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(bitmap_path_32);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(bitmap_path_32);
if (!bitmap_or_error.is_error())
icon = GUI::Icon(bitmap_or_error.release_value());
}
diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp
index b9eda30d56..089f43540a 100644
--- a/Userland/DevTools/HackStudio/main.cpp
+++ b/Userland/DevTools/HackStudio/main.cpp
@@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = GUI::Window::construct();
window->resize(840, 600);
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"sv));
window->set_icon(icon);
update_path_environment_variable();
@@ -115,7 +115,7 @@ static bool make_is_available()
static ErrorOr<void> notify_make_not_available()
{
auto notification = GUI::Notification::construct();
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"sv));
notification->set_icon(icon);
notification->set_title("'make' Not Available");
notification->set_text("You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository");
diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
index 0644923625..d2aa41244e 100644
--- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
@@ -17,10 +17,10 @@ namespace Inspector {
RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process)
: m_process(process)
{
- m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
- m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors());
- m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv).release_value_but_fixme_should_propagate_errors());
- m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/layout.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/timer.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex RemoteObjectGraphModel::index(int row, int column, const GUI::ModelIndex& parent) const
diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp
index 086835ea8c..9cd03cdb57 100644
--- a/Userland/DevTools/Inspector/main.cpp
+++ b/Userland/DevTools/Inspector/main.cpp
@@ -130,7 +130,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto properties_tree_view_context_menu = TRY(GUI::Menu::try_create("Properties Tree View"));
- auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors();
+ auto copy_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors();
auto copy_property_name_action = GUI::Action::create("Copy Property Name", copy_bitmap, [&](auto&) {
GUI::Clipboard::the().set_plain_text(properties_tree_view.selection().first().data().to_deprecated_string());
});
diff --git a/Userland/DevTools/Profiler/Gradient.cpp b/Userland/DevTools/Profiler/Gradient.cpp
index be6ed341b6..17a50a4742 100644
--- a/Userland/DevTools/Profiler/Gradient.cpp
+++ b/Userland/DevTools/Profiler/Gradient.cpp
@@ -13,7 +13,7 @@ static Gfx::Bitmap const& heat_gradient()
{
static RefPtr<Gfx::Bitmap> bitmap;
if (!bitmap) {
- bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 101, 1 }).release_value_but_fixme_should_propagate_errors();
+ bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 101, 1 }).release_value_but_fixme_should_propagate_errors();
GUI::Painter painter(*bitmap);
painter.fill_rect_with_gradient(Orientation::Horizontal, bitmap->rect(), Color::from_rgb(0xffc080), Color::from_rgb(0xff3000));
}
diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp
index 338593f087..c4a686d18d 100644
--- a/Userland/DevTools/Profiler/ProfileModel.cpp
+++ b/Userland/DevTools/Profiler/ProfileModel.cpp
@@ -16,8 +16,8 @@ namespace Profiler {
ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
- m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
- m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex ProfileModel::index(int row, int column, GUI::ModelIndex const& parent) const
diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp
index 405154604b..5e8b0b6d25 100644
--- a/Userland/DevTools/Profiler/SamplesModel.cpp
+++ b/Userland/DevTools/Profiler/SamplesModel.cpp
@@ -14,8 +14,8 @@ namespace Profiler {
SamplesModel::SamplesModel(Profile& profile)
: m_profile(profile)
{
- m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
- m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
}
int SamplesModel::row_count(GUI::ModelIndex const&) const
diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp
index 3021605013..eda8f043ac 100644
--- a/Userland/DevTools/Profiler/main.cpp
+++ b/Userland/DevTools/Profiler/main.cpp
@@ -170,12 +170,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
update_source_model();
};
- auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
+ auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
disassembly_view->set_visible(action.is_checked());
update_disassembly_model();
});
- auto source_action = GUI::Action::create_checkable("Show &Source", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
+ auto source_action = GUI::Action::create_checkable("Show &Source", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
source_view->set_visible(action.is_checked());
update_source_model();
});
@@ -315,7 +315,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_
auto window = GUI::Window::construct();
window->set_title(DeprecatedString::formatted("Profiling {}({})", process_name, pid));
window->resize(240, 100);
- window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
+ window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
window->center_on_screen();
auto widget = window->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
@@ -344,7 +344,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_
bool generate_profile(pid_t& pid)
{
if (!pid) {
- auto process_chooser = GUI::ProcessChooser::construct("Profiler"sv, "Profile"sv, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
+ auto process_chooser = GUI::ProcessChooser::construct("Profiler"sv, "Profile"sv, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel)
return false;
pid = process_chooser->pid();
diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp
index 95a2671d0a..4de878b9cf 100644
--- a/Userland/DevTools/SQLStudio/MainWidget.cpp
+++ b/Userland/DevTools/SQLStudio/MainWidget.cpp
@@ -63,7 +63,7 @@ MainWidget::MainWidget()
{
load_from_gml(sql_studio_gml).release_value_but_fixme_should_propagate_errors();
- m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
open_new_script();
});
@@ -149,7 +149,7 @@ MainWidget::MainWidget()
update_editor_actions(editor);
});
- m_connect_to_database_action = GUI::Action::create("Connect to Database"sv, { Mod_Alt, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_connect_to_database_action = GUI::Action::create("Connect to Database"sv, { Mod_Alt, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
auto database_name = m_databases_combo_box->text().trim_whitespace();
if (database_name.is_empty())
return;
@@ -171,7 +171,7 @@ MainWidget::MainWidget()
}
});
- m_run_script_action = GUI::Action::create("Run script", { Mod_Alt, Key_F9 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
+ m_run_script_action = GUI::Action::create("Run script", { Mod_Alt, Key_F9 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_results.clear();
m_current_line_for_parsing = 0;
read_next_sql_statement_of_editor();
diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp
index d0c28bc734..7144160e10 100644
--- a/Userland/Games/2048/main.cpp
+++ b/Userland/Games/2048/main.cpp
@@ -171,7 +171,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
start_a_new_game();
})));
@@ -192,7 +192,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
TRY(game_menu->try_add_separator());
- TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
change_settings();
})));
diff --git a/Userland/Games/BrickGame/main.cpp b/Userland/Games/BrickGame/main.cpp
index 4ca23c4c1e..3c81af6de0 100644
--- a/Userland/Games/BrickGame/main.cpp
+++ b/Userland/Games/BrickGame/main.cpp
@@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
game->reset();
})));
TRY(game_menu->try_add_separator());
diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp
index 5f6fa5fb33..ab61f29436 100644
--- a/Userland/Games/Chess/ChessWidget.cpp
+++ b/Userland/Games/Chess/ChessWidget.cpp
@@ -381,7 +381,7 @@ static RefPtr<Gfx::Bitmap> get_piece(StringView set, StringView image)
builder.append(set);
builder.append('/');
builder.append(image);
- return Gfx::Bitmap::try_load_from_file(builder.build()).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::load_from_file(builder.build()).release_value_but_fixme_should_propagate_errors();
}
void ChessWidget::set_piece_set(StringView set)
diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp
index 569e463e21..c368ff0a46 100644
--- a/Userland/Games/Chess/main.cpp
+++ b/Userland/Games/Chess/main.cpp
@@ -91,7 +91,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
TRY(game_menu->try_add_separator());
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
if (widget->board().game_result() == Chess::Board::Result::NotFinished) {
if (widget->resign() < 0)
return;
@@ -127,7 +127,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
GUI::ActionGroup board_theme_action_group;
board_theme_action_group.set_exclusive(true);
auto board_theme_menu = TRY(style_menu->try_add_submenu("Board Theme"));
- board_theme_menu->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/chess/mini-board.png"sv).release_value_but_fixme_should_propagate_errors());
+ board_theme_menu->set_icon(Gfx::Bitmap::load_from_file("/res/icons/chess/mini-board.png"sv).release_value_but_fixme_should_propagate_errors());
for (auto const& theme : { "Beige", "Green", "Blue" }) {
auto action = GUI::Action::create_checkable(theme, [&](auto& action) {
diff --git a/Userland/Games/ColorLines/ColorLines.cpp b/Userland/Games/ColorLines/ColorLines.cpp
index ec5a66661e..992f51de6b 100644
--- a/Userland/Games/ColorLines/ColorLines.cpp
+++ b/Userland/Games/ColorLines/ColorLines.cpp
@@ -17,7 +17,7 @@
ColorLines::BitmapArray ColorLines::build_marble_color_bitmaps()
{
- auto marble_bitmap = MUST(Gfx::Bitmap::try_load_from_file("/res/icons/colorlines/colorlines.png"sv));
+ auto marble_bitmap = MUST(Gfx::Bitmap::load_from_file("/res/icons/colorlines/colorlines.png"sv));
float constexpr hue_degrees[Marble::number_of_colors] = {
0, // Red
45, // Brown/Yellow
diff --git a/Userland/Games/ColorLines/main.cpp b/Userland/Games/ColorLines/main.cpp
index d73a033065..204d6c64a0 100644
--- a/Userland/Games/ColorLines/main.cpp
+++ b/Userland/Games/ColorLines/main.cpp
@@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
game->reset();
})));
TRY(game_menu->try_add_separator());
diff --git a/Userland/Games/FlappyBug/Game.h b/Userland/Games/FlappyBug/Game.h
index 74137707b9..15241caa71 100644
--- a/Userland/Games/FlappyBug/Game.h
+++ b/Userland/Games/FlappyBug/Game.h
@@ -59,8 +59,8 @@ public:
public:
static ErrorOr<Bug> construct()
{
- NonnullRefPtr<Gfx::Bitmap> falling_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/falling.png"sv));
- NonnullRefPtr<Gfx::Bitmap> flapping_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/flapping.png"sv));
+ NonnullRefPtr<Gfx::Bitmap> falling_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/flappybug/falling.png"sv));
+ NonnullRefPtr<Gfx::Bitmap> flapping_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/flappybug/flapping.png"sv));
return Bug(move(falling_bitmap), move(flapping_bitmap));
}
@@ -139,9 +139,9 @@ public:
static ErrorOr<Cloud> construct()
{
Vector<NonnullRefPtr<Gfx::Bitmap>> const cloud_bitmaps {
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_0.png"sv)),
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_1.png"sv)),
- TRY(Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_2.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_0.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_1.png"sv)),
+ TRY(Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_2.png"sv)),
};
return Cloud(move(cloud_bitmaps));
}
@@ -173,7 +173,7 @@ private:
float m_last_score {};
float m_difficulty {};
float m_restart_cooldown {};
- NonnullRefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/background.png"sv).release_value_but_fixme_should_propagate_errors() };
+ NonnullRefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::load_from_file("/res/icons/flappybug/background.png"sv).release_value_but_fixme_should_propagate_errors() };
const Gfx::IntRect m_score_rect { 10, 10, 20, 20 };
const Gfx::IntRect m_text_rect { game_width / 2 - 80, game_height / 2 - 40, 160, 80 };
diff --git a/Userland/Games/Flood/main.cpp b/Userland/Games/Flood/main.cpp
index 9cbe8184f4..6957675446 100644
--- a/Userland/Games/Flood/main.cpp
+++ b/Userland/Games/Flood/main.cpp
@@ -169,12 +169,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
start_a_new_game();
})));
TRY(game_menu->try_add_separator());
- TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
change_settings();
})));
diff --git a/Userland/Games/GameOfLife/main.cpp b/Userland/Games/GameOfLife/main.cpp
index 0110fc59b8..b369f1a5bd 100644
--- a/Userland/Games/GameOfLife/main.cpp
+++ b/Userland/Games/GameOfLife/main.cpp
@@ -91,8 +91,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
interval_spinbox.set_value(150);
- auto paused_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv));
- auto play_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv));
+ auto paused_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png"sv));
+ auto play_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv));
auto toggle_running_action = GUI::Action::create("&Toggle Running", { Mod_None, Key_Return }, *play_icon, [&](GUI::Action&) {
board_widget->set_running(!board_widget->is_running());
@@ -101,27 +101,27 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
toggle_running_action->set_checkable(true);
auto toggle_running_toolbar_button = TRY(main_toolbar.try_add_action(toggle_running_action));
- auto run_one_generation_action = GUI::Action::create("Run &Next Generation", { Mod_Ctrl, Key_Equal }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](const GUI::Action&) {
+ auto run_one_generation_action = GUI::Action::create("Run &Next Generation", { Mod_Ctrl, Key_Equal }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv)), [&](const GUI::Action&) {
statusbar.set_text(click_tip);
board_widget->run_generation();
});
(void)TRY(main_toolbar.try_add_action(run_one_generation_action));
- auto clear_board_action = GUI::Action::create("&Clear board", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv)), [&](auto&) {
+ auto clear_board_action = GUI::Action::create("&Clear board", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv)), [&](auto&) {
statusbar.set_text(click_tip);
board_widget->clear_cells();
board_widget->update();
});
(void)TRY(main_toolbar.try_add_action(clear_board_action));
- auto randomize_cells_action = GUI::Action::create("&Randomize board", { Mod_Ctrl, Key_R }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ auto randomize_cells_action = GUI::Action::create("&Randomize board", { Mod_Ctrl, Key_R }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
statusbar.set_text(click_tip);
board_widget->randomize_cells();
board_widget->update();
});
(void)TRY(main_toolbar.try_add_action(randomize_cells_action));
- auto rotate_pattern_action = GUI::Action::create("&Rotate pattern", { 0, Key_R }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png"sv)), [&](auto&) {
+ auto rotate_pattern_action = GUI::Action::create("&Rotate pattern", { 0, Key_R }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"sv)), [&](auto&) {
board_widget->selected_pattern()->rotate_clockwise();
});
rotate_pattern_action->set_enabled(false);
diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp
index f78e4f4e8d..7f26bc2b98 100644
--- a/Userland/Games/Hearts/main.cpp
+++ b/Userland/Games/Hearts/main.cpp
@@ -90,12 +90,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
game.setup(player_name);
})));
TRY(game_menu->try_add_separator());
TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
- TRY(game_menu->try_add_action(GUI::Action::create("Hearts &Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("Hearts &Settings", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
change_settings();
})));
TRY(game_menu->try_add_separator());
diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp
index eaf050ed79..88f8216e3c 100644
--- a/Userland/Games/Minesweeper/Field.cpp
+++ b/Userland/Games/Minesweeper/Field.cpp
@@ -111,15 +111,15 @@ private:
ErrorOr<NonnullRefPtr<Field>> Field::create(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed)
{
auto field = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Field(flag_label, time_label, face_button, move(on_size_changed))));
- field->m_mine_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/mine.png"sv));
- field->m_flag_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/flag.png"sv));
- field->m_badflag_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/badflag.png"sv));
- field->m_consider_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/consider.png"sv));
- field->m_default_face_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-default.png"sv));
- field->m_good_face_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-good.png"sv));
- field->m_bad_face_bitmap = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-bad.png"sv));
+ field->m_mine_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/mine.png"sv));
+ field->m_flag_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/flag.png"sv));
+ field->m_badflag_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/badflag.png"sv));
+ field->m_consider_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/consider.png"sv));
+ field->m_default_face_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/face-default.png"sv));
+ field->m_good_face_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/face-good.png"sv));
+ field->m_bad_face_bitmap = TRY(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/face-bad.png"sv));
for (int i = 0; i < 8; ++i)
- field->m_number_bitmap[i] = TRY(Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/minesweeper/{}.png", i + 1)));
+ field->m_number_bitmap[i] = TRY(Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/minesweeper/{}.png", i + 1)));
field->initialize();
return field;
}
diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp
index 8b9be6b1eb..9ac5e94242 100644
--- a/Userland/Games/Minesweeper/main.cpp
+++ b/Userland/Games/Minesweeper/main.cpp
@@ -65,7 +65,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
field->reset();
})));
diff --git a/Userland/Games/Snake/Game.cpp b/Userland/Games/Snake/Game.cpp
index e9a36c8673..f7fc81900b 100644
--- a/Userland/Games/Snake/Game.cpp
+++ b/Userland/Games/Snake/Game.cpp
@@ -57,7 +57,7 @@ ErrorOr<NonnullRefPtr<Game>> Game::try_create()
TRY(food_bitmaps.try_ensure_capacity(food_bitmaps_files.size()));
for (auto file : food_bitmaps_files) {
- auto bitmap = Gfx::Bitmap::try_load_from_file(file);
+ auto bitmap = Gfx::Bitmap::load_from_file(file);
if (bitmap.is_error()) {
dbgln("\033[31;1mCould not load bitmap file\033[0m '{}': {}", file, bitmap.error());
return bitmap.release_error();
diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp
index da3f2a54ab..03b6dd38ad 100644
--- a/Userland/Games/Snake/main.cpp
+++ b/Userland/Games/Snake/main.cpp
@@ -74,13 +74,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
game.reset();
})));
static DeprecatedString const pause_text = "&Pause Game"sv;
- auto const pause_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"sv));
+ auto const pause_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png"sv));
static DeprecatedString const continue_text = "&Continue Game"sv;
- auto const continue_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv));
+ auto const continue_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"sv));
TRY(game_menu->try_add_action(GUI::Action::create(pause_text, { Mod_None, Key_Space }, pause_icon, [&](auto& action) {
if (game.has_timer()) {
game.pause();
@@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
action.set_icon(pause_icon);
}
})));
- TRY(game_menu->try_add_action(GUI::Action::create("&Change snake color", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&Change snake color", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/color-chooser.png"sv)), [&](auto&) {
game.pause();
auto dialog = GUI::ColorPicker::construct(Gfx::Color::White, window);
if (dialog->exec() == GUI::Dialog::ExecResult::OK)
diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp
index 6d7500b053..073543c406 100644
--- a/Userland/Games/Solitaire/main.cpp
+++ b/Userland/Games/Solitaire/main.cpp
@@ -206,7 +206,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
if (!confirm_end_current_game())
return;
diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp
index 1ec566e70e..0812ecd73d 100644
--- a/Userland/Games/Spider/main.cpp
+++ b/Userland/Games/Spider/main.cpp
@@ -247,7 +247,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
suit_actions.add_action(two_suit_action);
auto game_menu = TRY(window->try_add_menu("&Game"));
- TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(GUI::Action::create("&New Game", { Mod_None, Key_F2 }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv)), [&](auto&) {
if (!confirm_end_current_game())
return;
diff --git a/Userland/Libraries/LibCards/CardGame.cpp b/Userland/Libraries/LibCards/CardGame.cpp
index 0808bd6a91..d9c1fbf0f3 100644
--- a/Userland/Libraries/LibCards/CardGame.cpp
+++ b/Userland/Libraries/LibCards/CardGame.cpp
@@ -19,7 +19,7 @@ namespace Cards {
ErrorOr<NonnullRefPtr<GUI::Action>> make_cards_settings_action(GUI::Window* parent)
{
auto action = GUI::Action::create(
- "&Cards Settings", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/games.png"sv)), [parent](auto&) {
+ "&Cards Settings", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/games.png"sv)), [parent](auto&) {
GUI::Process::spawn_or_show_error(parent, "/bin/GamesSettings"sv, Array { "--open-tab", "cards" });
},
parent);
diff --git a/Userland/Libraries/LibCards/CardPainter.cpp b/Userland/Libraries/LibCards/CardPainter.cpp
index e018bb15d3..646ba1541a 100644
--- a/Userland/Libraries/LibCards/CardPainter.cpp
+++ b/Userland/Libraries/LibCards/CardPainter.cpp
@@ -168,7 +168,7 @@ void CardPainter::set_background_color(Color background_color)
NonnullRefPtr<Gfx::Bitmap> CardPainter::create_card_bitmap()
{
- return Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { Card::width, Card::height }).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { Card::width, Card::height }).release_value_but_fixme_should_propagate_errors();
}
void CardPainter::paint_card_front(Gfx::Bitmap& bitmap, Cards::Suit suit, Cards::Rank rank)
@@ -225,7 +225,7 @@ void CardPainter::paint_card_back(Gfx::Bitmap& bitmap)
auto inner_paint_rect = paint_rect.shrunken(2, 2);
painter.fill_rect_with_rounded_corners(inner_paint_rect, Color::White, Card::card_radius - 1);
- auto image = Gfx::Bitmap::try_load_from_file(m_background_image_path).release_value_but_fixme_should_propagate_errors();
+ auto image = Gfx::Bitmap::load_from_file(m_background_image_path).release_value_but_fixme_should_propagate_errors();
painter.blit({ (bitmap.width() - image->width()) / 2, (bitmap.height() - image->height()) / 2 }, image, image->rect());
}
diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
index 581abb269d..658c9e15ea 100644
--- a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
+++ b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
@@ -21,12 +21,12 @@ namespace GUI {
AbstractThemePreview::AbstractThemePreview(Gfx::Palette const& preview_palette)
: m_preview_palette(preview_palette)
{
- m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
- m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_active_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_inactive_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
- m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
- m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
- m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_default_close_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_default_maximize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_default_minimize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
VERIFY(m_active_window_icon);
VERIFY(m_inactive_window_icon);
@@ -44,7 +44,7 @@ void AbstractThemePreview::load_theme_bitmaps()
last_path = DeprecatedString::empty();
bitmap = nullptr;
} else if (last_path != path) {
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(path);
if (bitmap_or_error.is_error()) {
last_path = DeprecatedString::empty();
bitmap = nullptr;
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
index fb450d9ae7..fd7db85142 100644
--- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
+++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
@@ -52,13 +52,13 @@ public:
if (index.column() == Column::Icon) {
if (suggestion.language == CodeComprehension::Language::Cpp) {
if (!s_cpp_identifier_icon) {
- s_cpp_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/cpp-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_cpp_identifier_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/completion/cpp-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
}
return *s_cpp_identifier_icon;
}
if (suggestion.language == CodeComprehension::Language::Unspecified) {
if (!s_unspecified_identifier_icon) {
- s_unspecified_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/unspecified-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_unspecified_identifier_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/completion/unspecified-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
}
return *s_unspecified_identifier_icon;
}
diff --git a/Userland/Libraries/LibGUI/Button.cpp b/Userland/Libraries/LibGUI/Button.cpp
index be46f88ee1..439a28faf4 100644
--- a/Userland/Libraries/LibGUI/Button.cpp
+++ b/Userland/Libraries/LibGUI/Button.cpp
@@ -185,7 +185,7 @@ void Button::set_icon(RefPtr<Gfx::Bitmap> icon)
void Button::set_icon_from_path(DeprecatedString const& path)
{
- auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path);
+ auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
if (maybe_bitmap.is_error()) {
dbgln("Unable to load bitmap `{}` for button icon", path);
return;
diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp
index 26dbfa12c2..e2e5dba192 100644
--- a/Userland/Libraries/LibGUI/Clipboard.cpp
+++ b/Userland/Libraries/LibGUI/Clipboard.cpp
@@ -103,12 +103,12 @@ RefPtr<Gfx::Bitmap> Clipboard::DataAndType::as_bitmap() const
// We won't actually write to the clipping_bitmap, so casting away the const is okay.
auto clipping_data = const_cast<u8*>(data.data());
- auto clipping_bitmap_or_error = Gfx::Bitmap::try_create_wrapper(bitmap_format, { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping_data);
+ auto clipping_bitmap_or_error = Gfx::Bitmap::create_wrapper(bitmap_format, { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping_data);
if (clipping_bitmap_or_error.is_error())
return nullptr;
auto clipping_bitmap = clipping_bitmap_or_error.release_value_but_fixme_should_propagate_errors();
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
if (bitmap_or_error.is_error())
return nullptr;
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp
index 7dac2fe557..ad1364e7cd 100644
--- a/Userland/Libraries/LibGUI/ColorPicker.cpp
+++ b/Userland/Libraries/LibGUI/ColorPicker.cpp
@@ -187,7 +187,7 @@ ColorPicker::ColorPicker(Color color, Window* parent_window, DeprecatedString ti
: Dialog(parent_window)
, m_color(color)
{
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/color-chooser.png"sv).release_value_but_fixme_should_propagate_errors());
set_title(title);
set_resizable(false);
resize(480, 326);
@@ -552,7 +552,7 @@ ColorField::ColorField(Color color)
void ColorField::create_color_bitmap()
{
- m_color_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 256, 256 }).release_value_but_fixme_should_propagate_errors();
+ m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 256, 256 }).release_value_but_fixme_should_propagate_errors();
auto painter = Gfx::Painter(*m_color_bitmap);
Gfx::HSV hsv;
@@ -678,7 +678,7 @@ void ColorField::resize_event(ResizeEvent&)
ColorSlider::ColorSlider(double value)
: m_value(value)
{
- m_color_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 32, 360 }).release_value_but_fixme_should_propagate_errors();
+ m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 32, 360 }).release_value_but_fixme_should_propagate_errors();
auto painter = Gfx::Painter(*m_color_bitmap);
for (int h = 0; h < 360; h++) {
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp
index 88eba5a0de..0b11783854 100644
--- a/Userland/Libraries/LibGUI/ComboBox.cpp
+++ b/Userland/Libraries/LibGUI/ComboBox.cpp
@@ -102,7 +102,7 @@ ComboBox::ComboBox()
m_open_button = add<Button>();
m_open_button->set_button_style(Gfx::ButtonStyle::ThickCap);
- m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_open_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_open_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_open_button->on_click = [this](auto) {
if (!m_list_view->item_count())
diff --git a/Userland/Libraries/LibGUI/CommonActions.cpp b/Userland/Libraries/LibGUI/CommonActions.cpp
index 763a788066..e58fe7dba1 100644
--- a/Userland/Libraries/LibGUI/CommonActions.cpp
+++ b/Userland/Libraries/LibGUI/CommonActions.cpp
@@ -29,78 +29,78 @@ NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon c
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open an existing file");
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file");
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file with a new name");
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the top of the stack");
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the bottom of the stack");
return action;
}
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Cut to clipboard");
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Copy to clipboard");
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Paste from clipboard");
return action;
}
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open the Emoji Picker");
return action;
}
@@ -109,7 +109,7 @@ NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, C
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode");
- action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
+ action->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
return action;
}
@@ -122,85 +122,85 @@ NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Show help contents");
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step backward in history");
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step forward in history");
return action;
}
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::Object* parent)
{
- auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Close current tab");
return action;
}
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("Re&name", Key_F2, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("Re&name", Key_F2, Gfx::Bitmap::load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)> callback, Core::Object* parent)
{
- return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
+ return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_command_palette_action(Window* window)
{
- auto action = Action::create("&Commands...", { Mod_Ctrl | Mod_Shift, Key_A }, MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)), [=](auto&) {
+ auto action = Action::create("&Commands...", { Mod_Ctrl | Mod_Shift, Key_A }, MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv)), [=](auto&) {
auto command_palette = CommandPalette::construct(*window);
if (command_palette->exec() != GUI::Dialog::ExecResult::OK)
return;
diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp
index ee8d549cc3..3e64f09375 100644
--- a/Userland/Libraries/LibGUI/DragOperation.cpp
+++ b/Userland/Libraries/LibGUI/DragOperation.cpp
@@ -30,7 +30,7 @@ DragOperation::Outcome DragOperation::exec()
Gfx::ShareableBitmap drag_bitmap;
if (m_mime_data->has_format("image/x-raw-bitmap")) {
auto data = m_mime_data->data("image/x-raw-bitmap");
- auto bitmap = Gfx::Bitmap::try_create_from_serialized_byte_buffer(move(data)).release_value_but_fixme_should_propagate_errors();
+ auto bitmap = Gfx::Bitmap::create_from_serialized_byte_buffer(move(data)).release_value_but_fixme_should_propagate_errors();
drag_bitmap = bitmap->to_shareable_bitmap();
}
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp
index ebb62794a0..31797d7388 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.cpp
+++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp
@@ -70,8 +70,8 @@ static void initialize_if_needed()
auto config = Core::ConfigFile::open("/etc/FileIconProvider.ini").release_value_but_fixme_should_propagate_errors();
- s_symlink_emblem = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem.png"sv).release_value_but_fixme_should_propagate_errors();
- s_symlink_emblem_small = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem-small.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_symlink_emblem = Gfx::Bitmap::load_from_file("/res/icons/symlink-emblem.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_symlink_emblem_small = Gfx::Bitmap::load_from_file("/res/icons/symlink-emblem-small.png"sv).release_value_but_fixme_should_propagate_errors();
s_hard_disk_icon = Icon::default_icon("hard-disk"sv);
s_directory_icon = Icon::default_icon("filetype-folder"sv);
diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp
index e6c76a9f50..b05d9fc62f 100644
--- a/Userland/Libraries/LibGUI/FilePicker.cpp
+++ b/Userland/Libraries/LibGUI/FilePicker.cpp
@@ -75,11 +75,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
case Mode::OpenMultiple:
case Mode::OpenFolder:
set_title("Open");
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
break;
case Mode::Save:
set_title("Save as");
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors());
break;
}
resize(560, 320);
@@ -113,7 +113,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
};
auto open_parent_directory_action = Action::create(
- "Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
+ "Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
set_path(DeprecatedString::formatted("{}/..", m_model->root_path()));
},
this);
@@ -127,7 +127,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
toolbar.add_separator();
auto mkdir_action = Action::create(
- "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
+ "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
DeprecatedString value;
if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv) == InputBox::ExecResult::OK && !value.is_empty()) {
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_model->root_path(), value));
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index f6d7919da1..91d804d25e 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -633,8 +633,8 @@ static HashMap<DeprecatedString, RefPtr<Gfx::Bitmap>> s_thumbnail_cache;
static ErrorOr<NonnullRefPtr<Gfx::Bitmap>> render_thumbnail(StringView path)
{
- auto bitmap = TRY(Gfx::Bitmap::try_load_from_file(path));
- auto thumbnail = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { 32, 32 }));
+ auto bitmap = TRY(Gfx::Bitmap::load_from_file(path));
+ auto thumbnail = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { 32, 32 }));
double scale = min(32 / (double)bitmap->width(), 32 / (double)bitmap->height());
auto destination = Gfx::IntRect(0, 0, (int)(bitmap->width() * scale), (int)(bitmap->height() * scale)).centered_within(thumbnail->rect());
diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp
index 5d3b8a033f..9deb1b425e 100644
--- a/Userland/Libraries/LibGUI/FontPicker.cpp
+++ b/Userland/Libraries/LibGUI/FontPicker.cpp
@@ -24,7 +24,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
{
set_title("Font picker");
resize(430, 280);
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(font_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp
index ecbd09fe84..fd9c5575f5 100644
--- a/Userland/Libraries/LibGUI/Icon.cpp
+++ b/Userland/Libraries/LibGUI/Icon.cpp
@@ -82,9 +82,9 @@ ErrorOr<Icon> Icon::try_create_default_icon(StringView name)
{
RefPtr<Gfx::Bitmap> bitmap16;
RefPtr<Gfx::Bitmap> bitmap32;
- if (auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
+ if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
bitmap16 = bitmap_or_error.release_value();
- if (auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
+ if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
bitmap32 = bitmap_or_error.release_value();
if (!bitmap16 && !bitmap32) {
diff --git a/Userland/Libraries/LibGUI/Label.cpp b/Userland/Libraries/LibGUI/Label.cpp
index d222e76b3b..75f5e3df4e 100644
--- a/Userland/Libraries/LibGUI/Label.cpp
+++ b/Userland/Libraries/LibGUI/Label.cpp
@@ -56,7 +56,7 @@ void Label::set_icon(Gfx::Bitmap const* icon)
void Label::set_icon_from_path(DeprecatedString const& path)
{
- auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path);
+ auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
if (maybe_bitmap.is_error()) {
dbgln("Unable to load bitmap `{}` for label icon", path);
return;
diff --git a/Userland/Libraries/LibGUI/LinkLabel.cpp b/Userland/Libraries/LibGUI/LinkLabel.cpp
index b13e9fa0a7..5eaeeb5e0b 100644
--- a/Userland/Libraries/LibGUI/LinkLabel.cpp
+++ b/Userland/Libraries/LibGUI/LinkLabel.cpp
@@ -29,7 +29,7 @@ LinkLabel::LinkLabel(DeprecatedString text)
void LinkLabel::setup_actions()
{
- m_open_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
+ m_open_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
if (on_click)
on_click();
});
diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp
index 8f6ab7a3d9..ace4b8fcd9 100644
--- a/Userland/Libraries/LibGUI/MessageBox.cpp
+++ b/Userland/Libraries/LibGUI/MessageBox.cpp
@@ -76,13 +76,13 @@ RefPtr<Gfx::Bitmap> MessageBox::icon() const
{
switch (m_type) {
case Type::Information:
- return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-information.png"sv).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-information.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Warning:
- return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-warning.png"sv).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-warning.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Error:
- return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-error.png"sv).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-error.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Question:
- return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-question.png"sv).release_value_but_fixme_should_propagate_errors();
+ return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-question.png"sv).release_value_but_fixme_should_propagate_errors();
default:
return nullptr;
}
diff --git a/Userland/Libraries/LibGUI/MultiView.cpp b/Userland/Libraries/LibGUI/MultiView.cpp
index 095510a3d0..e1072b6843 100644
--- a/Userland/Libraries/LibGUI/MultiView.cpp
+++ b/Userland/Libraries/LibGUI/MultiView.cpp
@@ -101,19 +101,19 @@ void MultiView::set_column_visible(int column_index, bool visible)
void MultiView::build_actions()
{
m_view_as_icons_action = Action::create_checkable(
- "Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Icon);
},
this);
m_view_as_table_action = Action::create_checkable(
- "Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Table);
},
this);
m_view_as_columns_action = Action::create_checkable(
- "Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Columns);
},
this);
diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp
index 6f24b2152f..f7b4d36997 100644
--- a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp
+++ b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp
@@ -27,7 +27,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
auto& key_icon_label = *widget->find_descendant_of_type_named<GUI::Label>("key_icon_label");
- key_icon_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
+ key_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
auto& server_label = *widget->find_descendant_of_type_named<GUI::Label>("server_label");
server_label.set_text(move(server));
diff --git a/Userland/Libraries/LibGUI/SpinBox.cpp b/Userland/Libraries/LibGUI/SpinBox.cpp
index 1f70b93d7e..eda77472f8 100644
--- a/Userland/Libraries/LibGUI/SpinBox.cpp
+++ b/Userland/Libraries/LibGUI/SpinBox.cpp
@@ -48,13 +48,13 @@ SpinBox::SpinBox()
m_increment_button = add<Button>();
m_increment_button->set_button_style(Gfx::ButtonStyle::ThickCap);
- m_increment_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_increment_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_increment_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_increment_button->on_click = [this](auto) { set_value(m_value + 1); };
m_increment_button->set_auto_repeat_interval(150);
m_decrement_button = add<Button>();
m_decrement_button->set_button_style(Gfx::ButtonStyle::ThickCap);
- m_decrement_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_decrement_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_decrement_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_decrement_button->on_click = [this](auto) { set_value(m_value - 1); };
m_decrement_button->set_auto_repeat_interval(150);
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 33eb8cfce1..47f7907a5d 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -93,7 +93,7 @@ void TextEditor::create_actions()
m_paste_action->set_enabled(is_editable() && Clipboard::the().fetch_mime_type().starts_with("text/"sv));
if (is_multi_line()) {
m_go_to_line_action = Action::create(
- "Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ "Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
DeprecatedString value;
if (InputBox::show(window(), value, "Line:"sv, "Go to line"sv) == InputBox::ExecResult::OK) {
auto line_target = value.to_uint();
diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp
index 27b8d387e8..16eaf772d3 100644
--- a/Userland/Libraries/LibGUI/Toolbar.cpp
+++ b/Userland/Libraries/LibGUI/Toolbar.cpp
@@ -170,7 +170,7 @@ Optional<UISize> Toolbar::calculated_min_size() const
ErrorOr<void> Toolbar::create_overflow_objects()
{
- m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
+ m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
m_overflow_menu->popup(m_overflow_button->screen_relative_rect().bottom_left(), {}, m_overflow_button->rect());
});
m_overflow_action->set_status_tip("Show hidden toolbar actions");
diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp
index c52987750c..93bd82f12c 100644
--- a/Userland/Libraries/LibGUI/TreeView.cpp
+++ b/Userland/Libraries/LibGUI/TreeView.cpp
@@ -42,8 +42,8 @@ TreeView::TreeView()
set_background_role(ColorRole::Base);
set_foreground_role(ColorRole::BaseText);
set_column_headers_visible(false);
- m_expand_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-expand.png"sv).release_value_but_fixme_should_propagate_errors();
- m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_expand_bitmap = Gfx::Bitmap::load_from_file("/res/icons/serenity/treeview-expand.png"sv).release_value_but_fixme_should_propagate_errors();
+ m_collapse_bitmap = Gfx::Bitmap::load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
}
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint a_position, bool& is_toggle) const
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index 4e2cbda7d4..b41686fbc1 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -964,7 +964,7 @@ ErrorOr<NonnullOwnPtr<WindowBackingStore>> Window::create_backing_store(Gfx::Int
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes, PAGE_SIZE)));
// FIXME: Plumb scale factor here eventually.
- auto bitmap = TRY(Gfx::Bitmap::try_create_with_anonymous_buffer(format, buffer, size, 1, {}));
+ auto bitmap = TRY(Gfx::Bitmap::create_with_anonymous_buffer(format, buffer, size, 1, {}));
return make<WindowBackingStore>(bitmap);
}
@@ -987,7 +987,7 @@ void Window::set_icon(Gfx::Bitmap const* icon)
Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16);
- m_icon = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, icon_size).release_value_but_fixme_should_propagate_errors();
+ m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, icon_size).release_value_but_fixme_should_propagate_errors();
if (icon) {
Painter painter(*m_icon);
painter.blit({ 0, 0 }, *icon, icon->rect());
diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp
index efe4133151..65e2efa5b3 100644
--- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp
+++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp
@@ -364,7 +364,7 @@ void AntiAliasingPainter::draw_ellipse(IntRect const& a_rect, Color color, int t
auto color_no_alpha = color;
color_no_alpha.set_alpha(255);
auto outline_ellipse_bitmap = ({
- auto bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, a_rect.size());
+ auto bitmap = Bitmap::create(BitmapFormat::BGRA8888, a_rect.size());
if (bitmap.is_error())
return warnln("Failed to allocate temporary bitmap for antialiased outline ellipse!");
bitmap.release_value();
diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp
index 8b7e30095d..4109adc9a3 100644
--- a/Userland/Libraries/LibGfx/BMPLoader.cpp
+++ b/Userland/Libraries/LibGfx/BMPLoader.cpp
@@ -1205,7 +1205,7 @@ static ErrorOr<void> decode_bmp_pixel_data(BMPLoadingContext& context)
const u32 width = abs(context.dib.core.width);
const u32 height = !context.is_included_in_ico ? context.dib.core.height : (context.dib.core.height / 2);
- context.bitmap = TRY(Bitmap::try_create(format, { static_cast<int>(width), static_cast<int>(height) }));
+ context.bitmap = TRY(Bitmap::create(format, { static_cast<int>(width), static_cast<int>(height) }));
ByteBuffer rle_buffer;
ReadonlyBytes bytes { context.file_bytes + context.data_offset, context.file_size - context.data_offset };
diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp
index e46161f321..e5dcb609d8 100644
--- a/Userland/Libraries/LibGfx/Bitmap.cpp
+++ b/Userland/Libraries/LibGfx/Bitmap.cpp
@@ -65,22 +65,22 @@ static bool size_would_overflow(BitmapFormat format, IntSize size, int scale_fac
return Checked<size_t>::multiplication_would_overflow(pitch, size.height() * scale_factor);
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create(BitmapFormat format, IntSize size, int scale_factor)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create(BitmapFormat format, IntSize size, int scale_factor)
{
auto backing_store = TRY(Bitmap::allocate_backing_store(format, size, scale_factor));
return AK::adopt_nonnull_ref_or_enomem(new (nothrow) Bitmap(format, size, scale_factor, backing_store));
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_shareable(BitmapFormat format, IntSize size, int scale_factor)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_shareable(BitmapFormat format, IntSize size, int scale_factor)
{
if (size_would_overflow(format, size, scale_factor))
- return Error::from_string_literal("Gfx::Bitmap::try_create_shareable size overflow");
+ return Error::from_string_literal("Gfx::Bitmap::create_shareable size overflow");
auto const pitch = minimum_pitch(size.width() * scale_factor, format);
auto const data_size = size_in_bytes(pitch, size.height() * scale_factor);
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(data_size, PAGE_SIZE)));
- auto bitmap = TRY(Bitmap::try_create_with_anonymous_buffer(format, buffer, size, scale_factor, {}));
+ auto bitmap = TRY(Bitmap::create_with_anonymous_buffer(format, buffer, size, scale_factor, {}));
return bitmap;
}
@@ -99,14 +99,14 @@ Bitmap::Bitmap(BitmapFormat format, IntSize size, int scale_factor, BackingStore
m_needs_munmap = true;
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_wrapper(BitmapFormat format, IntSize size, int scale_factor, size_t pitch, void* data)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_wrapper(BitmapFormat format, IntSize size, int scale_factor, size_t pitch, void* data)
{
if (size_would_overflow(format, size, scale_factor))
- return Error::from_string_literal("Gfx::Bitmap::try_create_wrapper size overflow");
+ return Error::from_string_literal("Gfx::Bitmap::create_wrapper size overflow");
return adopt_ref(*new Bitmap(format, size, scale_factor, pitch, data));
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int scale_factor)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_file(StringView path, int scale_factor)
{
if (scale_factor > 1 && path.starts_with("/res/"sv)) {
auto load_scaled_bitmap = [](StringView path, int scale_factor) -> ErrorOr<NonnullRefPtr<Bitmap>> {
@@ -117,9 +117,9 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int s
auto highdpi_icon_string = highdpi_icon_path.string_view();
auto fd = TRY(Core::System::open(highdpi_icon_string, O_RDONLY));
- auto bitmap = TRY(try_load_from_fd_and_close(fd, highdpi_icon_string));
+ auto bitmap = TRY(load_from_fd_and_close(fd, highdpi_icon_string));
if (bitmap->width() % scale_factor != 0 || bitmap->height() % scale_factor != 0)
- return Error::from_string_literal("Bitmap::try_load_from_file: HighDPI image size should be divisible by scale factor");
+ return Error::from_string_literal("Bitmap::load_from_file: HighDPI image size should be divisible by scale factor");
bitmap->m_size.set_width(bitmap->width() / scale_factor);
bitmap->m_size.set_height(bitmap->height() / scale_factor);
bitmap->m_scale = scale_factor;
@@ -138,10 +138,10 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int s
}
auto fd = TRY(Core::System::open(path, O_RDONLY));
- return try_load_from_fd_and_close(fd, path);
+ return load_from_fd_and_close(fd, path);
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, StringView path)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_fd_and_close(int fd, StringView path)
{
auto file = TRY(Core::MappedFile::map_from_fd_and_close(fd, path));
auto mime_type = Core::guess_mime_type_based_on_filename(path);
@@ -188,17 +188,17 @@ static bool check_size(IntSize size, int scale_factor, BitmapFormat format, unsi
return true;
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size, int scale_factor, Vector<ARGB32> const& palette)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size, int scale_factor, Vector<ARGB32> const& palette)
{
if (size_would_overflow(format, size, scale_factor))
- return Error::from_string_literal("Gfx::Bitmap::try_create_with_anonymous_buffer size overflow");
+ return Error::from_string_literal("Gfx::Bitmap::create_with_anonymous_buffer size overflow");
return adopt_nonnull_ref_or_enomem(new (nothrow) Bitmap(format, move(buffer), size, scale_factor, palette));
}
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(ByteBuffer&& buffer)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_byte_buffer(ByteBuffer&& buffer)
{
- return try_create_from_serialized_bytes(buffer.bytes());
+ return create_from_serialized_bytes(buffer.bytes());
}
/// Read a bitmap as described by:
@@ -210,7 +210,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By
/// - palette count
/// - palette data (= palette count * BGRA8888)
/// - image data (= actual size * u8)
-ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_bytes(ReadonlyBytes bytes)
+ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_bytes(ReadonlyBytes bytes)
{
InputMemoryStream stream { bytes };
size_t actual_size;
@@ -228,26 +228,26 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_bytes(Readonly
};
if (!read(actual_size) || !read(width) || !read(height) || !read(scale_factor) || !read(format) || !read(palette_size))
- return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
+ return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
if (format > BitmapFormat::BGRA8888 || format < BitmapFormat::Indexed1)
- return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
+ return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
if (!check_size({ width, height }, scale_factor, format, actual_size))
- return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
+ return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
palette.ensure_capacity(palette_size);
for (size_t i = 0; i < palette_size; ++i) {
if (!read(palette[i]))
- return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
+ return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
}
if (stream.remaining() < actual_size)
- return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
+ return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
auto data = stream.bytes().slice(stream.offset(), actual_size);
- auto bitmap = TRY(Bitmap::try_create(format, { width, height }, scale_factor));
+ auto bitmap = TRY(Bitmap::create(format, { width, height }, scale_factor));
bitmap->m_palette = new ARGB32[palette_size];
memcpy(bitmap->m_palette, palette.data(), palette_size * sizeof(ARGB32));
@@ -303,7 +303,7 @@ Bitmap::Bitmap(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size,
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::clone() const
{
- auto new_bitmap = TRY(Bitmap::try_create(format(), size(), scale()));
+ auto new_bitmap = TRY(Bitmap::create(format(), size(), scale()));
VERIFY(size_in_bytes() == new_bitmap->size_in_bytes());
memcpy(new_bitmap->scanline(0), scanline(0), size_in_bytes());
@@ -313,7 +313,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::clone() const
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotation_direction) const
{
- auto new_bitmap = TRY(Gfx::Bitmap::try_create(this->format(), { height(), width() }, scale()));
+ auto new_bitmap = TRY(Gfx::Bitmap::create(this->format(), { height(), width() }, scale()));
auto w = this->physical_width();
auto h = this->physical_height();
@@ -334,7 +334,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotat
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::flipped(Gfx::Orientation orientation) const
{
- auto new_bitmap = TRY(Gfx::Bitmap::try_create(this->format(), { width(), height() }, scale()));
+ auto new_bitmap = TRY(Gfx::Bitmap::create(this->format(), { width(), height() }, scale()));
auto w = this->physical_width();
auto h = this->physical_height();
@@ -357,7 +357,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(int sx, int sy) const
if (sx == 1 && sy == 1)
return NonnullRefPtr { *this };
- auto new_bitmap = TRY(Gfx::Bitmap::try_create(format(), { width() * sx, height() * sy }, scale()));
+ auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { width() * sx, height() * sy }, scale()));
auto old_width = physical_width();
auto old_height = physical_height();
@@ -389,7 +389,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(float sx, float sy) const
int scaled_width = (int)ceilf(sx * (float)width());
int scaled_height = (int)ceilf(sy * (float)height());
- auto new_bitmap = TRY(Gfx::Bitmap::try_create(format(), { scaled_width, scaled_height }, scale()));
+ auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { scaled_width, scaled_height }, scale()));
auto old_width = physical_width();
auto old_height = physical_height();
@@ -461,7 +461,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(float sx, float sy) const
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::cropped(Gfx::IntRect crop, Optional<BitmapFormat> new_bitmap_format) const
{
- auto new_bitmap = TRY(Gfx::Bitmap::try_create(new_bitmap_format.value_or(format()), { crop.width(), crop.height() }, scale()));
+ auto new_bitmap = TRY(Gfx::Bitmap::create(new_bitmap_format.value_or(format()), { crop.width(), crop.height() }, scale()));
auto scaled_crop = crop * scale();
for (int y = 0; y < scaled_crop.height(); ++y) {
@@ -483,7 +483,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::to_bitmap_backed_by_anonymous_buffer() co
if (m_buffer.is_valid())
return NonnullRefPtr { *this };
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes(), PAGE_SIZE)));
- auto bitmap = TRY(Bitmap::try_create_with_anonymous_buffer(m_format, move(buffer), size(), scale(), palette_to_vector()));
+ auto bitmap = TRY(Bitmap::create_with_anonymous_buffer(m_format, move(buffer), size(), scale(), palette_to_vector()));
memcpy(bitmap->scanline(0), scanline(0), size_in_bytes());
return bitmap;
}
diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h
index 99aad577b8..6d098a0cbf 100644
--- a/Userland/Libraries/LibGfx/Bitmap.h
+++ b/Userland/Libraries/LibGfx/Bitmap.h
@@ -93,14 +93,14 @@ enum RotationDirection {
class Bitmap : public RefCounted<Bitmap> {
public:
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create(BitmapFormat, IntSize, int intrinsic_scale = 1);
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_shareable(BitmapFormat, IntSize, int intrinsic_scale = 1);
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_wrapper(BitmapFormat, IntSize, int intrinsic_scale, size_t pitch, void*);
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_file(StringView path, int scale_factor = 1);
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_fd_and_close(int fd, StringView path);
- [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize, int intrinsic_scale, Vector<ARGB32> const& palette);
- static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_bytes(ReadonlyBytes);
- static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_byte_buffer(ByteBuffer&&);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, IntSize, int intrinsic_scale = 1);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_shareable(BitmapFormat, IntSize, int intrinsic_scale = 1);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_wrapper(BitmapFormat, IntSize, int intrinsic_scale, size_t pitch, void*);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_file(StringView path, int scale_factor = 1);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_fd_and_close(int fd, StringView path);
+ [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize, int intrinsic_scale, Vector<ARGB32> const& palette);
+ static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_bytes(ReadonlyBytes);
+ static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_byte_buffer(ByteBuffer&&);
static bool is_path_a_supported_image_format(StringView path)
{
diff --git a/Userland/Libraries/LibGfx/DDSLoader.cpp b/Userland/Libraries/LibGfx/DDSLoader.cpp
index f69f7fccac..ca84bcb777 100644
--- a/Userland/Libraries/LibGfx/DDSLoader.cpp
+++ b/Userland/Libraries/LibGfx/DDSLoader.cpp
@@ -790,7 +790,7 @@ static ErrorOr<void> decode_dds(DDSLoadingContext& context)
dbgln_if(DDS_DEBUG, "There are {} bytes remaining, we need {} for mipmap level {} of the image", stream.remaining(), needed_bytes, mipmap_level);
VERIFY(stream.remaining() >= needed_bytes);
- context.bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { width, height }));
+ context.bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { width, height }));
decode_bitmap(stream, context, format, width, height);
}
diff --git a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h
index 21d8a0b892..d185e0c046 100644
--- a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h
+++ b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h
@@ -95,7 +95,7 @@ public:
if (&target == &source && (!apply_cache.m_target || !apply_cache.m_target->size().contains(source_rect.size()))) {
// TODO: We probably don't need the entire source_rect, we could inflate
// the target_rect appropriately
- apply_cache.m_target = Gfx::Bitmap::try_create(source.format(), source_rect.size()).release_value_but_fixme_should_propagate_errors();
+ apply_cache.m_target = Gfx::Bitmap::create(source.format(), source_rect.size()).release_value_but_fixme_should_propagate_errors();
target_rect.translate_by(-target_rect.location());
}
diff --git a/Userland/Libraries/LibGfx/Font/Emoji.cpp b/Userland/Libraries/LibGfx/Font/Emoji.cpp
index 5377870292..362a7c54d1 100644
--- a/Userland/Libraries/LibGfx/Font/Emoji.cpp
+++ b/Userland/Libraries/LibGfx/Font/Emoji.cpp
@@ -34,7 +34,7 @@ Bitmap const* Emoji::emoji_for_code_points(Span<u32 const> const& code_points)
if (it != s_emojis.end())
return (*it).value.ptr();
- auto bitmap_or_error = Bitmap::try_load_from_file(DeprecatedString::formatted("/res/emoji/{}.png", basename));
+ auto bitmap_or_error = Bitmap::load_from_file(DeprecatedString::formatted("/res/emoji/{}.png", basename));
if (bitmap_or_error.is_error()) {
s_emojis.set(basename, nullptr);
return nullptr;
diff --git a/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp b/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
index 33be245d67..5b30e02561 100644
--- a/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
+++ b/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
@@ -25,7 +25,7 @@ void PathRasterizer::draw_path(Gfx::Path& path)
RefPtr<Gfx::Bitmap> PathRasterizer::accumulate()
{
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, m_size);
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, m_size);
if (bitmap_or_error.is_error())
return {};
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 2c18e22fad..88c7c48e98 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -273,8 +273,8 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
size_t start_frame = context.current_frame + 1;
if (context.state < GIFLoadingContext::State::FrameComplete) {
start_frame = 0;
- context.frame_buffer = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
- context.prev_frame_buffer = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
+ context.frame_buffer = TRY(Bitmap::create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
+ context.prev_frame_buffer = TRY(Bitmap::create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
} else if (frame_index < context.current_frame) {
start_frame = 0;
diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp
index 4c358ceaca..dd0168d924 100644
--- a/Userland/Libraries/LibGfx/JPGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPGLoader.cpp
@@ -967,7 +967,7 @@ static void ycbcr_to_rgb(JPGLoadingContext const& context, Vector<Macroblock>& m
static ErrorOr<void> compose_bitmap(JPGLoadingContext& context, Vector<Macroblock> const& macroblocks)
{
- context.bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height }));
+ context.bitmap = TRY(Bitmap::create(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height }));
for (u32 y = context.frame.height - 1; y < context.frame.height; y--) {
const u32 block_row = y / 8;
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index a2e7d8dc60..88265df77e 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -574,7 +574,7 @@ static ErrorOr<void> decode_png_bitmap_simple(PNGLoadingContext& context)
}
}
- context.bitmap = TRY(Bitmap::try_create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
+ context.bitmap = TRY(Bitmap::create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
return unfilter(context);
}
@@ -669,7 +669,7 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str
}
}
- subimage_context.bitmap = TRY(Bitmap::try_create(context.bitmap->format(), { subimage_context.width, subimage_context.height }));
+ subimage_context.bitmap = TRY(Bitmap::create(context.bitmap->format(), { subimage_context.width, subimage_context.height }));
TRY(unfilter(subimage_context));
// Copy the subimage data into the main image according to the pass pattern
@@ -684,7 +684,7 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str
static ErrorOr<void> decode_png_adam7(PNGLoadingContext& context)
{
Streamer streamer(context.decompression_buffer->data(), context.decompression_buffer->size());
- context.bitmap = TRY(Bitmap::try_create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
+ context.bitmap = TRY(Bitmap::create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
for (int pass = 1; pass <= 7; ++pass)
TRY(decode_adam7_pass(context, streamer, pass));
return {};
diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
index 74a5ad17b9..5cfd1d29b2 100644
--- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
+++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
@@ -175,7 +175,7 @@ static bool read_max_val(TContext& context, Streamer& streamer)
template<typename TContext>
static bool create_bitmap(TContext& context)
{
- auto bitmap_or_error = Bitmap::try_create(BitmapFormat::BGRx8888, { context.width, context.height });
+ auto bitmap_or_error = Bitmap::create(BitmapFormat::BGRx8888, { context.width, context.height });
if (bitmap_or_error.is_error()) {
context.state = TContext::State::Error;
return false;
diff --git a/Userland/Libraries/LibGfx/QOILoader.cpp b/Userland/Libraries/LibGfx/QOILoader.cpp
index 3ee2cc35ce..f8cde58859 100644
--- a/Userland/Libraries/LibGfx/QOILoader.cpp
+++ b/Userland/Libraries/LibGfx/QOILoader.cpp
@@ -126,7 +126,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(Core::Stream::Stream& str
if (height > NumericLimits<int>::max())
return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, height exceeds maximum Gfx::Bitmap height");
- auto bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { width, height }));
+ auto bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { width, height }));
u8 run = 0;
Color pixel = { 0, 0, 0, 255 };
diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp
index 31ba8ca335..e3f94469fe 100644
--- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp
+++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp
@@ -62,7 +62,7 @@ ErrorOr<Gfx::ShareableBitmap> decode(Decoder& decoder)
palette = TRY(decoder.decode<decltype(palette)>());
auto buffer = TRY(Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), Gfx::Bitmap::size_in_bytes(Gfx::Bitmap::minimum_pitch(size.width() * scale, bitmap_format), size.height() * scale)));
- auto bitmap = TRY(Gfx::Bitmap::try_create_with_anonymous_buffer(bitmap_format, move(buffer), size, scale, palette));
+ auto bitmap = TRY(Gfx::Bitmap::create_with_anonymous_buffer(bitmap_format, move(buffer), size, scale, palette));
return Gfx::ShareableBitmap { move(bitmap), Gfx::ShareableBitmap::ConstructWithKnownGoodBitmap };
}
diff --git a/Userland/Libraries/LibGfx/TGALoader.cpp b/Userland/Libraries/LibGfx/TGALoader.cpp
index e8ee56445c..87ad124a68 100644
--- a/Userland/Libraries/LibGfx/TGALoader.cpp
+++ b/Userland/Libraries/LibGfx/TGALoader.cpp
@@ -285,11 +285,11 @@ ErrorOr<ImageFrameDescriptor> TGAImageDecoderPlugin::frame(size_t index)
RefPtr<Gfx::Bitmap> bitmap;
switch (bits_per_pixel) {
case 24:
- bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRx8888, { m_context->header.width, m_context->header.height }));
+ bitmap = TRY(Bitmap::create(BitmapFormat::BGRx8888, { m_context->header.width, m_context->header.height }));
break;
case 32:
- bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { m_context->header.width, m_context->header.height }));
+ bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { m_context->header.width, m_context->header.height }));
break;
default:
diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp
index 20716237ff..c5a6d00700 100644
--- a/Userland/Libraries/LibPDF/Renderer.cpp
+++ b/Userland/Libraries/LibPDF/Renderer.cpp
@@ -812,10 +812,10 @@ PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> Renderer::load_image(NonnullRefPtr<Stream
if (is_filter(CommonNames::DCTDecode)) {
// TODO: stream objects could store Variant<bytes/Bitmap> to avoid seialisation/deserialisation here
- return TRY(Gfx::Bitmap::try_create_from_serialized_bytes(image->bytes()));
+ return TRY(Gfx::Bitmap::create_from_serialized_bytes(image->bytes()));
}
- auto bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { width, height }));
+ auto bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { width, height }));
int x = 0;
int y = 0;
int const n_components = color_space->number_of_components();
diff --git a/Userland/Libraries/LibSoftGPU/Image.cpp b/Userland/Libraries/LibSoftGPU/Image.cpp
index b96fc9b363..e420d862ad 100644
--- a/Userland/Libraries/LibSoftGPU/Image.cpp
+++ b/Userland/Libraries/LibSoftGPU/Image.cpp
@@ -151,7 +151,7 @@ void Image::regenerate_mipmaps()
auto empty_bitmap_for_level = [&](u32 level) -> NonnullRefPtr<Gfx::Bitmap> {
Gfx::IntSize size = { width_at_level(level), height_at_level(level) };
- return MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size));
+ return MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size));
};
auto copy_image_into_bitmap = [&](u32 level) -> NonnullRefPtr<Gfx::Bitmap> {
auto bitmap = empty_bitmap_for_level(level);
diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp
index 7b5af7c115..997680760d 100644
--- a/Userland/Libraries/LibVT/TerminalWidget.cpp
+++ b/Userland/Libraries/LibVT/TerminalWidget.cpp
@@ -125,12 +125,12 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy)
m_terminal.set_size(Config::read_i32("Terminal"sv, "Window"sv, "Width"sv, 80), Config::read_i32("Terminal"sv, "Window"sv, "Height"sv, 25));
- m_copy_action = GUI::Action::create("&Copy", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_copy_action = GUI::Action::create("&Copy", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
copy();
});
m_copy_action->set_swallow_key_event_when_disabled(true);
- m_paste_action = GUI::Action::create("&Paste", { Mod_Ctrl | Mod_Shift, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
+ m_paste_action = GUI::Action::create("&Paste", { Mod_Ctrl | Mod_Shift, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
paste();
});
m_paste_action->set_swallow_key_event_when_disabled(true);
diff --git a/Userland/Libraries/LibVideo/VideoFrame.h b/Userland/Libraries/LibVideo/VideoFrame.h
index 891cc233ba..577770a9c2 100644
--- a/Userland/Libraries/LibVideo/VideoFrame.h
+++ b/Userland/Libraries/LibVideo/VideoFrame.h
@@ -23,7 +23,7 @@ public:
virtual DecoderErrorOr<void> output_to_bitmap(Gfx::Bitmap& bitmap) = 0;
virtual DecoderErrorOr<NonnullRefPtr<Gfx::Bitmap>> to_bitmap()
{
- auto bitmap = DECODER_TRY_ALLOC(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, m_size));
+ auto bitmap = DECODER_TRY_ALLOC(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, m_size));
TRY(output_to_bitmap(bitmap));
return bitmap;
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
index 52090b55d5..cc373053a3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
@@ -167,7 +167,7 @@ bool HTMLCanvasElement::create_bitmap(size_t minimum_width, size_t minimum_heigh
return false;
}
if (!m_bitmap || m_bitmap->size() != size) {
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size);
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
if (bitmap_or_error.is_error())
return false;
m_bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp
index 426385033f..04ab5b549e 100644
--- a/Userland/Libraries/LibWeb/HTML/ImageData.cpp
+++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp
@@ -25,7 +25,7 @@ JS::GCPtr<ImageData> ImageData::create_with_size(JS::Realm& realm, int width, in
return nullptr;
auto data = JS::NonnullGCPtr<JS::Uint8ClampedArray>(*data_or_error.release_value());
- auto bitmap_or_error = Gfx::Bitmap::try_create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
+ auto bitmap_or_error = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
if (bitmap_or_error.is_error())
return nullptr;
return realm.heap().allocate<ImageData>(realm, realm, bitmap_or_error.release_value(), move(data));
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index f2fa5c9f8b..5b89243886 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -39,7 +39,7 @@ FrameLoader::FrameLoader(HTML::BrowsingContext& browsing_context)
: m_browsing_context(browsing_context)
{
if (!s_default_favicon_bitmap) {
- s_default_favicon_bitmap = Gfx::Bitmap::try_load_from_file(s_default_favicon_path).release_value_but_fixme_should_propagate_errors();
+ s_default_favicon_bitmap = Gfx::Bitmap::load_from_file(s_default_favicon_path).release_value_but_fixme_should_propagate_errors();
VERIFY(s_default_favicon_bitmap);
}
}
diff --git a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
index db94d80214..ad647f0780 100644
--- a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
@@ -210,7 +210,7 @@ void paint_border(PaintContext& context, BorderEdge edge, DevicePixelRect const&
RefPtr<Gfx::Bitmap> get_cached_corner_bitmap(DevicePixelSize corners_size)
{
auto allocate_mask_bitmap = [&]() -> RefPtr<Gfx::Bitmap> {
- auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, corners_size.to_type<int>());
+ auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, corners_size.to_type<int>());
if (!bitmap.is_error())
return bitmap.release_value();
return nullptr;
diff --git a/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp b/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp
index 7c2db4f92b..420f4a8c8f 100644
--- a/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp
@@ -34,7 +34,7 @@ ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(PaintContex
if (!corner_bitmap)
return Error::from_errno(ENOMEM);
} else {
- corner_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, corners_bitmap_size.to_type<int>()));
+ corner_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, corners_bitmap_size.to_type<int>()));
}
CornerData corner_data {
diff --git a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp
index e938b468b0..08061b37db 100644
--- a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp
@@ -164,7 +164,7 @@ void paint_box_shadow(PaintContext& context, CSSPixelRect const& content_rect, B
DevicePixelRect top_edge_rect { top_left_corner_rect.width(), 0, 1, horizontal_top_edge_width };
DevicePixelRect bottom_edge_rect { bottom_left_corner_rect.width(), shadow_bitmap_rect.height() - horizontal_edge_width, 1, horizontal_edge_width };
- auto shadows_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, shadow_bitmap_rect.size().to_type<int>());
+ auto shadows_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, shadow_bitmap_rect.size().to_type<int>());
if (shadows_bitmap.is_error()) {
dbgln("Unable to allocate temporary bitmap {} for box-shadow rendering: {}", shadow_bitmap_rect, shadows_bitmap.error());
return;
@@ -361,7 +361,7 @@ void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fra
text_rect.height() + margin + margin
};
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
- auto maybe_shadow_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size().to_type<int>());
+ auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size().to_type<int>());
if (maybe_shadow_bitmap.is_error()) {
dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", bounding_rect.size(), maybe_shadow_bitmap.error());
return;
diff --git a/Userland/Libraries/LibWebView/DOMTreeModel.cpp b/Userland/Libraries/LibWebView/DOMTreeModel.cpp
index 659803deb4..caa2537d55 100644
--- a/Userland/Libraries/LibWebView/DOMTreeModel.cpp
+++ b/Userland/Libraries/LibWebView/DOMTreeModel.cpp
@@ -20,9 +20,9 @@ DOMTreeModel::DOMTreeModel(JsonObject dom_tree, GUI::TreeView* tree_view)
{
// FIXME: Get these from the outside somehow instead of hard-coding paths here.
#ifdef AK_OS_SERENITY
- m_document_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv).release_value_but_fixme_should_propagate_errors());
- m_element_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
- m_text_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_document_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_element_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_text_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
#endif
map_dom_nodes_to_parent(nullptr, &m_dom_tree);
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
index 6c69e01e54..33f6eabcc0 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
@@ -126,13 +126,13 @@ void OutOfProcessWebView::handle_resize()
if (available_size().is_empty())
return;
- if (auto new_bitmap_or_error = Gfx::Bitmap::try_create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
+ if (auto new_bitmap_or_error = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
m_client_state.front_bitmap.bitmap = new_bitmap_or_error.release_value();
m_client_state.front_bitmap.id = m_client_state.next_bitmap_id++;
client().async_add_backing_store(m_client_state.front_bitmap.id, m_client_state.front_bitmap.bitmap->to_shareable_bitmap());
}
- if (auto new_bitmap_or_error = Gfx::Bitmap::try_create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
+ if (auto new_bitmap_or_error = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
m_client_state.back_bitmap.bitmap = new_bitmap_or_error.release_value();
m_client_state.back_bitmap.id = m_client_state.next_bitmap_id++;
client().async_add_backing_store(m_client_state.back_bitmap.id, m_client_state.back_bitmap.bitmap->to_shareable_bitmap());
diff --git a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp
index f9ade07533..0f3569ce7b 100644
--- a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp
+++ b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp
@@ -39,11 +39,11 @@ RefPtr<Gfx::Bitmap> ConnectionToClipboardServer::get_bitmap()
return nullptr;
auto data = clipping.data().data<void>();
- auto clipping_bitmap_or_error = Gfx::Bitmap::try_create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), const_cast<void*>(data));
+ auto clipping_bitmap_or_error = Gfx::Bitmap::create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), const_cast<void*>(data));
if (clipping_bitmap_or_error.is_error())
return nullptr;
auto clipping_bitmap = clipping_bitmap_or_error.release_value();
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
if (bitmap_or_error.is_error())
return nullptr;
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Services/Taskbar/ClockWidget.cpp b/Userland/Services/Taskbar/ClockWidget.cpp
index 60088cbd95..1676328770 100644
--- a/Userland/Services/Taskbar/ClockWidget.cpp
+++ b/Userland/Services/Taskbar/ClockWidget.cpp
@@ -56,7 +56,7 @@ ClockWidget::ClockWidget()
m_prev_date = navigation_container.add<GUI::Button>();
m_prev_date->set_button_style(Gfx::ButtonStyle::Coolbar);
m_prev_date->set_fixed_size(24, 24);
- m_prev_date->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_prev_date->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors());
m_prev_date->on_click = [&](auto) {
unsigned view_month = m_calendar->view_month();
unsigned view_year = m_calendar->view_year();
@@ -90,7 +90,7 @@ ClockWidget::ClockWidget()
m_next_date = navigation_container.add<GUI::Button>();
m_next_date->set_button_style(Gfx::ButtonStyle::Coolbar);
m_next_date->set_fixed_size(24, 24);
- m_next_date->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_next_date->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors());
m_next_date->on_click = [&](auto) {
unsigned view_month = m_calendar->view_month();
unsigned view_year = m_calendar->view_year();
@@ -140,7 +140,7 @@ ClockWidget::ClockWidget()
m_jump_to_button = settings_container.add<GUI::Button>();
m_jump_to_button->set_button_style(Gfx::ButtonStyle::Coolbar);
m_jump_to_button->set_fixed_size(24, 24);
- m_jump_to_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_jump_to_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-date.png"sv).release_value_but_fixme_should_propagate_errors());
m_jump_to_button->set_tooltip("Jump to today");
m_jump_to_button->on_click = [this](auto) {
jump_to_current_date();
@@ -149,7 +149,7 @@ ClockWidget::ClockWidget()
m_calendar_launcher = settings_container.add<GUI::Button>();
m_calendar_launcher->set_button_style(Gfx::ButtonStyle::Coolbar);
m_calendar_launcher->set_fixed_size(24, 24);
- m_calendar_launcher->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-calendar.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_calendar_launcher->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calendar.png"sv).release_value_but_fixme_should_propagate_errors());
m_calendar_launcher->set_tooltip("Calendar");
m_calendar_launcher->on_click = [this](auto) {
GUI::Process::spawn_or_show_error(window(), "/bin/Calendar"sv);
@@ -199,7 +199,7 @@ void ClockWidget::context_menu_event(GUI::ContextMenuEvent& event)
if (!m_context_menu) {
m_context_menu = GUI::Menu::construct();
- auto settings_icon = MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv));
+ auto settings_icon = MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/settings.png"sv));
auto open_clock_settings_action = GUI::Action::create("Clock &Settings", *settings_icon, [this](auto&) {
GUI::Process::spawn_or_show_error(window(), "/bin/ClockSettings"sv, Array { "--open-tab", "clock" });
});
diff --git a/Userland/Services/Taskbar/QuickLaunchWidget.cpp b/Userland/Services/Taskbar/QuickLaunchWidget.cpp
index 5ea9e0ba91..67fcf07011 100644
--- a/Userland/Services/Taskbar/QuickLaunchWidget.cpp
+++ b/Userland/Services/Taskbar/QuickLaunchWidget.cpp
@@ -113,7 +113,7 @@ QuickLaunchWidget::QuickLaunchWidget()
ErrorOr<void> QuickLaunchWidget::create_context_menu()
{
- auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv));
+ auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv));
m_context_menu = GUI::Menu::construct();
m_context_menu_default_action = GUI::Action::create("&Remove", icon, [this](auto&) {
Config::remove_key("Taskbar"sv, quick_launch, m_context_menu_app_name);
diff --git a/Userland/Services/Taskbar/ShutdownDialog.cpp b/Userland/Services/Taskbar/ShutdownDialog.cpp
index 1123d0a387..7fbdf5ede3 100644
--- a/Userland/Services/Taskbar/ShutdownDialog.cpp
+++ b/Userland/Services/Taskbar/ShutdownDialog.cpp
@@ -63,7 +63,7 @@ ShutdownDialog::ShutdownDialog()
icon_wrapper.set_layout<GUI::VerticalBoxLayout>();
auto& icon_image = icon_wrapper.add<GUI::ImageWidget>();
- icon_image.set_bitmap(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/shutdown.png"sv).release_value_but_fixme_should_propagate_errors());
+ icon_image.set_bitmap(Gfx::Bitmap::load_from_file("/res/icons/32x32/shutdown.png"sv).release_value_but_fixme_should_propagate_errors());
auto& right_container = content_container.add<GUI::Widget>();
right_container.set_layout<GUI::VerticalBoxLayout>();
@@ -113,7 +113,7 @@ ShutdownDialog::ShutdownDialog()
center_on_screen();
set_resizable(false);
set_title("Exit SerenityOS");
- set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/power.png"sv).release_value_but_fixme_should_propagate_errors());
+ set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/power.png"sv).release_value_but_fixme_should_propagate_errors());
// Request WindowServer to re-update us on the current theme as we might've not been alive for the last notification.
refresh_system_theme();
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp
index 827da00bbb..81d0ba45e7 100644
--- a/Userland/Services/Taskbar/TaskbarWindow.cpp
+++ b/Userland/Services/Taskbar/TaskbarWindow.cpp
@@ -83,7 +83,7 @@ ErrorOr<void> TaskbarWindow::populate_taskbar()
(void)TRY(m_task_button_container->try_set_layout<GUI::HorizontalBoxLayout>());
m_task_button_container->layout()->set_spacing(3);
- m_default_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv));
+ m_default_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv));
m_applet_area_container = TRY(main_widget->try_add<GUI::Frame>());
m_applet_area_container->set_frame_thickness(1);
diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp
index 6a46a24e20..533bc5e548 100644
--- a/Userland/Services/Taskbar/main.cpp
+++ b/Userland/Services/Taskbar/main.cpp
@@ -119,7 +119,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
Vector<DeprecatedString> const sorted_app_categories = TRY(discover_apps_and_categories());
auto system_menu = TRY(GUI::Menu::try_create("\xE2\x9A\xA1")); // HIGH VOLTAGE SIGN
- system_menu->add_action(GUI::Action::create("&About SerenityOS", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladyball.png"sv)), [&](auto&) {
+ system_menu->add_action(GUI::Action::create("&About SerenityOS", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/ladyball.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/About"sv);
}));
@@ -154,7 +154,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
auto& category_menu = parent_menu->add_submenu(child_category);
auto category_icon_path = category_icons->read_entry("16x16", category);
if (!category_icon_path.is_empty()) {
- auto icon_or_error = Gfx::Bitmap::try_load_from_file(category_icon_path);
+ auto icon_or_error = Gfx::Bitmap::load_from_file(category_icon_path);
if (!icon_or_error.is_error())
category_menu.set_icon(icon_or_error.release_value());
}
@@ -221,7 +221,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
g_themes_group.set_unchecking_allowed(false);
g_themes_menu = &system_menu->add_submenu("&Themes");
- g_themes_menu->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/themes.png"sv)));
+ g_themes_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/themes.png"sv)));
g_themes = TRY(Gfx::list_installed_system_themes());
auto current_theme_name = GUI::ConnectionToWindowServer::the().get_system_theme();
@@ -254,15 +254,15 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
}
};
- system_menu->add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-settings.png"sv)), [&](auto&) {
+ system_menu->add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-settings.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/Settings"sv);
}));
system_menu->add_separator();
- system_menu->add_action(GUI::Action::create("&Help", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv)), [&](auto&) {
+ system_menu->add_action(GUI::Action::create("&Help", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/Help"sv);
}));
- system_menu->add_action(GUI::Action::create("&Run...", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-run.png"sv)), [](auto&) {
+ system_menu->add_action(GUI::Action::create("&Run...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-run.png"sv)), [](auto&) {
posix_spawn_file_actions_t spawn_actions;
posix_spawn_file_actions_init(&spawn_actions);
auto home_directory = Core::StandardPaths::home_directory();
@@ -280,7 +280,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
posix_spawn_file_actions_destroy(&spawn_actions);
}));
system_menu->add_separator();
- system_menu->add_action(GUI::Action::create("E&xit...", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/power.png"sv)), [](auto&) {
+ system_menu->add_action(GUI::Action::create("E&xit...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/power.png"sv)), [](auto&) {
auto command = ShutdownDialog::show();
if (command.size() == 0)
diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp
index dd7971fac9..44550f791b 100644
--- a/Userland/Services/WebContent/ConnectionFromClient.cpp
+++ b/Userland/Services/WebContent/ConnectionFromClient.cpp
@@ -464,7 +464,7 @@ Messages::WebContentServer::TakeDocumentScreenshotResponse ConnectionFromClient:
auto const& content_size = m_page_host->content_size();
Web::DevicePixelRect rect { { 0, 0 }, content_size };
- auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
+ auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
m_page_host->paint(rect, *bitmap);
return { bitmap->to_shareable_bitmap() };
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index b0b55f119e..96ac96fe16 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -108,20 +108,20 @@ void CompositorScreenData::init_bitmaps(Compositor& compositor, Screen& screen)
auto size = screen.size();
m_front_bitmap = nullptr;
- m_front_bitmap = Gfx::Bitmap::try_create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(0, 0)).release_value_but_fixme_should_propagate_errors();
+ m_front_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(0, 0)).release_value_but_fixme_should_propagate_errors();
m_front_painter = make<Gfx::Painter>(*m_front_bitmap);
m_front_painter->translate(-screen.rect().location());
m_back_bitmap = nullptr;
if (m_screen_can_set_buffer)
- m_back_bitmap = Gfx::Bitmap::try_create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(1, 0)).release_value_but_fixme_should_propagate_errors();
+ m_back_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor(), screen.pitch(), screen.scanline(1, 0)).release_value_but_fixme_should_propagate_errors();
else
- m_back_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
+ m_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
m_back_painter = make<Gfx::Painter>(*m_back_bitmap);
m_back_painter->translate(-screen.rect().location());
m_temp_bitmap = nullptr;
- m_temp_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
+ m_temp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, size, screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
m_temp_painter = make<Gfx::Painter>(*m_temp_bitmap);
m_temp_painter->translate(-screen.rect().location());
@@ -852,7 +852,7 @@ void Compositor::update_wallpaper_bitmap()
void CompositorScreenData::init_wallpaper_bitmap(Screen& screen)
{
- m_wallpaper_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, screen.size(), screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
+ m_wallpaper_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, screen.size(), screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
m_wallpaper_painter = make<Gfx::Painter>(*m_wallpaper_bitmap);
m_wallpaper_painter->translate(-screen.rect().location());
}
@@ -997,7 +997,7 @@ void CompositorScreenData::draw_cursor(Screen& screen, Gfx::IntRect const& curso
auto& wm = WindowManager::the();
if (!m_cursor_back_bitmap || m_cursor_back_bitmap->size() != cursor_rect.size() || m_cursor_back_bitmap->scale() != screen.scale_factor()) {
- m_cursor_back_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, cursor_rect.size(), screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
+ m_cursor_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, cursor_rect.size(), screen.scale_factor()).release_value_but_fixme_should_propagate_errors();
m_cursor_back_painter = make<Gfx::Painter>(*m_cursor_back_bitmap);
}
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp
index 64fedd0e5b..7f81479b9c 100644
--- a/Userland/Services/WindowServer/ConnectionFromClient.cpp
+++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp
@@ -750,7 +750,7 @@ void ConnectionFromClient::set_window_backing_store(i32 window_id, [[maybe_unuse
did_misbehave("SetWindowBackingStore: Failed to create anonymous buffer for window backing store");
return;
}
- auto backing_store_or_error = Gfx::Bitmap::try_create_with_anonymous_buffer(
+ auto backing_store_or_error = Gfx::Bitmap::create_with_anonymous_buffer(
has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888,
buffer_or_error.release_value(),
size,
@@ -1165,7 +1165,7 @@ Messages::WindowServer::GetScreenBitmapResponse ConnectionFromClient::get_screen
}
// TODO: Mixed scale setups at what scale? Lowest? Highest? Configurable?
auto bitmap_size = rect.value_or(Screen::bounding_rect()).size();
- if (auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, bitmap_size, 1); !bitmap_or_error.is_error()) {
+ if (auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, bitmap_size, 1); !bitmap_or_error.is_error()) {
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter(*bitmap);
Screen::for_each([&](auto& screen) {
@@ -1217,7 +1217,7 @@ Messages::WindowServer::GetScreenBitmapAroundLocationResponse ConnectionFromClie
return bitmap_or_error.release_value()->to_shareable_bitmap();
}
- if (auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, rect.size(), 1); !bitmap_or_error.is_error()) {
+ if (auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, rect.size(), 1); !bitmap_or_error.is_error()) {
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
auto bounding_screen_src_rect = Screen::bounding_rect().intersected(rect);
Gfx::Painter painter(*bitmap);
diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp
index 15037b0d8f..daea92f460 100644
--- a/Userland/Services/WindowServer/Cursor.cpp
+++ b/Userland/Services/WindowServer/Cursor.cpp
@@ -46,7 +46,7 @@ bool Cursor::load(StringView filename, StringView default_filename)
bool did_load_any = false;
auto load_bitmap = [&](StringView path, int scale_factor) {
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(path, scale_factor);
if (bitmap_or_error.is_error())
return;
did_load_any = true;
diff --git a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
index c0d33509d7..f421e931d4 100644
--- a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
+++ b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp
@@ -52,7 +52,7 @@ bool MultiScaleBitmaps::load(StringView filename, StringView default_filename)
m_bitmaps.clear(); // If we're reloading the bitmaps get rid of the old ones
auto add_bitmap = [&](StringView path, int scale_factor) {
- auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor);
+ auto bitmap_or_error = Gfx::Bitmap::load_from_file(path, scale_factor);
if (bitmap_or_error.is_error())
return;
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Services/WindowServer/Overlays.cpp b/Userland/Services/WindowServer/Overlays.cpp
index 5724837038..ca805bb986 100644
--- a/Userland/Services/WindowServer/Overlays.cpp
+++ b/Userland/Services/WindowServer/Overlays.cpp
@@ -107,7 +107,7 @@ void RectangularOverlay::render(Gfx::Painter& painter, Screen const& screen)
auto scale_factor = screen.scale_factor();
auto* bitmap = m_rendered_bitmaps->find_bitmap(scale_factor);
if (!bitmap) {
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, rect().size(), scale_factor);
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect().size(), scale_factor);
if (bitmap_or_error.is_error())
return;
auto new_bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
@@ -298,7 +298,7 @@ void DndOverlay::update_rect()
RefPtr<Gfx::Bitmap> DndOverlay::create_bitmap(int scale_factor)
{
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, rect().size(), scale_factor);
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect().size(), scale_factor);
if (bitmap_or_error.is_error())
return {};
auto new_bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 79bda6499e..fc291a3ff3 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -31,7 +31,7 @@ static Gfx::Bitmap& default_window_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file(default_window_icon_path()).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file(default_window_icon_path()).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -39,7 +39,7 @@ static Gfx::Bitmap& minimize_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -47,7 +47,7 @@ static Gfx::Bitmap& maximize_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -55,7 +55,7 @@ static Gfx::Bitmap& restore_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-restore.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-restore.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -63,7 +63,7 @@ static Gfx::Bitmap& close_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -71,7 +71,7 @@ static Gfx::Bitmap& pin_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-pin.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-pin.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -79,7 +79,7 @@ static Gfx::Bitmap& move_icon()
{
static RefPtr<Gfx::Bitmap> s_icon;
if (!s_icon)
- s_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move.png"sv).release_value_but_fixme_should_propagate_errors();
+ s_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/move.png"sv).release_value_but_fixme_should_propagate_errors();
return *s_icon;
}
@@ -152,7 +152,7 @@ void Window::set_rect(Gfx::IntRect const& rect)
m_backing_store = nullptr;
} else if (is_internal() && (!m_backing_store || old_rect.size() != rect.size())) {
auto format = has_alpha_channel() ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888;
- m_backing_store = Gfx::Bitmap::try_create(format, m_rect.size()).release_value_but_fixme_should_propagate_errors();
+ m_backing_store = Gfx::Bitmap::create(format, m_rect.size()).release_value_but_fixme_should_propagate_errors();
m_backing_store_visible_size = m_rect.size();
}
diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp
index 2d8f44bc00..3642f47576 100644
--- a/Userland/Services/WindowServer/WindowFrame.cpp
+++ b/Userland/Services/WindowServer/WindowFrame.cpp
@@ -463,7 +463,7 @@ void WindowFrame::PerScaleRenderedCache::render(WindowFrame& frame, Screen& scre
if (tmp_it != s_tmp_bitmap_cache.end())
tmp_it->value = nullptr;
- auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, frame_rect_including_shadow.size(), scale);
+ auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, frame_rect_including_shadow.size(), scale);
if (bitmap_or_error.is_error()) {
s_tmp_bitmap_cache.remove(scale);
dbgln("Could not create bitmap of size {}: {}", frame_rect_including_shadow.size(), bitmap_or_error.error());
@@ -487,14 +487,14 @@ void WindowFrame::PerScaleRenderedCache::render(WindowFrame& frame, Screen& scre
if (!m_top_bottom || m_top_bottom->width() != frame_rect_including_shadow.width() || m_top_bottom->height() != top_bottom_height || m_top_bottom->scale() != scale) {
if (top_bottom_height > 0)
- m_top_bottom = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { frame_rect_including_shadow.width(), top_bottom_height }, scale).release_value_but_fixme_should_propagate_errors();
+ m_top_bottom = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { frame_rect_including_shadow.width(), top_bottom_height }, scale).release_value_but_fixme_should_propagate_errors();
else
m_top_bottom = nullptr;
m_shadow_dirty = true;
}
if (!m_left_right || m_left_right->height() != frame_rect_including_shadow.height() || m_left_right->width() != left_right_width || m_left_right->scale() != scale) {
if (left_right_width > 0)
- m_left_right = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { left_right_width, frame_rect_including_shadow.height() }, scale).release_value_but_fixme_should_propagate_errors();
+ m_left_right = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { left_right_width, frame_rect_including_shadow.height() }, scale).release_value_but_fixme_should_propagate_errors();
else
m_left_right = nullptr;
m_shadow_dirty = true;
diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp
index 361413440e..f3c79e54f4 100644
--- a/Userland/Utilities/headless-browser.cpp
+++ b/Userland/Utilities/headless-browser.cpp
@@ -692,7 +692,7 @@ static void load_page_for_screenshot_and_exit(HeadlessBrowserPageClient& page_cl
auto output_file = MUST(Core::Stream::File::open(output_file_path, Core::Stream::OpenMode::Write));
auto output_rect = page_client.screen_rect();
- auto output_bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, output_rect.size().to_type<int>()));
+ auto output_bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, output_rect.size().to_type<int>()));
page_client.paint(output_rect, output_bitmap);
diff --git a/Userland/Utilities/image2bin.cpp b/Userland/Utilities/image2bin.cpp
index bdfa3d68bd..935ea3421c 100644
--- a/Userland/Utilities/image2bin.cpp
+++ b/Userland/Utilities/image2bin.cpp
@@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(path, "Path to image", "path");
args_parser.parse(arguments);
- auto bitmap = TRY(Gfx::Bitmap::try_load_from_file(path));
+ auto bitmap = TRY(Gfx::Bitmap::load_from_file(path));
TRY(Core::System::pledge("stdio"));
Vector<u8> data;
diff --git a/Userland/Utilities/notify.cpp b/Userland/Utilities/notify.cpp
index dc5817949b..15609acce5 100644
--- a/Userland/Utilities/notify.cpp
+++ b/Userland/Utilities/notify.cpp
@@ -27,7 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
notification->set_text(message);
notification->set_title(title);
if (!icon_path.is_empty()) {
- notification->set_icon(TRY(Gfx::Bitmap::try_load_from_file(icon_path)));
+ notification->set_icon(TRY(Gfx::Bitmap::load_from_file(icon_path)));
}
notification->show();
diff --git a/Userland/Utilities/wallpaper.cpp b/Userland/Utilities/wallpaper.cpp
index 247322c2fc..73cb08898b 100644
--- a/Userland/Utilities/wallpaper.cpp
+++ b/Userland/Utilities/wallpaper.cpp
@@ -65,7 +65,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return Error::from_string_literal("No wallpapers found");
auto& chosen_wallpaper_path = wallpaper_paths.at(get_random_uniform(wallpaper_paths.size()));
- auto chosen_wallpaper_bitmap = TRY(Gfx::Bitmap::try_load_from_file(chosen_wallpaper_path));
+ auto chosen_wallpaper_bitmap = TRY(Gfx::Bitmap::load_from_file(chosen_wallpaper_path));
if (!GUI::Desktop::the().set_wallpaper(chosen_wallpaper_bitmap, chosen_wallpaper_path))
return Error::from_string_literal("Failed to set wallpaper");
@@ -74,7 +74,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (path.is_null())
return Error::from_string_literal("Must provide a path to a wallpaper");
- auto wallpaper_bitmap = TRY(Gfx::Bitmap::try_load_from_file(path));
+ auto wallpaper_bitmap = TRY(Gfx::Bitmap::load_from_file(path));
if (!GUI::Desktop::the().set_wallpaper(wallpaper_bitmap, path))
return Error::from_string_literal("Failed to set wallpaper");
}