Skip to content

Commit 63995c6

Browse files
committed
Merge "raster" namespace into "doc" library
1 parent d796256 commit 63995c6

File tree

395 files changed

+2591
-3535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+2591
-3535
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ set(aseprite_libraries
2828
cfg-lib
2929
css-lib
3030
doc-lib
31-
raster-lib
3231
scripting-lib
3332
undo-lib
3433
filters-lib
@@ -206,7 +205,6 @@ add_subdirectory(filters)
206205
add_subdirectory(fixmath)
207206
add_subdirectory(gen)
208207
add_subdirectory(gfx)
209-
add_subdirectory(raster)
210208
add_subdirectory(scripting)
211209
add_subdirectory(she)
212210
add_subdirectory(ui)
@@ -322,8 +320,7 @@ endfunction()
322320

323321
find_tests(base base-lib ${sys_libs})
324322
find_tests(gfx gfx-lib base-lib ${sys_libs})
325-
find_tests(raster raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
326-
find_tests(doc doc-lib raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
323+
find_tests(doc doc-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
327324
find_tests(css css-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
328325
find_tests(ui ui-lib she gfx-lib base-lib ${libs3rdparty} ${sys_libs})
329326
find_tests(app/file ${all_libs})

src/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ because they don't depend on any other component.
2323
## Level 1
2424

2525
* [cfg](cfg/) (base): Library to load/save .ini files.
26+
* [doc](doc/) (base, gfx): Document model library.
2627
* [gen](gen/) (base): Helper utility to generate C++ files from different XMLs.
2728
* [net](net/) (base): Networking library to send HTTP requests.
28-
* [raster](raster/) (base, gfx): Library to handle graphics entities like sprites, images, frames.
2929
* [she](she/) (base, gfx, allegro): A wrapper for the Allegro library.
3030
* [webserver](webserver/) (base): HTTP web server (based on [mongoose](https://github.com/valenok/mongoose))
3131

3232
## Level 2
3333

34-
* [doc](doc/) (raster, base, gfx): Document model library.
35-
* [filters](filters/) (base, gfx, raster): FX for raster images.
34+
* [filters](filters/) (base, doc, gfx): Effects for images.
3635
* [ui](ui/) (base, gfx, she): Portable UI library (buttons, windows, text fields, etc.)
3736
* [updater](updater/) (base, net): Component to check for updates.
3837

@@ -42,7 +41,7 @@ because they don't depend on any other component.
4241

4342
## Level 4
4443

45-
* [app](app/) (allegro, base, doc, filters, gfx, iff, raster, scripting, she, ui, undo, updater, webserver)
44+
* [app](app/) (allegro, base, doc, filters, gfx, iff, scripting, she, ui, undo, updater, webserver)
4645

4746
## Level 5
4847

src/app/app.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
#include "base/path.h"
6868
#include "base/unique_ptr.h"
6969
#include "doc/document_observer.h"
70-
#include "raster/image.h"
71-
#include "raster/layer.h"
72-
#include "raster/palette.h"
73-
#include "raster/sprite.h"
70+
#include "doc/image.h"
71+
#include "doc/layer.h"
72+
#include "doc/palette.h"
73+
#include "doc/sprite.h"
7474
#include "scripting/engine.h"
7575
#include "she/display.h"
7676
#include "she/error.h"

src/app/app.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "base/string.h"
2525
#include "base/system_console.h"
2626
#include "base/unique_ptr.h"
27-
#include "raster/pixel_format.h"
27+
#include "doc/pixel_format.h"
2828

2929
#include <string>
3030
#include <vector>
@@ -35,7 +35,7 @@ namespace ui {
3535
class Window;
3636
}
3737

38-
namespace raster {
38+
namespace doc {
3939
class Layer;
4040
}
4141

@@ -53,7 +53,7 @@ namespace app {
5353
class ToolBox;
5454
}
5555

56-
using namespace raster;
56+
using namespace doc;
5757

5858
class App {
5959
public:

src/app/color.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#include "app/modules/palettes.h"
2727
#include "gfx/hsv.h"
2828
#include "gfx/rgb.h"
29-
#include "raster/image.h"
30-
#include "raster/palette.h"
31-
#include "raster/primitives.h"
29+
#include "doc/image.h"
30+
#include "doc/palette.h"
31+
#include "doc/primitives.h"
3232

3333
#include <cstdlib>
3434
#include <iomanip>
@@ -116,7 +116,7 @@ Color Color::fromImage(PixelFormat pixelFormat, color_t c)
116116
Color Color::fromImageGetPixel(Image *image, int x, int y)
117117
{
118118
if ((x >= 0) && (y >= 0) && (x < image->width()) && (y < image->height()))
119-
return Color::fromImage(image->pixelFormat(), raster::get_pixel(image, x, y));
119+
return Color::fromImage(image->pixelFormat(), doc::get_pixel(image, x, y));
120120
else
121121
return Color::fromMask();
122122
}

src/app/color.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
#define APP_COLOR_H_INCLUDED
2121
#pragma once
2222

23-
#include "raster/color.h"
24-
#include "raster/pixel_format.h"
23+
#include "doc/color.h"
24+
#include "doc/pixel_format.h"
2525

2626
#include <string>
2727

28-
namespace raster {
28+
namespace doc {
2929
class Image;
3030
class Layer;
3131
}
3232

3333
namespace app {
3434

35-
using namespace raster;
35+
using namespace doc;
3636

3737
class Color {
3838
public:

src/app/color_picker.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
#include "app/document_location.h"
2626
#include "gfx/point.h"
27-
#include "raster/image.h"
28-
#include "raster/primitives.h"
29-
#include "raster/sprite.h"
27+
#include "doc/image.h"
28+
#include "doc/primitives.h"
29+
#include "doc/sprite.h"
3030

3131
namespace app {
3232

@@ -48,18 +48,18 @@ void ColorPicker::pickColor(const DocumentLocation& location, int x, int y, Mode
4848
}
4949
else { // Pick from the current layer
5050
int u, v;
51-
raster::Image* image = location.image(&u, &v, NULL);
51+
doc::Image* image = location.image(&u, &v, NULL);
5252
gfx::Point pt(x-u, y-v);
5353

5454
if (image && image->bounds().contains(pt)) {
55-
raster::color_t imageColor = get_pixel(image, pt.x, pt.y);
55+
doc::color_t imageColor = get_pixel(image, pt.x, pt.y);
5656

5757
switch (image->pixelFormat()) {
5858
case IMAGE_RGB:
59-
m_alpha = raster::rgba_geta(imageColor);
59+
m_alpha = doc::rgba_geta(imageColor);
6060
break;
6161
case IMAGE_GRAYSCALE:
62-
m_alpha = raster::graya_geta(imageColor);
62+
m_alpha = doc::graya_geta(imageColor);
6363
break;
6464
}
6565

src/app/color_target.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#define APP_COLOR_TARGET_H_INCLUDED
2121
#pragma once
2222

23-
#include "raster/color.h"
24-
#include "raster/layer.h"
25-
#include "raster/pixel_format.h"
26-
#include "raster/sprite.h"
23+
#include "doc/color.h"
24+
#include "doc/layer.h"
25+
#include "doc/pixel_format.h"
26+
#include "doc/sprite.h"
2727

2828
namespace app {
2929

@@ -35,13 +35,13 @@ namespace app {
3535
TransparentLayer
3636
};
3737

38-
ColorTarget(LayerType layerType, raster::PixelFormat pixelFormat, raster::color_t maskColor) :
38+
ColorTarget(LayerType layerType, doc::PixelFormat pixelFormat, doc::color_t maskColor) :
3939
m_layerType(layerType),
4040
m_pixelFormat(pixelFormat),
4141
m_maskColor(maskColor) {
4242
}
4343

44-
ColorTarget(raster::Layer* layer) :
44+
ColorTarget(doc::Layer* layer) :
4545
m_layerType(layer->isBackground() ? BackgroundLayer: TransparentLayer),
4646
m_pixelFormat(layer->sprite()->pixelFormat()),
4747
m_maskColor(layer->sprite()->transparentColor()) {
@@ -50,13 +50,13 @@ namespace app {
5050
bool isBackground() const { return m_layerType == BackgroundLayer; }
5151
bool isTransparent() const { return m_layerType == TransparentLayer; }
5252
LayerType layerType() const { return m_layerType; }
53-
raster::PixelFormat pixelFormat() const { return m_pixelFormat; }
54-
raster::color_t maskColor() const { return m_maskColor; }
53+
doc::PixelFormat pixelFormat() const { return m_pixelFormat; }
54+
doc::color_t maskColor() const { return m_maskColor; }
5555

5656
private:
5757
LayerType m_layerType;
58-
raster::PixelFormat m_pixelFormat;
59-
raster::color_t m_maskColor;
58+
doc::PixelFormat m_pixelFormat;
59+
doc::color_t m_maskColor;
6060
};
6161

6262
} // namespace app

src/app/color_utils.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
#include "app/modules/palettes.h"
2626
#include "gfx/hsv.h"
2727
#include "gfx/rgb.h"
28-
#include "raster/image.h"
29-
#include "raster/layer.h"
30-
#include "raster/palette.h"
31-
#include "raster/sprite.h"
28+
#include "doc/image.h"
29+
#include "doc/layer.h"
30+
#include "doc/palette.h"
31+
#include "doc/sprite.h"
3232

3333
namespace app {
3434

@@ -90,19 +90,19 @@ gfx::Color color_utils::color_for_ui(const app::Color& color)
9090
return c;
9191
}
9292

93-
raster::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format)
93+
doc::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format)
9494
{
9595
if (color.getType() == app::Color::MaskType)
9696
return 0;
9797

98-
raster::color_t c = -1;
98+
doc::color_t c = -1;
9999

100100
switch (format) {
101101
case IMAGE_RGB:
102-
c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
102+
c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
103103
break;
104104
case IMAGE_GRAYSCALE:
105-
c = raster::graya(color.getGray(), 255);
105+
c = doc::graya(color.getGray(), 255);
106106
break;
107107
case IMAGE_INDEXED:
108108
c = color.getIndex();
@@ -112,24 +112,24 @@ raster::color_t color_utils::color_for_image(const app::Color& color, PixelForma
112112
return c;
113113
}
114114

115-
raster::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer)
115+
doc::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer)
116116
{
117117
return color_for_target(color, ColorTarget(layer));
118118
}
119119

120-
raster::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
120+
doc::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
121121
{
122122
if (color.getType() == app::Color::MaskType)
123123
return colorTarget.maskColor();
124124

125-
raster::color_t c = -1;
125+
doc::color_t c = -1;
126126

127127
switch (colorTarget.pixelFormat()) {
128128
case IMAGE_RGB:
129-
c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
129+
c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
130130
break;
131131
case IMAGE_GRAYSCALE:
132-
c = raster::graya(color.getGray(), 255);
132+
c = doc::graya(color.getGray(), 255);
133133
break;
134134
case IMAGE_INDEXED:
135135
if (color.getType() == app::Color::IndexType) {

src/app/color_utils.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#include "app/color.h"
2424
#include "app/color_target.h"
2525
#include "gfx/color.h"
26-
#include "raster/color.h"
27-
#include "raster/pixel_format.h"
26+
#include "doc/color.h"
27+
#include "doc/pixel_format.h"
2828

29-
namespace raster {
29+
namespace doc {
3030
class Layer;
3131
}
3232

@@ -37,9 +37,9 @@ namespace app {
3737
gfx::Color blackandwhite_neg(gfx::Color color);
3838

3939
gfx::Color color_for_ui(const app::Color& color);
40-
raster::color_t color_for_image(const app::Color& color, raster::PixelFormat format);
41-
raster::color_t color_for_layer(const app::Color& color, raster::Layer* layer);
42-
raster::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget);
40+
doc::color_t color_for_image(const app::Color& color, doc::PixelFormat format);
41+
doc::color_t color_for_layer(const app::Color& color, doc::Layer* layer);
42+
doc::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget);
4343

4444
} // namespace color_utils
4545
} // namespace app

0 commit comments

Comments
 (0)