vfs: check userland buffers before reading them.
[haiku.git] / src / apps / screenshot / Utility.h
blobbfd10fd71ad832e08f5d4b3e02ee2a4ddc862bea
1 /*
2 * Copyright 2010-2014, Haiku Inc. All rights reserved.
3 * Copyright 2010 Wim van der Meer <WPJvanderMeer@gmail.com>
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef UTILITY_H
7 #define UTILITY_H
10 #include <Point.h>
11 #include <Rect.h>
12 #include <String.h>
13 #include <TranslatorRoster.h>
16 // Command constant for sending utility data to the GUI app
17 const int32 SS_UTILITY_DATA = 'SSUD';
20 class Utility {
21 public:
22 Utility();
23 ~Utility();
25 void CopyToClipboard(const BBitmap& screenshot) const;
26 status_t Save(BBitmap* screenshot, const char* fileName,
27 uint32 imageType) const;
28 BBitmap* MakeScreenshot(bool includeCursor, bool activeWindow,
29 bool includeBorder) const;
30 BString FileNameExtension(uint32 imageType) const;
31 status_t FindTranslator(uint32 imageType, translator_id& id,
32 BString* _mimeType = NULL) const;
34 BBitmap* wholeScreen;
35 BBitmap* cursorBitmap;
36 BBitmap* cursorAreaBitmap;
37 BPoint cursorPosition;
38 BRect activeWindowFrame;
39 BRect tabFrame;
40 float borderSize;
42 static const char* sDefaultFileNameBase;
44 private:
45 void _MakeTabSpaceTransparent(BBitmap* screenshot,
46 BRect frame) const;
47 BString _MimeType(uint32 imageType) const;
51 #endif // UTILITY_H