1 /* 2 * Copyright 2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Mikael Konradson, mikael.konradson@gmail.com 7 */ 8 #ifndef FONT_DEMO_VIEW_H 9 #define FONT_DEMO_VIEW_H 10 11 12 #include <View.h> 13 #include <Region.h> 14 15 class BShape; 16 class BBitmap; 17 18 19 class FontDemoView : public BView { 20 public: 21 FontDemoView(BRect rect); 22 virtual ~FontDemoView(); 23 24 virtual void Draw(BRect updateRect); 25 virtual void MessageReceived(BMessage* message); 26 virtual void FrameResized(float width, float height); 27 28 virtual void SetFontSize(float size); 29 const float FontSize() const { return fFont.Size(); } 30 31 void SetDrawBoundingBoxes(bool state); 32 bool BoundingBoxes() const { return fBoundingBoxes; } 33 34 void SetFontShear(float shear); 35 const float Shear() const { return fFont.Shear(); } 36 37 void SetFontRotation(float rotation); 38 const float Rotation() const { return fFont.Rotation(); } 39 40 void SetString(const char* string); 41 const char* String() const; 42 43 void SetAntialiasing(bool state); 44 45 void SetSpacing(float space); 46 const float Spacing() const { return fSpacing; } 47 48 void SetOutlineLevel(int8 outline); 49 const int8 OutLineLevel() const { return fOutLineLevel; } 50 51 private: 52 void _AddShapes(const char* string); 53 void _DrawView(BView* view); 54 55 BView* _GetView(BRect rect); 56 void _NewBitmap(BRect rect); 57 58 BBitmap* fBitmap; 59 BView* fBufferView; 60 61 char* fString; 62 float fFontSize; 63 float fSpacing; 64 int8 fOutLineLevel; 65 drawing_mode fDrawingMode; 66 67 BRegion fBoxRegion; 68 BFont fFont; 69 bool fBoundingBoxes; 70 bool fDrawShapes; 71 BShape** fShapes; 72 }; 73 74 #endif // FONT_DEMO_VIEW_H 75 76 77