mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:37:46 +00:00
LibGfx: Remove try_
prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit it.
This commit is contained in:
parent
1971bff314
commit
82a152b696
186 changed files with 598 additions and 598 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue