1 /* 2 * Copyright 2014, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef ALPHA_MASK_H 7 #define ALPHA_MASK_H 8 9 #include <Referenceable.h> 10 11 #include "agg_clipped_alpha_mask.h" 12 #include "ServerPicture.h" 13 14 #include "DrawState.h" 15 #include "drawing/Painter/defines.h" 16 17 18 class ServerBitmap; 19 class ServerPicture; 20 21 22 class AlphaMask : public BReferenceable { 23 public: 24 AlphaMask(ServerPicture* mask, bool inverse, 25 BPoint origin, const DrawState& drawState); 26 ~AlphaMask(); 27 28 void Update(BRect bounds, BPoint offset); 29 30 void SetPrevious(AlphaMask* mask); 31 32 scanline_unpacked_masked_type* Generate(); 33 34 private: 35 ServerBitmap* _RenderPicture() const; 36 37 38 private: 39 AlphaMask* fPreviousMask; 40 41 ServerPicture* fPicture; 42 const bool fInverse; 43 BPoint fOrigin; 44 DrawState fDrawState; 45 46 BRect fViewBounds; 47 BPoint fViewOffset; 48 49 uint8* fCachedBitmap; 50 BRect fCachedBounds; 51 BPoint fCachedOffset; 52 53 agg::rendering_buffer fBuffer; 54 agg::clipped_alpha_mask fCachedMask; 55 scanline_unpacked_masked_type fScanline; 56 }; 57 58 59 #endif // ALPHA_MASK_H 60