mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 11:42:30 +00:00
Add DocumentApi::bgColor() member functions
This commit is contained in:
parent
1ac99c04ae
commit
55bfbf5f8b
@ -22,8 +22,11 @@
|
||||
|
||||
#include "app/document_api.h"
|
||||
|
||||
#include "app/color_target.h"
|
||||
#include "app/color_utils.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_undo.h"
|
||||
#include "app/settings/settings.h"
|
||||
#include "app/undoers/add_cel.h"
|
||||
#include "app/undoers/add_frame.h"
|
||||
#include "app/undoers/add_image.h"
|
||||
@ -56,6 +59,7 @@
|
||||
#include "app/undoers/set_sprite_transparent_color.h"
|
||||
#include "app/undoers/set_total_frames.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/context.h"
|
||||
#include "doc/document_event.h"
|
||||
#include "doc/document_observer.h"
|
||||
#include "raster/algorithm/flip_image.h"
|
||||
@ -72,7 +76,6 @@
|
||||
#include "raster/sprite.h"
|
||||
#include "raster/stock.h"
|
||||
|
||||
|
||||
namespace app {
|
||||
|
||||
DocumentApi::DocumentApi(Document* document, undo::UndoersCollector* undoers)
|
||||
@ -1364,4 +1367,29 @@ bool DocumentApi::undoEnabled()
|
||||
m_document->getUndo()->isEnabled();
|
||||
}
|
||||
|
||||
raster::color_t DocumentApi::bgColor()
|
||||
{
|
||||
app::ISettings* appSettings =
|
||||
dynamic_cast<app::ISettings*>(m_document->context()->settings());
|
||||
|
||||
return color_utils::color_for_target(
|
||||
appSettings ? appSettings->getBgColor(): Color::fromMask(),
|
||||
ColorTarget(ColorTarget::BackgroundLayer,
|
||||
m_document->sprite()->pixelFormat(),
|
||||
m_document->sprite()->transparentColor()));
|
||||
}
|
||||
|
||||
raster::color_t DocumentApi::bgColor(Layer* layer)
|
||||
{
|
||||
app::ISettings* appSettings =
|
||||
dynamic_cast<app::ISettings*>(m_document->context()->settings());
|
||||
|
||||
if (layer->isBackground())
|
||||
return color_utils::color_for_layer(
|
||||
appSettings ? appSettings->getBgColor(): Color::fromMask(),
|
||||
layer);
|
||||
else
|
||||
return layer->sprite()->transparentColor();
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -138,6 +138,9 @@ namespace app {
|
||||
void configureLayerAsBackground(LayerImage* layer);
|
||||
bool undoEnabled();
|
||||
|
||||
raster::color_t bgColor();
|
||||
raster::color_t bgColor(Layer* layer);
|
||||
|
||||
Document* m_document;
|
||||
undo::UndoersCollector* m_undoers;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user