2 * Copyright (c) 2001-2015, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
6 * DarkWyrm <bpmagic@columbus.rr.com>
7 * Adi Oanca <adioanca@gmail.com>
8 * Axel Dörfler, axeld@pinc-software.de
9 * Stephan Aßmus <superstippi@gmx.de>
10 * Marcus Overhagen <marcus@overhagen.de>
11 * Adrien Destugues <pulkomandy@pulkomandy.tk>
12 * Julian Harnath <julian.harnath@rwth-aachen.de>
20 #include "SimpleTransform.h"
38 Canvas(const DrawState
& state
);
41 status_t
InitCheck() const;
43 virtual void PushState();
44 virtual void PopState();
45 DrawState
* CurrentState() const { return fDrawState
; }
46 void SetDrawState(DrawState
* newState
);
48 void SetDrawingOrigin(BPoint origin
);
49 BPoint
DrawingOrigin() const;
51 void SetScale(float scale
);
54 void SetUserClipping(const BRegion
* region
);
55 // region is expected in view coordinates
57 bool ClipToRect(BRect rect
, bool inverse
);
58 void ClipToShape(shape_data
* shape
, bool inverse
);
60 void SetAlphaMask(AlphaMask
* mask
);
61 AlphaMask
* GetAlphaMask() const;
63 virtual IntRect
Bounds() const = 0;
65 SimpleTransform
LocalToScreenTransform() const;
66 SimpleTransform
ScreenToLocalTransform() const;
67 SimpleTransform
PenToScreenTransform() const;
68 SimpleTransform
PenToLocalTransform() const;
69 SimpleTransform
ScreenToPenTransform() const;
71 void BlendLayer(Layer
* layer
);
73 virtual DrawingEngine
* GetDrawingEngine() const = 0;
74 virtual ServerPicture
* GetPicture(int32 token
) const = 0;
75 virtual void RebuildClipping(bool deep
) = 0;
76 virtual void ResyncDrawState() {};
77 virtual void UpdateCurrentDrawingRegion() {};
80 virtual void _LocalToScreenTransform(
81 SimpleTransform
& transform
) const = 0;
82 virtual void _ScreenToLocalTransform(
83 SimpleTransform
& transform
) const = 0;
86 DrawState
* fDrawState
;
90 class OffscreenCanvas
: public Canvas
{
92 OffscreenCanvas(DrawingEngine
* engine
,
93 const DrawState
& state
, const IntRect
& bounds
);
94 virtual ~OffscreenCanvas();
96 virtual DrawingEngine
* GetDrawingEngine() const { return fDrawingEngine
; }
98 virtual void RebuildClipping(bool deep
) { /* TODO */ }
99 virtual void ResyncDrawState();
100 virtual void UpdateCurrentDrawingRegion();
101 virtual ServerPicture
* GetPicture(int32 token
) const
102 { /* TODO */ return NULL
; }
103 virtual IntRect
Bounds() const;
106 virtual void _LocalToScreenTransform(SimpleTransform
&) const {}
107 virtual void _ScreenToLocalTransform(SimpleTransform
&) const {}
110 DrawingEngine
* fDrawingEngine
;
111 BRegion fCurrentDrawingRegion
;