mirror of https://github.com/aseprite/aseprite.git
Add some colors for cel edges/guides in doc pref
This commit is contained in:
parent
37748c3783
commit
fb64d5406a
|
|
@ -280,6 +280,11 @@
|
||||||
<option id="opacity" type="int" default="160" migrate="PixelGrid.Opacity" />
|
<option id="opacity" type="int" default="160" migrate="PixelGrid.Opacity" />
|
||||||
<option id="auto_opacity" type="bool" default="true" migrate="PixelGrid.AutoOpacity" />
|
<option id="auto_opacity" type="bool" default="true" migrate="PixelGrid.AutoOpacity" />
|
||||||
</section>
|
</section>
|
||||||
|
<section id="guides">
|
||||||
|
<option id="layer_edges_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||||
|
<option id="default_slice_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||||
|
<option id="automatic_guides_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255, 128)" />
|
||||||
|
</section>
|
||||||
<section id="bg">
|
<section id="bg">
|
||||||
<option id="type" type="BgType" default="BgType::CHECKED_16x16" migrate="Option.CheckedBgType" />
|
<option id="type" type="BgType" default="BgType::CHECKED_16x16" migrate="Option.CheckedBgType" />
|
||||||
<option id="zoom" type="bool" default="true" migrate="Option.CheckedBgZoom" />
|
<option id="zoom" type="bool" default="true" migrate="Option.CheckedBgZoom" />
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@
|
||||||
<color id="editor_face" value="#655561" />
|
<color id="editor_face" value="#655561" />
|
||||||
<color id="editor_sprite_border" value="#000000" />
|
<color id="editor_sprite_border" value="#000000" />
|
||||||
<color id="editor_sprite_bottom_border" value="#41412c" />
|
<color id="editor_sprite_bottom_border" value="#41412c" />
|
||||||
<color id="editor_layer_edges" value="#0000ff" />
|
|
||||||
<color id="editor_view_face" value="#000000" />
|
<color id="editor_view_face" value="#000000" />
|
||||||
<color id="listitem_normal_text" value="#000000" />
|
<color id="listitem_normal_text" value="#000000" />
|
||||||
<color id="listitem_normal_face" value="#ffffff" />
|
<color id="listitem_normal_face" value="#ffffff" />
|
||||||
|
|
|
||||||
|
|
@ -805,8 +805,12 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||||
m_state->requireBrushPreview()) {
|
m_state->requireBrushPreview()) {
|
||||||
Cel* cel = (m_layer ? m_layer->cel(m_frame): nullptr);
|
Cel* cel = (m_layer ? m_layer->cel(m_frame): nullptr);
|
||||||
if (cel) {
|
if (cel) {
|
||||||
drawCelBounds(g, cel);
|
drawCelBounds(
|
||||||
if (m_showGuidesThisCel != cel)
|
g, cel,
|
||||||
|
color_utils::color_for_ui(m_docPref.guides.layerEdgesColor()));
|
||||||
|
|
||||||
|
if (showGuidesThisCel &&
|
||||||
|
m_showGuidesThisCel != cel)
|
||||||
drawCelGuides(g, cel, m_showGuidesThisCel);
|
drawCelGuides(g, cel, m_showGuidesThisCel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1019,10 +1023,9 @@ void Editor::drawSlices(ui::Graphics* g)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::drawCelBounds(ui::Graphics* g, const Cel* cel)
|
void Editor::drawCelBounds(ui::Graphics* g, const Cel* cel, const gfx::Color color)
|
||||||
{
|
{
|
||||||
g->drawRect(SkinTheme::instance()->colors.editorLayerEdges(),
|
g->drawRect(color, getCelScreenBounds(cel));
|
||||||
getCelScreenBounds(cel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel)
|
void Editor::drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel)
|
||||||
|
|
@ -1034,7 +1037,10 @@ void Editor::drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel)
|
||||||
if (mouseCel) {
|
if (mouseCel) {
|
||||||
scrCmpBounds = getCelScreenBounds(mouseCel);
|
scrCmpBounds = getCelScreenBounds(mouseCel);
|
||||||
sprCmpBounds = mouseCel->bounds();
|
sprCmpBounds = mouseCel->bounds();
|
||||||
drawCelBounds(g, mouseCel);
|
|
||||||
|
drawCelBounds(
|
||||||
|
g, mouseCel,
|
||||||
|
color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor()));
|
||||||
}
|
}
|
||||||
// Use whole canvas
|
// Use whole canvas
|
||||||
else {
|
else {
|
||||||
|
|
@ -1110,7 +1116,7 @@ void Editor::drawCelHGuide(ui::Graphics* g,
|
||||||
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
||||||
const int dottedX)
|
const int dottedX)
|
||||||
{
|
{
|
||||||
auto color = SkinTheme::instance()->colors.editorLayerEdges();
|
auto color = color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor());
|
||||||
g->drawHLine(color, scrX1, scrY, scrX2 - scrX1);
|
g->drawHLine(color, scrX1, scrY, scrX2 - scrX1);
|
||||||
|
|
||||||
// Vertical guide to touch the horizontal line
|
// Vertical guide to touch the horizontal line
|
||||||
|
|
@ -1126,7 +1132,7 @@ void Editor::drawCelHGuide(ui::Graphics* g,
|
||||||
auto text = base::convert_to<std::string>(ABS(sprX2 - sprX1)) + "px";
|
auto text = base::convert_to<std::string>(ABS(sprX2 - sprX1)) + "px";
|
||||||
const int textW = Graphics::measureUITextLength(text, font());
|
const int textW = Graphics::measureUITextLength(text, font());
|
||||||
g->drawText(text,
|
g->drawText(text,
|
||||||
gfx::rgba(255, 255, 255, 255), color,
|
color_utils::blackandwhite_neg(color), color,
|
||||||
gfx::Point((scrX1+scrX2)/2-textW/2, scrY-textHeight()));
|
gfx::Point((scrX1+scrX2)/2-textW/2, scrY-textHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1136,7 +1142,7 @@ void Editor::drawCelVGuide(ui::Graphics* g,
|
||||||
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
||||||
const int dottedY)
|
const int dottedY)
|
||||||
{
|
{
|
||||||
auto color = SkinTheme::instance()->colors.editorLayerEdges();
|
auto color = color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor());
|
||||||
g->drawVLine(color, scrX, scrY1, scrY2 - scrY1);
|
g->drawVLine(color, scrX, scrY1, scrY2 - scrY1);
|
||||||
|
|
||||||
// Horizontal guide to touch the vertical line
|
// Horizontal guide to touch the vertical line
|
||||||
|
|
@ -1151,7 +1157,7 @@ void Editor::drawCelVGuide(ui::Graphics* g,
|
||||||
|
|
||||||
auto text = base::convert_to<std::string>(ABS(sprY2 - sprY1)) + "px";
|
auto text = base::convert_to<std::string>(ABS(sprY2 - sprY1)) + "px";
|
||||||
g->drawText(text,
|
g->drawText(text,
|
||||||
gfx::rgba(255, 255, 255, 255), color,
|
color_utils::blackandwhite_neg(color), color,
|
||||||
gfx::Point(scrX, (scrY1+scrY2)/2-textHeight()/2));
|
gfx::Point(scrX, (scrY1+scrY2)/2-textHeight()/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ namespace app {
|
||||||
void drawGrid(ui::Graphics* g, const gfx::Rect& spriteBounds, const gfx::Rect& gridBounds,
|
void drawGrid(ui::Graphics* g, const gfx::Rect& spriteBounds, const gfx::Rect& gridBounds,
|
||||||
const app::Color& color, int alpha);
|
const app::Color& color, int alpha);
|
||||||
void drawSlices(ui::Graphics* g);
|
void drawSlices(ui::Graphics* g);
|
||||||
void drawCelBounds(ui::Graphics* g, const Cel* cel);
|
void drawCelBounds(ui::Graphics* g, const Cel* cel, const gfx::Color color);
|
||||||
void drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel);
|
void drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel);
|
||||||
void drawCelHGuide(ui::Graphics* g,
|
void drawCelHGuide(ui::Graphics* g,
|
||||||
const int sprX1, const int sprX2,
|
const int sprX1, const int sprX2,
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/palette_picks.h"
|
#include "doc/palette_picks.h"
|
||||||
#include "doc/remap.h"
|
#include "doc/remap.h"
|
||||||
|
#include "doc/slice.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
@ -467,6 +468,13 @@ public:
|
||||||
m_transaction.execute(new cmd::SetMask(m_document, newMask));
|
m_transaction.execute(new cmd::SetMask(m_document, newMask));
|
||||||
}
|
}
|
||||||
void addSlice(Slice* newSlice) override {
|
void addSlice(Slice* newSlice) override {
|
||||||
|
auto color = m_docPref.guides.defaultSliceColor();
|
||||||
|
newSlice->userData().setColor(
|
||||||
|
doc::rgba(color.getRed(),
|
||||||
|
color.getGreen(),
|
||||||
|
color.getBlue(),
|
||||||
|
color.getAlpha()));
|
||||||
|
|
||||||
m_transaction.execute(new cmd::AddSlice(m_sprite, newSlice));
|
m_transaction.execute(new cmd::AddSlice(m_sprite, newSlice));
|
||||||
}
|
}
|
||||||
gfx::Point getMaskOrigin() override { return m_maskOrigin; }
|
gfx::Point getMaskOrigin() override { return m_maskOrigin; }
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ Slice::Slice()
|
||||||
, m_owner(nullptr)
|
, m_owner(nullptr)
|
||||||
, m_name("Slice")
|
, m_name("Slice")
|
||||||
{
|
{
|
||||||
// TODO default color should be configurable
|
|
||||||
userData().setColor(doc::rgba(0, 0, 255, 255));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Slice::~Slice()
|
Slice::~Slice()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue