2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
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"
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
;
53 IconRenderer(BBitmap
* bitmap
);
54 virtual ~IconRenderer();
56 void SetIcon(const Icon
* icon
);
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
68 void SetBackground(const agg::rgba8
& color
);
69 // used when no background bitmap
72 const _ICON_NAMESPACE GammaTable
& GammaTable() const
73 { return fGammaTable
; }
80 void _Render(const BRect
& area
);
81 void _CommitRenderPass(StyleHandler
& styleHandler
,
85 const BBitmap
* fBackground
;
86 agg::rgba8 fBackgroundColor
;
89 _ICON_NAMESPACE GammaTable fGammaTable
;
91 RenderingBuffer fRenderingBuffer
;
92 PixelFormat fPixelFormat
;
93 PixelFormatPre fPixelFormatPre
;
94 BaseRenderer fBaseRenderer
;
95 BaseRendererPre fBaseRendererPre
;
98 BinaryScanline fBinaryScanline
;
99 SpanAllocator fSpanAllocator
;
101 CompoundRasterizer fRasterizer
;
103 Transformation fGlobalTransform
;
110 #endif // ICON_RENDERER_H