1 /******************************************************************************* 2 / 3 / File: Screen.h 4 / 5 / Description: BScreen provides information about a screen's current 6 / display settings. It also lets you set the Desktop color. 7 / 8 / Copyright 1993-98, Be Incorporated, All Rights Reserved 9 / 10 *******************************************************************************/ 11 12 #ifndef _SCREEN_H 13 #define _SCREEN_H 14 15 #include <BeBuild.h> 16 #include <Accelerant.h> 17 #include <GraphicsDefs.h> 18 #include <Rect.h> 19 #include <OS.h> 20 21 /*----------------------------------------------------------------*/ 22 /*----- BScreen structures and declarations ----------------------*/ 23 24 class BWindow; 25 class BPrivateScreen; 26 27 /*----------------------------------------------------------------*/ 28 /*----- BScreen class --------------------------------------------*/ 29 30 class BScreen { 31 public: 32 BScreen( screen_id id=B_MAIN_SCREEN_ID ); 33 BScreen( BWindow *win ); 34 ~BScreen(); 35 36 bool IsValid(); 37 status_t SetToNext(); 38 39 color_space ColorSpace(); 40 BRect Frame(); 41 screen_id ID(); 42 43 status_t WaitForRetrace(); 44 status_t WaitForRetrace(bigtime_t timeout); 45 46 uint8 IndexForColor( rgb_color rgb ); 47 uint8 IndexForColor( uint8 r, uint8 g, uint8 b, uint8 a=255 ); 48 rgb_color ColorForIndex( const uint8 index ); 49 uint8 InvertIndex( uint8 index ); 50 51 const color_map* ColorMap(); 52 53 status_t GetBitmap( BBitmap **screen_shot, 54 bool draw_cursor = true, 55 BRect *bound = NULL); 56 status_t ReadBitmap( BBitmap *buffer, 57 bool draw_cursor = true, 58 BRect *bound = NULL); 59 60 rgb_color DesktopColor(); 61 rgb_color DesktopColor(uint32 index); 62 void SetDesktopColor( rgb_color rgb, bool stick=true ); 63 void SetDesktopColor( rgb_color rgb, uint32 index, bool stick=true ); 64 65 status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high); 66 status_t GetModeList(display_mode **mode_list, uint32 *count); 67 status_t GetMode(display_mode *mode); 68 status_t GetMode(uint32 workspace, display_mode *mode); 69 status_t SetMode(display_mode *mode, bool makeDefault = false); 70 status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault = false); 71 status_t GetDeviceInfo(accelerant_device_info *adi); 72 status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); 73 status_t GetTimingConstraints(display_timing_constraints *dtc); 74 status_t SetDPMS(uint32 dpms_state); 75 uint32 DPMSState(void); 76 uint32 DPMSCapabilites(void); 77 78 BPrivateScreen* private_screen(); 79 80 /*----- Private or reserved -----------------------------------------*/ 81 private: 82 status_t ProposeDisplayMode(display_mode *target, const display_mode *low, const display_mode *high); 83 BScreen &operator=(const BScreen &screen); 84 BScreen(const BScreen &screen); 85 void* BaseAddress(); 86 uint32 BytesPerRow(); 87 88 BPrivateScreen *fScreen; 89 }; 90 91 92 /*----------------------------------------------------------------*/ 93 /*----- inline definitions ---------------------------------------*/ 94 95 inline uint8 BScreen::IndexForColor( rgb_color rgb ) 96 { return IndexForColor(rgb.red,rgb.green,rgb.blue,rgb.alpha); } 97 98 /*-------------------------------------------------------------*/ 99 /*-------------------------------------------------------------*/ 100 101 #endif /* _SCREEN_H */ 102