Jump to content

lloydo

Members
  • Posts

    42
  • Joined

  • Last visited

Posts posted by lloydo

  1. Code without error message BUT still not working due to bad programing:

    int Amount1=72; //[1,360]How big is your box of chalk?
    
    void Render(Surface dst, Surface src, Rectangle rect)
    { 
     double BaseColors = (double)Amount1; 
    
     PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); 
     Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); 
     ColorBgra CurrentPixel; 
     double Q = 360 / BaseColors; 
     double H = 0,S = 0,V = 0; 
     for(int y = rect.Top; y < rect.Bottom; y++) 
     { 
       for (int x = rect.Left; x < rect.Right; x++) 
       { 
         if (selectionRegion.IsVisible(x, y))
         { 
           CurrentPixel = src[x,y]; 
           H = Q * (double)Math.Round(H / Q); // Normalize Hue 
    
           if (S > 0.15) // Compress Saturation 
           { 
             S = ((0.35 * (S - 0.15)) / (1.0 - 0.15)) + 0.15; 
           } 
    
           if (V > 0.05) // Compress Value 
           { 
             V = ((0.15 * (V - 0.05)) / (1.0 - 0.05)) + 0.85; 
           } 
           else // Near Black Pixels 
           { 
             S = 0; // turn them gray 
             V += 0.75; 
           } 
           //EvanHSVtoRGB(H,S,V,ref CurrentPixel.R,ref CurrentPixel.G,ref CurrentPixel.; 
           dst[x,y] = CurrentPixel; 
         } 
       } 
     } 
    } 
    

    1. Never use {} for function, it's only needed for groups of instructions.

    2. Use () for all the functions.

    3. Semi-column ';' is needed at the end of an instruction

    4. S, V are always at 0! You need to affect them a value somewhere!

    5. EvanHSVtoRGB isn't a built-in function, to use it, you have to add its code at the end.

    6. I have added Amount1, that will allow you to have a slider when you will build the DLL.

    Now please go on...

    Ok the code is now perfect thanks to madjik ( thanks dude! ) the only thing is that access to my effects folder is denied and im on my administrator account... :cry:

  2. void Render{Surface dst, Surface src, Rectangle rect}

    { // How big is your box of chalk?

    double BaseColors = 72; // 1-360, step 1, Default = 72

    PdnRegion selectionRegion = EnvironmentParameters.GetSelection{src.Bounds};

    Rectangle selection = this.EnvironmentParameters.GetSelection{src.Bounds}.GetBoundsInt{};

    ColorBgra CurrentPixel;

    double Q = 360 / BaseColors;

    double H = 0,S = 0,V = 0;

    for(int y = rect.Top; y < rect.Bottom; y++}

    {

    for {int x = rect.Left; x < rect.Right; x++}

    {

    if {selectionRegion.IsVisible{x, y}}

    CurrentPixel = src[x,y];

    ; {CurrentPixel.R,CurrentPixel.G,CurrentPixel.B,ref H,ref} S,ref V}; {CS1026}

    H = Q*{double}Math.Round{H/Q}; // Normalize Hue

    if {S > .15} // Compress Saturation

    {

    S = { {0.35*{S-0.15}} / {1.0-0.15} } + 0.15;

    }

    {V > 0.05} // Compress Value

    {

    V = { {0.15*{V-0.05}} / {1.0-0.05} } + 0.85;

    } ;

    else // Near Black Pixels

    {

    S = 0; // turn them gray

    V += 0.75;

    }

    EvanHSVtoRGB(H,S,V,ref CurrentPixel.R,ref CurrentPixel.G,ref CurrentPixel.B};

    dst[x,y] = CurrentPixel;

    }

    }

    }

    }

    Just made more errors :sad:

    Can you correct all the errors then send back to me?

  3. void Render(Surface dst, Surface src, Rectangle rect)
    { // How big is your box of chalk?
    double BaseColors = 72; // 1-360, step 1, Default = 72
    
    PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    ColorBgra CurrentPixel;
    double Q = 360 / BaseColors;
    double H = 0,S = 0,V = 0;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
    	for (int x = rect.Left; x < rect.Right; x++)
    	(
    		if (selectionRegion.IsVisible(x, y))
    
    			CurrentPixel = src[x,y];
    			; (CurrentPixel.R,CurrentPixel.G,CurrentPixel.B,ref H,ref) S,ref V); (CS1026)
    			H = Q*(double)Math.Round(H/Q); // Normalize Hue
    			if (S > .15) // Compress Saturation
    			(
    				S = ( (0.35*(S-0.15)) / (1.0-0.15) ) + 0.15;
    			)
    			if (V > 0.05) // Compress Value
    			(
    				V = ( (0.15*(V-0.05)) / (1.0-0.05) ) + 0.85;
    			) ;
    
    			else // Near Black Pixels
    			{
    				S = 0; // turn them gray
    				V += 0.75;
    			}
    			EvanHSVtoRGB(H,S,V,ref CurrentPixel.R,ref CurrentPixel.G,ref CurrentPixel.;
    			dst[x,y] = CurrentPixel;
    		}
    	}
    }
    }

×
×
  • Create New...