mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
PixelPaint: Add loading and saving of color palettes
Color palettes can now be stored in and read from files. The default palette will be read from `/res/color-palettes/default.palette` instead of being hard-coded in PaletteWidget. The file format is one color per line, in any format that can be understood by `Gfx::Color::from_string`.
This commit is contained in:
parent
5ac9494483
commit
8d91dbf6c0
5 changed files with 213 additions and 41 deletions
|
@ -1,11 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Felix Rauch <noreply@felixrau.ch>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Result.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
@ -21,6 +24,14 @@ public:
|
|||
void set_primary_color(Color);
|
||||
void set_secondary_color(Color);
|
||||
|
||||
void display_color_list(Vector<Color> const&);
|
||||
|
||||
Vector<Color> colors();
|
||||
|
||||
static Result<Vector<Color>, String> load_palette_file(String const&);
|
||||
static Result<void, String> save_palette_file(Vector<Color>, String const&);
|
||||
static Vector<Color> fallback_colors();
|
||||
|
||||
void set_image_editor(ImageEditor&);
|
||||
|
||||
private:
|
||||
|
@ -29,6 +40,7 @@ private:
|
|||
ImageEditor* m_editor { nullptr };
|
||||
RefPtr<GUI::Frame> m_primary_color_widget;
|
||||
RefPtr<GUI::Frame> m_secondary_color_widget;
|
||||
RefPtr<GUI::Widget> m_color_container;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue