OSDLPixel.h

Go to the documentation of this file.
00001 #ifndef OSDL_PIXEL_H_
00002 #define OSDL_PIXEL_H_
00003 
00004 
00005 #include "OSDLVideoTypes.h"  // for Coordinate, BitsPerPixel, VideoException
00006 
00007 #include "Ceylan.h"          // for Ceylan::Uint8, etc.
00008 
00009 
00010 #include "SDL.h"             // for SDL_PixelFormat
00011 
00012 #include <string>
00013 
00014 
00015 
00016 namespace OSDL
00017 {
00018     
00019     
00020     namespace Video
00021     {
00022 
00023     
00024         // Pixels belong to surfaces.
00025         class Surface ;
00026     
00027     
00039         namespace Pixels
00040         {
00041 
00042 
00043 
00048             typedef SDL_PixelFormat PixelFormat ;
00049         
00050     
00051     
00065             typedef SDL_Color ColorDefinition ;
00066 
00067         
00073             typedef Ceylan::Uint32 PixelColor ;
00074     
00075             
00076                         
00083             typedef Ceylan::Uint32 ColorMask ;
00084             
00085             
00090             typedef Ceylan::Uint8 ColorElement ;
00091                                      
00092             
00099             const ColorElement AlphaTransparent = 0 ; 
00100             
00101             
00109             const ColorElement AlphaOpaque = 255 ; 
00110             
00111             
00112             
00118             typedef Ceylan::Float32 GammaFactor ;
00119             
00120             
00137             bool setGamma( GammaFactor red, GammaFactor green, 
00138                 GammaFactor blue ) throw() ;
00139             
00140             
00142             typedef Ceylan::Uint16 GammaRampElement ;
00143                         
00144             
00172             OSDL_DLL bool setGammaRamp( GammaRampElement * redRamp, 
00173                     GammaRampElement * greenRamp, GammaRampElement * blueRamp )
00174                 throw() ;
00175                 
00176                 
00189             OSDL_DLL bool getGammaRamp( GammaRampElement * redRamp, 
00190                     GammaRampElement * greenRamp, GammaRampElement * blueRamp )
00191                 throw() ;
00192 
00193 
00194 
00195 
00196             // Color mask section.
00197             
00198 
00225             OSDL_DLL void getRecommendedColorMasks( ColorMask & redMask, 
00226                 ColorMask & greenMask, ColorMask & blueMask, 
00227                 ColorMask & alphaMask ) throw() ;
00228 
00229 
00253             OSDL_DLL void getRecommendedColorMasks( ColorMask & redMask, 
00254                 ColorMask & greenMask, ColorMask & blueMask ) throw() ;
00255 
00256 
00278             OSDL_DLL void getCurrentColorMasks( const PixelFormat & format, 
00279                 ColorMask & redMask, ColorMask & greenMask, 
00280                 ColorMask & blueMask, ColorMask & alphaMask ) throw() ;
00281 
00282 
00283 
00284             // Color conversion section.
00285 
00286 
00301             OSDL_DLL ColorDefinition convertRGBAToColorDefinition( 
00302                 ColorElement red, ColorElement green, ColorElement blue, 
00303                 ColorElement alpha = AlphaOpaque ) throw() ;
00304                 
00305             
00317             OSDL_DLL void convertColorDefinitionToRGBA( ColorDefinition color,
00318                 ColorElement & red, ColorElement & green, ColorElement & blue, 
00319                 ColorElement & alpha ) throw() ;
00320                             
00321             
00330             OSDL_DLL PixelColor convertRGBAToPixelColor( 
00331                 const PixelFormat & format,
00332                 ColorElement red, ColorElement green, ColorElement blue, 
00333                 ColorElement alpha = AlphaOpaque ) throw() ;
00334                 
00335             
00354             OSDL_DLL ColorDefinition convertPixelColorToColorDefinition( 
00355                 const PixelFormat & format, PixelColor pixel ) throw() ;
00356     
00357                     
00368             OSDL_DLL PixelColor convertColorDefinitionToPixelColor( 
00369                 const PixelFormat & format, ColorDefinition colorDef ) throw() ;
00370     
00371 
00381             OSDL_DLL PixelColor convertColorDefinitionToRawPixelColor( 
00382                 ColorDefinition colorDef ) throw() ;
00383         
00384         
00394             OSDL_DLL PixelColor convertRGBAToRawPixelColor( 
00395                 ColorElement red, ColorElement green, ColorElement blue, 
00396                 ColorElement alpha = AlphaOpaque ) throw() ;
00397         
00398         
00399         
00400         
00401             // Color comparison section.
00402             
00403             
00416             OSDL_DLL bool areEqual( ColorDefinition first, 
00417                 ColorDefinition second, bool useAlpha = true ) throw() ;
00418         
00419         
00433             OSDL_DLL bool isLess( ColorDefinition value, 
00434                 ColorDefinition comparison ) throw() ;
00435         
00436         
00451             OSDL_DLL bool areEqual( PixelColor first, PixelColor second )
00452                 throw() ;
00453 
00454 
00471             OSDL_DLL ColorDefinition selectColorDifferentFrom( 
00472                 ColorDefinition first, ColorDefinition second ) throw() ;
00473         
00474         
00493             OSDL_DLL ColorDefinition selectColorDifferentFrom( 
00494                 ColorDefinition first, ColorDefinition second, 
00495                     ColorDefinition third ) throw() ;
00496                 
00497                 
00498                 
00499             // get/put pixel operations.
00500             
00501 
00515             OSDL_DLL PixelColor getPixelColor( const Surface & fromSurface, 
00516                 Coordinate x, Coordinate y ) throw ( VideoException ) ;
00517             
00518             
00537             OSDL_DLL ColorDefinition getColorDefinition( 
00538                 const Surface & fromSurface, 
00539                 Coordinate x, Coordinate y ) throw ( VideoException ) ;
00540 
00541             
00587             OSDL_DLL void putRGBAPixel( Surface & targetSurface, 
00588                     Coordinate x, Coordinate y, 
00589                     ColorElement red, ColorElement green, ColorElement blue, 
00590                     ColorElement alpha = AlphaOpaque, 
00591                     bool blending = true, bool clipping = true, 
00592                     bool locking = false )
00593                 throw( VideoException ) ;
00594     
00595 
00596 
00636             OSDL_DLL void putColorDefinition( Surface & targetSurface, 
00637                     Coordinate x, Coordinate y, 
00638                     ColorDefinition colorDef,
00639                     bool blending = true, bool clipping = true, 
00640                     bool locking = false )
00641                 throw( VideoException ) ;
00642     
00643     
00644     
00686             OSDL_DLL void putPixelColor( Surface & targetSurface, 
00687                     Coordinate x, Coordinate y, 
00688                     PixelColor convertedColor, ColorElement alpha,
00689                     bool blending = true, bool clipping = true, 
00690                     bool locking = false )
00691                 throw( VideoException ) ;
00692     
00693         
00694         
00712             OSDL_DLL void alternativePutPixelColor( Surface & targetSurface, 
00713                 Coordinate x, Coordinate y, 
00714                 PixelColor color, bool mapToSurfaceFormat = false ) throw() ;
00715                 
00716                                 
00717                 
00724             OSDL_DLL std::string toString( const PixelFormat & format ) 
00725                 throw() ;
00726 
00727 
00738             OSDL_DLL std::string toString( PixelColor pixel, 
00739                 const PixelFormat & format ) throw() ;
00740 
00741             
00750             OSDL_DLL std::string toString( ColorDefinition color ) throw() ;
00751             
00752             
00770             extern OSDL_DLL const ColorDefinition Transparent ;          
00771             
00772              
00774 
00775             extern OSDL_DLL const ColorDefinition Black ;          
00776             extern OSDL_DLL const ColorDefinition Grey ;           
00777             extern OSDL_DLL const ColorDefinition DimGrey ;        
00778             extern OSDL_DLL const ColorDefinition LightGrey ;      
00779             extern OSDL_DLL const ColorDefinition SlateGrey ;      
00780             extern OSDL_DLL const ColorDefinition Silver ;         
00781 
00782 
00783 
00785             
00786             extern OSDL_DLL const ColorDefinition AliceBlue ;      
00787             extern OSDL_DLL const ColorDefinition BlueViolet ;     
00788             extern OSDL_DLL const ColorDefinition CadetBlue ;      
00789             extern OSDL_DLL const ColorDefinition DarkSlateBlue ;  
00790             extern OSDL_DLL const ColorDefinition DarkTurquoise ;  
00791             extern OSDL_DLL const ColorDefinition DeepSkyBlue ;    
00792             extern OSDL_DLL const ColorDefinition DodgerBlue ;     
00793             extern OSDL_DLL const ColorDefinition LightBlue ;      
00794             extern OSDL_DLL const ColorDefinition LightCyan ;      
00795             extern OSDL_DLL const ColorDefinition MediumBlue ;     
00796             extern OSDL_DLL const ColorDefinition NavyBlue ;       
00797             extern OSDL_DLL const ColorDefinition RoyalBlue ;      
00798             extern OSDL_DLL const ColorDefinition SkyBlue ;        
00799             extern OSDL_DLL const ColorDefinition SlateBlue ;      
00800             extern OSDL_DLL const ColorDefinition SteelBlue ;      
00801             extern OSDL_DLL const ColorDefinition Aquamarine ;     
00802             extern OSDL_DLL const ColorDefinition Azure ;          
00803             extern OSDL_DLL const ColorDefinition Blue ;           
00804             extern OSDL_DLL const ColorDefinition Cyan ;          
00805             extern OSDL_DLL const ColorDefinition Turquoise ;      
00806             extern OSDL_DLL const ColorDefinition MidnightBlue ;      
00807 
00808 
00809 
00811 
00812             extern OSDL_DLL const ColorDefinition Brown ;      
00813             extern OSDL_DLL const ColorDefinition RosyBrown ;      
00814             extern OSDL_DLL const ColorDefinition SaddleBrown ;    
00815             extern OSDL_DLL const ColorDefinition Beige ;          
00816             extern OSDL_DLL const ColorDefinition Burlywood ;      
00817             extern OSDL_DLL const ColorDefinition Chocolate ;      
00818             extern OSDL_DLL const ColorDefinition Peru ;           
00819             extern OSDL_DLL const ColorDefinition Tan ;            
00820             extern OSDL_DLL const ColorDefinition Copper ;         
00821 
00822 
00823 
00825 
00826             extern OSDL_DLL const ColorDefinition DarkGreen ;      
00827             extern OSDL_DLL const ColorDefinition DarkOliveGreen ; 
00828             extern OSDL_DLL const ColorDefinition ForestGreen ;    
00829             extern OSDL_DLL const ColorDefinition GreenYellow  ;   
00830             extern OSDL_DLL const ColorDefinition LawnGreen ;      
00831             extern OSDL_DLL const ColorDefinition LimeGreen ;      
00832             extern OSDL_DLL const ColorDefinition MintCream ;     
00833             extern OSDL_DLL const ColorDefinition OliveDrab ;      
00834             extern OSDL_DLL const ColorDefinition PaleGreen ;      
00835             extern OSDL_DLL const ColorDefinition SeaGreen ;       
00836             extern OSDL_DLL const ColorDefinition SpringGreen ;    
00837             extern OSDL_DLL const ColorDefinition YellowGreen ;    
00838             extern OSDL_DLL const ColorDefinition Chartreuse ;     
00839             extern OSDL_DLL const ColorDefinition Green ;          
00840             extern OSDL_DLL const ColorDefinition Khaki ;          
00841 
00842 
00843 
00845 
00846             extern OSDL_DLL const ColorDefinition DarkOrange ;     
00847             extern OSDL_DLL const ColorDefinition DarkSalmon ;     
00848             extern OSDL_DLL const ColorDefinition LightCoral ;     
00849             extern OSDL_DLL const ColorDefinition LightSalmon ;    
00850             extern OSDL_DLL const ColorDefinition PeachPuff ;      
00851             extern OSDL_DLL const ColorDefinition Bisque ;         
00852             extern OSDL_DLL const ColorDefinition Coral ;          
00853             extern OSDL_DLL const ColorDefinition Honeydew ;       
00854             extern OSDL_DLL const ColorDefinition Orange ;         
00855             extern OSDL_DLL const ColorDefinition Salmon ;         
00856             extern OSDL_DLL const ColorDefinition Sienna ;         
00857 
00858 
00859 
00861 
00862             extern OSDL_DLL const ColorDefinition DeepPink ;       
00863             extern OSDL_DLL const ColorDefinition HotPink ;       
00864             extern OSDL_DLL const ColorDefinition IndianRed ;      
00865             extern OSDL_DLL const ColorDefinition LightPink ;      
00866             extern OSDL_DLL const ColorDefinition MediumVioletRed ;
00867             extern OSDL_DLL const ColorDefinition MistyRose ;      
00868             extern OSDL_DLL const ColorDefinition OrangeRed ;      
00869             extern OSDL_DLL const ColorDefinition VioletRed ;      
00870             extern OSDL_DLL const ColorDefinition Firebrick ;      
00871             extern OSDL_DLL const ColorDefinition Pink ;           
00872             extern OSDL_DLL const ColorDefinition Red ;            
00873             extern OSDL_DLL const ColorDefinition Tomato ;         
00874 
00875 
00876 
00878 
00879             extern OSDL_DLL const ColorDefinition DarkOrchid ;     
00880             extern OSDL_DLL const ColorDefinition DarkViolet ;     
00881             extern OSDL_DLL const ColorDefinition LavenderBlush ;  
00882             extern OSDL_DLL const ColorDefinition MediumOrchid ;   
00883             extern OSDL_DLL const ColorDefinition MediumPurple ;   
00884             extern OSDL_DLL const ColorDefinition Lavender ;       
00885             extern OSDL_DLL const ColorDefinition Magenta ;        
00886             extern OSDL_DLL const ColorDefinition Maroon ;         
00887             extern OSDL_DLL const ColorDefinition Orchid ;         
00888             extern OSDL_DLL const ColorDefinition Plum ;           
00889             extern OSDL_DLL const ColorDefinition Purple ;         
00890             extern OSDL_DLL const ColorDefinition Thistle ;        
00891             extern OSDL_DLL const ColorDefinition Violet ;         
00892 
00893 
00894 
00896 
00897             extern OSDL_DLL const ColorDefinition AntiqueWhite ;   
00898             extern OSDL_DLL const ColorDefinition FloralWhite ;    
00899             extern OSDL_DLL const ColorDefinition GhostWhite ;     
00900             extern OSDL_DLL const ColorDefinition NavajoWhite ;    
00901             extern OSDL_DLL const ColorDefinition OldLace ;        
00902             extern OSDL_DLL const ColorDefinition WhiteSmoke ;     
00903             extern OSDL_DLL const ColorDefinition Gainsboro ;      
00904             extern OSDL_DLL const ColorDefinition Ivory ;          
00905             extern OSDL_DLL const ColorDefinition Linen ;          
00906             extern OSDL_DLL const ColorDefinition Seashell ;       
00907             extern OSDL_DLL const ColorDefinition Snow ;          
00908             extern OSDL_DLL const ColorDefinition Wheat ;          
00909             extern OSDL_DLL const ColorDefinition White ;          
00910 
00911 
00912 
00914 
00915             extern OSDL_DLL const ColorDefinition BlanchedAlmond ; 
00916             extern OSDL_DLL const ColorDefinition DarkGoldenrod ;  
00917             extern OSDL_DLL const ColorDefinition LemonChiffon ;   
00918             extern OSDL_DLL const ColorDefinition LightGoldenrod ; 
00919             extern OSDL_DLL const ColorDefinition LightYellow ;    
00920             extern OSDL_DLL const ColorDefinition PaleGoldenrod ;  
00921             extern OSDL_DLL const ColorDefinition PapayaWhip ;   
00922             extern OSDL_DLL const ColorDefinition Cornsilk ;       
00923             extern OSDL_DLL const ColorDefinition Gold ;           
00924             extern OSDL_DLL const ColorDefinition Goldenrod ;      
00925             extern OSDL_DLL const ColorDefinition Moccasin ;       
00926             extern OSDL_DLL const ColorDefinition Yellow ;         
00927         
00928         
00929         
00930         }
00931     
00932     }
00933 
00934 }
00935 
00936 
00937 #endif // OSDL_PIXEL_H_
00938 

Generated on Fri Mar 30 14:46:59 2007 for OSDL by  doxygen 1.5.1