1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2002-2005, Haiku 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: PrivateScreen.h 23 // Author: Stefano Ceccherini (burton666@libero.it) 24 // Description: BPrivateScreen is the class which does the real work 25 // for the proxy class BScreen (it interacts with the app server). 26 //------------------------------------------------------------------------------ 27 28 #ifndef __PRIVATESCREEN_H 29 #define __PRIVATESCREEN_H 30 31 #include <Accelerant.h> 32 #include <GraphicsDefs.h> 33 34 struct screen_desc; 35 class BApplication; 36 class BWindow; 37 38 class BPrivateScreen { 39 // Constructor and destructor are private. Use the static methods 40 // CheckOut() and Return() instead. 41 public: 42 static BPrivateScreen* CheckOut(BWindow *win); 43 static BPrivateScreen* CheckOut(screen_id id); 44 static void Return(BPrivateScreen *screen); 45 46 status_t SetToNext(); 47 48 color_space ColorSpace(); 49 BRect Frame(); 50 screen_id ID(); 51 52 status_t WaitForRetrace(bigtime_t timeout); 53 54 uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha); 55 rgb_color ColorForIndex(const uint8 index); 56 uint8 InvertIndex(uint8 index); 57 58 const color_map *ColorMap(); 59 60 status_t GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound); 61 status_t ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound); 62 63 rgb_color DesktopColor(uint32 index); 64 void SetDesktopColor(rgb_color, uint32, bool); 65 66 status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high); 67 68 status_t GetModeList(display_mode **mode_list, uint32 *count); 69 status_t GetMode(uint32 workspace, display_mode *mode); 70 status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault); 71 72 status_t GetDeviceInfo(accelerant_device_info *info); 73 status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); 74 status_t GetTimingConstraints(display_timing_constraints *dtc); 75 76 status_t SetDPMS(uint32 dpmsState); 77 uint32 DPMSState(); 78 uint32 DPMSCapabilites(); 79 80 void* BaseAddress(); 81 uint32 BytesPerRow(); 82 83 status_t get_screen_desc(screen_desc *desc); 84 85 private: 86 color_map *fColorMap; 87 sem_id fRetraceSem; 88 bool fOwnsColorMap; 89 90 sem_id RetraceSemaphore(); 91 92 BPrivateScreen(); 93 ~BPrivateScreen(); 94 }; 95 96 #endif // __PRIVATESCREEN_H 97