Try to convert C# function to Pawn
#1

PHP код:
public RGBColor HSBToRGB(HSBColor hsb)
{
    
RGBColor functionReturnValue = default(RGBColor);
    
double maxRGB 0;
    
double Delta 0;
    
double h 0;
    
double s 0;
    
double b 0;
    
hsb.Hue 60;
    
hsb.Saturation 255 100;
    
hsb.Brightness 255 100;
    
maxRGB b;
    if (
== 0) {
        
functionReturnValue.Red 0;
        
functionReturnValue.Green 0;
        
functionReturnValue.Blue 0;
    } else {
        
Delta maxRGB 255;
        if (
3) {
            
functionReturnValue.Blue Convert.ToByte(Round(maxRGB));
            if (
4) {
                
functionReturnValue.Green Convert.ToByte(Round(maxRGB Delta));
                
functionReturnValue.Red Convert.ToByte(Round((4) * Delta)) + functionReturnValue.Green;
            } else {
                
functionReturnValue.Red Convert.ToByte(Round(maxRGB Delta));
                
functionReturnValue.Green Convert.ToByte(functionReturnValue.Red Round((4) * Delta));
            }
        } else {
            if (
1) {
                
functionReturnValue.Green Convert.ToByte(Round(maxRGB));
                if (
2) {
                    
functionReturnValue.Red Convert.ToByte(Round(maxRGB Delta));
                    
functionReturnValue.Blue Convert.ToByte(Round((2) * Delta)) + functionReturnValue.Red;
                } else {
                    
functionReturnValue.Blue Convert.ToByte(Round(maxRGB Delta));
                    
functionReturnValue.Red Convert.ToByte(functionReturnValue.Blue Round((2) * Delta));
                }
            } else {
                if (
> -1) {
                    
functionReturnValue.Red Convert.ToByte(Round(maxRGB));
                    if (
0) {
                        
functionReturnValue.Blue Convert.ToByte(Round(maxRGB Delta));
                        
functionReturnValue.Green Convert.ToByte(Round(Delta)) + functionReturnValue.Blue;
                    } else {
                        
functionReturnValue.Green Convert.ToByte(Round(maxRGB Delta));
                        
functionReturnValue.Blue Convert.ToByte(functionReturnValue.Green Round(Delta));
                    }
                }
            }
        }
    }
    return 
functionReturnValue;

can we help me to convert this to pawn code
Reply


Messages In This Thread
HSB color to RBG - by xX_Simon_Xx - 18.07.2012, 10:58
Re: Try to convert C# function to Pawn - by milanosie - 18.07.2012, 12:20
Re: Try to convert C# function to Pawn - by xX_Simon_Xx - 18.07.2012, 14:08
Re: Try to convert C# function to Pawn - by xX_Simon_Xx - 18.07.2012, 18:45

Forum Jump:


Users browsing this thread: 1 Guest(s)