mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-16 13:14:44 +00:00
Use working color space to draw ColorSliders (#1576)
This commit is contained in:
parent
6ca0ecf193
commit
c0326f7d6b
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -8,6 +9,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/color_spaces.h"
|
||||
#include "app/color_utils.h"
|
||||
#include "app/modules/gfx.h"
|
||||
#include "app/ui/color_sliders.h"
|
||||
@ -55,6 +58,9 @@ namespace {
|
||||
return;
|
||||
}
|
||||
|
||||
// Color space conversion
|
||||
auto convertColor = convert_from_current_to_screen_color_space();
|
||||
|
||||
gfx::Color color = gfx::ColorNone;
|
||||
int w = MAX(rc.w-1, 1);
|
||||
|
||||
@ -113,7 +119,7 @@ namespace {
|
||||
app::Color::fromGray(255 * x / w));
|
||||
break;
|
||||
}
|
||||
g->drawVLine(color, rc.x+x, rc.y, rc.h);
|
||||
g->drawVLine(convertColor(color), rc.x+x, rc.y, rc.h);
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,6 +257,9 @@ ColorSliders::ColorSliders()
|
||||
addSlider(Channel::HslLightness, "L", 0, 100, -100, 100);
|
||||
addSlider(Channel::Gray, "V", 0, 255, -100, 100);
|
||||
addSlider(Channel::Alpha, "A", 0, 255, -100, 100);
|
||||
|
||||
m_appConn = App::instance()
|
||||
->ColorSpaceChange.connect([this]{ invalidate(); });
|
||||
}
|
||||
|
||||
void ColorSliders::setColor(const app::Color& color)
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (c) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -9,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/color.h"
|
||||
#include "obs/connection.h"
|
||||
#include "obs/signal.h"
|
||||
#include "ui/event.h"
|
||||
#include "ui/grid.h"
|
||||
@ -88,6 +90,7 @@ namespace app {
|
||||
int m_lockSlider;
|
||||
int m_lockEntry;
|
||||
app::Color m_color;
|
||||
obs::scoped_connection m_appConn;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user