refactoring
This commit is contained in:
@@ -1108,7 +1108,7 @@ namespace paint
|
||||
::nana::color graphics::palette(bool for_text) const
|
||||
{
|
||||
if (impl_->handle)
|
||||
return static_cast<color_rgb>(for_text ? impl_->handle->get_text_color() : impl_->handle->get_color());
|
||||
return static_cast<color_rgb>(for_text ? impl_->handle->fgcolor_rgb : impl_->handle->bgcolor_rgb);
|
||||
|
||||
return{};
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ namespace paint
|
||||
if (impl_->handle)
|
||||
{
|
||||
#if defined(NANA_WINDOWS)
|
||||
::SetPixel(impl_->handle->context, x, y, NANA_RGB(impl_->handle->get_color()));
|
||||
::SetPixel(impl_->handle->context, x, y, impl_->handle->bgcolor_native);
|
||||
#elif defined(NANA_X11)
|
||||
Display* disp = nana::detail::platform_spec::instance().open_display();
|
||||
impl_->handle->update_color();
|
||||
@@ -1336,14 +1336,14 @@ namespace paint
|
||||
#if defined(NANA_WINDOWS)
|
||||
if (pos1 != pos2)
|
||||
{
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, NANA_RGB(impl_->handle->get_color())));
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, impl_->handle->bgcolor_native));
|
||||
|
||||
::MoveToEx(impl_->handle->context, pos1.x, pos1.y, 0);
|
||||
::LineTo(impl_->handle->context, pos2.x, pos2.y);
|
||||
|
||||
::DeleteObject(::SelectObject(impl_->handle->context, prv_pen));
|
||||
}
|
||||
::SetPixel(impl_->handle->context, pos2.x, pos2.y, NANA_RGB(impl_->handle->get_color()));
|
||||
::SetPixel(impl_->handle->context, pos2.x, pos2.y, impl_->handle->bgcolor_native);
|
||||
#elif defined(NANA_X11)
|
||||
Display* disp = nana::detail::platform_spec::instance().open_display();
|
||||
impl_->handle->update_color();
|
||||
@@ -1369,7 +1369,7 @@ namespace paint
|
||||
{
|
||||
if (!impl_->handle) return;
|
||||
#if defined(NANA_WINDOWS)
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, NANA_RGB(impl_->handle->get_color())));
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, impl_->handle->bgcolor_native));
|
||||
|
||||
::LineTo(impl_->handle->context, pos.x, pos.y);
|
||||
|
||||
@@ -1402,7 +1402,7 @@ namespace paint
|
||||
{
|
||||
#if defined(NANA_WINDOWS)
|
||||
|
||||
auto brush = ::CreateSolidBrush(NANA_RGB(impl_->handle->get_color()));
|
||||
auto brush = ::CreateSolidBrush(impl_->handle->bgcolor_native);
|
||||
|
||||
::RECT native_r = { r.x, r.y, r.right(), r.bottom()};
|
||||
|
||||
@@ -1527,6 +1527,7 @@ namespace paint
|
||||
if (impl_->changed == false) impl_->changed = true;
|
||||
}
|
||||
|
||||
#define NANA_WINDOWS_RGB(a) (((DWORD)(a) & 0xFF)<<16) | ((DWORD)(a) & 0xFF00) | (((DWORD)(a) & 0xFF0000) >> 16 )
|
||||
void graphics::round_rectangle(const ::nana::rectangle& r, unsigned radius_x, unsigned radius_y, const color& clr, bool solid, const color& solid_clr)
|
||||
{
|
||||
if (impl_->handle)
|
||||
@@ -1536,8 +1537,8 @@ namespace paint
|
||||
|
||||
if (solid)
|
||||
{
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, NANA_RGB(impl_->handle->get_color())));
|
||||
auto prv_brush = ::SelectObject(impl_->handle->context, ::CreateSolidBrush(NANA_RGB(solid_clr.px_color().value)));
|
||||
auto prv_pen = ::SelectObject(impl_->handle->context, ::CreatePen(PS_SOLID, 1, impl_->handle->bgcolor_native));
|
||||
auto prv_brush = ::SelectObject(impl_->handle->context, ::CreateSolidBrush(NANA_WINDOWS_RGB(solid_clr.px_color().value)));
|
||||
|
||||
::RoundRect(impl_->handle->context, r.x, r.y, r.right(), r.bottom(), static_cast<int>(radius_x * 2), static_cast<int>(radius_y * 2));
|
||||
|
||||
@@ -1546,7 +1547,7 @@ namespace paint
|
||||
}
|
||||
else
|
||||
{
|
||||
auto brush = ::CreateSolidBrush(NANA_RGB(impl_->handle->get_color()));
|
||||
auto brush = ::CreateSolidBrush(impl_->handle->bgcolor_native);
|
||||
|
||||
auto region = ::CreateRoundRectRgn(r.x, r.y, r.x + static_cast<int>(r.width) + 1, r.y + static_cast<int>(r.height) + 1, static_cast<int>(radius_x + 1), static_cast<int>(radius_y + 1));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user