Minor changes removing "using namespace doc" from app/color.h

This commit is contained in:
David Capello 2023-07-17 15:02:15 -03:00
parent 86a50e2e9a
commit e84bee0f99
11 changed files with 30 additions and 27 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2020-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -30,6 +30,7 @@
namespace app {
using namespace doc;
using namespace gfx;
// static

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -20,8 +21,6 @@ namespace doc {
namespace app {
using namespace doc;
class Color {
public:
enum Type {
@ -48,13 +47,14 @@ namespace app {
static Color fromGray(int g, int a = 255);
static Color fromIndex(int index);
static Color fromImage(PixelFormat pixelFormat, color_t c);
static Color fromImageGetPixel(Image* image, int x, int y);
static Color fromImage(doc::PixelFormat pixelFormat, doc::color_t c);
static Color fromImageGetPixel(doc::Image* image, int x, int y);
static Color fromString(const std::string& str);
Color toRgb() const;
std::string toString() const;
std::string toHumanReadableString(PixelFormat format, HumanReadableString type) const;
std::string toHumanReadableString(doc::PixelFormat format,
HumanReadableString type) const;
bool operator==(const Color& other) const;
bool operator!=(const Color& other) const {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -26,6 +26,7 @@
namespace app {
using namespace app::skin;
using namespace doc;
using namespace filters;
using namespace ui;

View File

@ -149,7 +149,7 @@ void Param<doc::ColorMode>::fromString(const std::string& value)
template<>
void Param<doc::AniDir>::fromString(const std::string& value)
{
setValue(convert_string_to_anidir(value));
setValue(doc::convert_string_to_anidir(value));
}
template<>

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -27,6 +27,7 @@
namespace app {
using namespace base;
using namespace doc;
namespace {

View File

@ -22,6 +22,8 @@
namespace app {
using namespace doc;
namespace {
const char* kBgShaderCode = R"(

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2023 Igara Studio S.A.
// Copyright (C) 2018 David Capello
//
// This program is distributed under the terms of
@ -18,6 +18,8 @@
namespace app {
namespace script {
using namespace doc;
namespace {
struct SlicesObj {

View File

@ -67,7 +67,7 @@ namespace app {
ColorBar(int align, ui::TooltipManager* tooltipManager);
~ColorBar();
void setPixelFormat(PixelFormat pixelFormat);
void setPixelFormat(doc::PixelFormat pixelFormat);
app::Color getFgColor() const;
app::Color getBgColor() const;
@ -151,7 +151,7 @@ namespace app {
void onPickSpectrum(const app::Color& color, ui::MouseButton button);
void onReverseColors();
void onSortBy(doc::SortPaletteBy channel);
void onGradient(GradientType gradientType);
void onGradient(doc::GradientType gradientType);
void onFixWarningClick(ColorButton* colorButton, ui::Button* warningIcon);
void onTimerTick();
void setAscending(bool ascending);
@ -161,7 +161,7 @@ namespace app {
void onPaletteViewIndexChange(int index, ui::MouseButton button) override;
void onPaletteViewModification(const doc::Palette* newPalette, PaletteViewModification mod) override;
void onPaletteViewChangeSize(PaletteView* paletteView, int boxsize) override;
void onPaletteViewPasteColors(const Palette* fromPal, const doc::PalettePicks& from, const doc::PalettePicks& to) override;
void onPaletteViewPasteColors(const doc::Palette* fromPal, const doc::PalettePicks& from, const doc::PalettePicks& to) override;
app::Color onPaletteViewGetForegroundIndex() override;
app::Color onPaletteViewGetBackgroundIndex() override;
doc::tile_index onPaletteViewGetForegroundTile() override;

View File

@ -30,12 +30,12 @@ namespace app {
public IColorSource {
public:
ColorButton(const app::Color& color,
const PixelFormat pixelFormat,
const doc::PixelFormat pixelFormat,
const ColorButtonOptions& options);
~ColorButton();
PixelFormat pixelFormat() const;
void setPixelFormat(PixelFormat pixelFormat);
doc::PixelFormat pixelFormat() const;
void setPixelFormat(doc::PixelFormat pixelFormat);
app::Color getColor() const;
void setColor(const app::Color& color);
@ -78,7 +78,7 @@ namespace app {
app::Color m_color;
app::Color m_startDragColor;
PixelFormat m_pixelFormat;
doc::PixelFormat m_pixelFormat;
ColorPopup* m_window;
gfx::Rect m_windowDefaultBounds;
gfx::Rect m_hiddenPopupBounds;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2020-2023 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -11,6 +11,7 @@
#include "app/ui/user_data_view.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "app/pref/preferences.h"
#include "app/ui/color_button.h"
#include "base/scoped_value.h"
@ -64,8 +65,7 @@ void UserDataView::configureAndSet(const doc::UserData& userData, ui::Grid* pare
m_isConfigured = true;
}
m_userData = userData;
color_t c = userData.color();
color()->setColor(Color::fromRgb(rgba_getr(c),rgba_getg(c), rgba_getb(c), rgba_geta(c)));
color()->setColor(Color::fromImage(doc::IMAGE_RGB, userData.color()));
entry()->setText(m_userData.text());
setVisible(isVisible());
}
@ -96,14 +96,10 @@ void UserDataView::onEntryChange()
void UserDataView::onColorChange()
{
color_t c = m_userData.color();
app::Color oldColor = app::Color::fromRgb(rgba_getr(c), rgba_getg(c), rgba_getb(c), rgba_geta(c));
app::Color oldColor = app::Color::fromImage(doc::IMAGE_RGB, m_userData.color());
app::Color newColor = color()->getColor();
if (newColor != oldColor) {
m_userData.setColor(rgba(newColor.getRed(),
newColor.getGreen(),
newColor.getBlue(),
newColor.getAlpha()));
m_userData.setColor(color_utils::color_for_image(newColor, doc::IMAGE_RGB));
if (!m_selfUpdate)
UserDataChange();
}

View File

@ -9,10 +9,10 @@
#define RENDER_RENDER_H_INCLUDED
#pragma once
#include "doc/doc.h"
#include "doc/anidir.h"
#include "doc/blend_mode.h"
#include "doc/color.h"
#include "doc/doc.h"
#include "doc/frame.h"
#include "doc/pixel_format.h"
#include "gfx/clip.h"