1// Aseprite
2// Copyright (C) 2022 Igara Studio S.A.
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifndef APP_RENDER_RENDERER_H_INCLUDED
8#define APP_RENDER_RENDERER_H_INCLUDED
9#pragma once
10
11#include "render/render.h"
12
13namespace doc {
14 class Image;
15 class Sprite;
16}
17
18namespace app {
19
20 // Abstract class to render images from any editor to be displayed
21 // in the screen mainly (to render images in files you can continue
22 // using render::Render).
23 class Renderer {
24 public:
25 virtual ~Renderer() { }
26
27 // Basic configuration
28 virtual void setRefLayersVisiblity(const bool visible) = 0;
29 virtual void setNonactiveLayersOpacity(const int opacity) = 0;
30 virtual void setNewBlendMethod(const bool newBlend) = 0;
31 virtual void setBgOptions(const render::BgOptions& bg) = 0;
32 virtual void setProjection(const render::Projection& projection) = 0;
33
34 // Advance configuration (for preview/brushes purposes)
35 virtual void setSelectedLayer(const doc::Layer* layer) = 0;
36 virtual void setPreviewImage(const doc::Layer* layer,
37 const doc::frame_t frame,
38 const doc::Image* image,
39 const doc::Tileset* tileset,
40 const gfx::Point& pos,
41 const doc::BlendMode blendMode) = 0;
42 virtual void removePreviewImage() = 0;
43 virtual void setExtraImage(render::ExtraType type,
44 const doc::Cel* cel,
45 const doc::Image* image,
46 const doc::BlendMode blendMode,
47 const doc::Layer* currentLayer,
48 const doc::frame_t currentFrame) = 0;
49 virtual void removeExtraImage() = 0;
50 virtual void setOnionskin(const render::OnionskinOptions& options) = 0;
51 virtual void disableOnionskin() = 0;
52
53 // Compositing
54 virtual void renderSprite(doc::Image* dstImage,
55 const doc::Sprite* sprite,
56 const doc::frame_t frame) = 0;
57 virtual void renderSprite(doc::Image* dstImage,
58 const doc::Sprite* sprite,
59 const doc::frame_t frame,
60 const gfx::ClipF& area) = 0;
61 virtual void renderCheckeredBackground(doc::Image* dstImage,
62 const gfx::Clip& area) = 0;
63 virtual void renderImage(doc::Image* dstImage,
64 const doc::Image* srcImage,
65 const doc::Palette* pal,
66 const int x,
67 const int y,
68 const int opacity,
69 const doc::BlendMode blendMode) = 0;
70 };
71
72} // namespace app
73
74#endif
75