TCP: Fixed RTO update and dup ACKs generation.
[haiku.git] / src / libs / icon / IconRenderer.h
blobd4c42681c0026353df704f2acc2c56412a03c2b8
1 /*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef ICON_RENDERER_H
9 #define ICON_RENDERER_H
12 #include <agg_gamma_lut.h>
13 #include <agg_pixfmt_rgba.h>
14 #include <agg_rasterizer_compound_aa.h>
15 #include <agg_rendering_buffer.h>
16 #include <agg_renderer_scanline.h>
17 #include <agg_scanline_bin.h>
18 #include <agg_scanline_u.h>
19 #include <agg_span_allocator.h>
20 #include <agg_trans_affine.h>
22 #include "IconBuild.h"
25 class BBitmap;
26 class BRect;
29 _BEGIN_ICON_NAMESPACE
32 class Icon;
34 typedef agg::gamma_lut
35 <agg::int8u, agg::int8u> GammaTable;
37 typedef agg::rendering_buffer RenderingBuffer;
38 typedef agg::pixfmt_bgra32 PixelFormat;
39 typedef agg::pixfmt_bgra32_pre PixelFormatPre;
40 typedef agg::renderer_base<PixelFormat> BaseRenderer;
41 typedef agg::renderer_base<PixelFormatPre> BaseRendererPre;
43 typedef agg::scanline_u8 Scanline;
44 typedef agg::scanline_bin BinaryScanline;
45 typedef agg::span_allocator<agg::rgba8> SpanAllocator;
46 typedef agg::rasterizer_compound_aa
47 <agg::rasterizer_sl_clip_dbl> CompoundRasterizer;
49 typedef agg::trans_affine Transformation;
51 class IconRenderer {
52 public:
53 IconRenderer(BBitmap* bitmap);
54 virtual ~IconRenderer();
56 void SetIcon(const Icon* icon);
58 void Render();
59 void Render(const BRect& area);
61 void SetScale(double scale);
62 void SetBackground(const BBitmap* background);
63 // background is not copied,
64 // ownership stays with the caller
65 // colorspace and size need to
66 // be the same as bitmap passed
67 // to constructor
68 void SetBackground(const agg::rgba8& color);
69 // used when no background bitmap
70 // is set
72 const _ICON_NAMESPACE GammaTable& GammaTable() const
73 { return fGammaTable; }
75 void Demultiply();
77 private:
78 class StyleHandler;
80 void _Render(const BRect& area);
81 void _CommitRenderPass(StyleHandler& styleHandler,
82 bool reset = true);
84 BBitmap* fBitmap;
85 const BBitmap* fBackground;
86 agg::rgba8 fBackgroundColor;
87 const Icon* fIcon;
89 _ICON_NAMESPACE GammaTable fGammaTable;
91 RenderingBuffer fRenderingBuffer;
92 PixelFormat fPixelFormat;
93 PixelFormatPre fPixelFormatPre;
94 BaseRenderer fBaseRenderer;
95 BaseRendererPre fBaseRendererPre;
97 Scanline fScanline;
98 BinaryScanline fBinaryScanline;
99 SpanAllocator fSpanAllocator;
101 CompoundRasterizer fRasterizer;
103 Transformation fGlobalTransform;
107 _END_ICON_NAMESPACE
110 #endif // ICON_RENDERER_H