text: 
  #pragma strict
  
  @script ExecuteInEditMode
  @script RequireComponent (Camera)
  
  class PostEffectsBase extends MonoBehaviour {	
  	function CheckShaderAndCreateMaterial (s : Shader, m2Create : Material) : Material {
  		if (m2Create && m2Create.shader == s) 
  			return m2Create;
  		
  		if (!s) { 
  			Debug.Log("Missing shader in " + this.ToString ());
  			enabled = false;
  			return null;
  		}
  		
  		if (!s.isSupported) {
  			NotSupported ();
  			Debug.LogError("The shader " + s.ToString() + " on effect "+this.ToString()+" is not supported on this platform!");
  			return null;
  		}
  		else {
  			m2Create = new Material (s);	
  			m2Create.hideFlags = HideFlags.DontSave;		
  			if (m2Create) 
  				return m2Create;
  			else return null;
  		}
  	}
  
  	function CreateMaterial (s : Shader, m2Create : Material) : Material {
  		if (m2Create && m2Create.shader == s) 
  			return m2Create;
  		
  		if (!s) { 
  			Debug.Log ("Missing shader in " + this.ToString ());
  			return null;
  		}
  		
  		if (!s.isSupported) {
  			return null;
  		}
  		else {
  			m2Create = new Material (s);	
  			m2Create.hideFlags = HideFlags.DontSave;		
  			if (m2Create) 
  				return m2Create;
  			else return null;
  		}
  	}
  
  	// deprecated but needed for old effects to survive upgrading
  	function CheckSupport () : boolean {
  		return CheckSupport (false);
  	}
  		
  	function CheckSupport (needDepth : boolean) : boolean {
  		if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures) {
  			NotSupported ();
  			return false;
  		}		
  		
  		if(needDepth && !SystemInfo.SupportsRenderTextureFormat (RenderTextureFormat.Depth)) {
  			NotSupported ();
  			return false;
  		}
  		
  		return true;
  	}
  	
  	// deprecated but needed for old effects to survive upgrading
  	function CheckShader (s : Shader) : boolean {
  		Debug.Log("The shader " + s.ToString () + " on effect "+this.ToString () + " is not part of the Unity 3.2 effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package.");		
  		if (!s.isSupported) {
  			NotSupported ();
  			return false;
  		} 
  		else {
  			return false;
  		}
  	}
  	
  	function NotSupported () {
  		Debug.LogError("The image effect " + this.ToString() + "is not supported on this platform!");
  		enabled = false;
  		return;
  	}
  	
  	function DrawBorder (dest : RenderTexture, material : Material ) {
  		var x1 : float;	
  		var x2 : float;
  		var y1 : float;
  		var y2 : float;		
  		
  		RenderTexture.active = dest;
          var invertY : boolean = true; // source.texelSize.y < 0.0f;
          // Set up the simple Matrix
          GL.PushMatrix();
          GL.LoadOrtho();		
          
          for (var i : int = 0; i < material.passCount; i++)
          {
              material.SetPass(i);
  	        
  	        var y1_ : float; var y2_ : float;
  	        if (invertY)
  	        {
  	            y1_ = 1.0; y2_ = 0.0;
  	        }
  	        else
  	        {
  	            y1_ = 0.0; y2_ = 1.0;
  	        }
  	        	        
  	        // left	        
  	        x1 = 0.0;
  	        x2 = 0.0 + 1.0/(dest.width*1.0);
  	        y1 = 0.0;
  	        y2 = 1.0;
  	        GL.Begin(GL.QUADS);
  	        
  	        GL.TexCoord2(0.0, y1_); GL.Vertex3(x1, y1, 0.1);
  	        GL.TexCoord2(1.0, y1_); GL.Vertex3(x2, y1, 0.1);
  	        GL.TexCoord2(1.0, y2_); GL.Vertex3(x2, y2, 0.1);
  	        GL.TexCoord2(0.0, y2_); GL.Vertex3(x1, y2, 0.1);
  	
  	        // right
  	        x1 = 1.0 - 1.0/(dest.width*1.0);
  	        x2 = 1.0;
  	        y1 = 0.0;
  	        y2 = 1.0;
  
  	        GL.TexCoord2(0.0, y1_); GL.Vertex3(x1, y1, 0.1);
  	        GL.TexCoord2(1.0, y1_); GL.Vertex3(x2, y1, 0.1);
  	        GL.TexCoord2(1.0, y2_); GL.Vertex3(x2, y2, 0.1);
  	        GL.TexCoord2(0.0, y2_); GL.Vertex3(x1, y2, 0.1);	        
  	
  	        // top
  	        x1 = 0.0;
  	        x2 = 1.0;
  	        y1 = 0.0;
  	        y2 = 0.0 + 1.0/(dest.height*1.0);
  
  	        GL.TexCoord2(0.0, y1_); GL.Vertex3(x1, y1, 0.1);
  	        GL.TexCoord2(1.0, y1_); GL.Vertex3(x2, y1, 0.1);
  	        GL.TexCoord2(1.0, y2_); GL.Vertex3(x2, y2, 0.1);
  	        GL.TexCoord2(0.0, y2_); GL.Vertex3(x1, y2, 0.1);
  	        
  	        // bottom
  	        x1 = 0.0;
  	        x2 = 1.0;
  	        y1 = 1.0 - 1.0/(dest.height*1.0);
  	        y2 = 1.0;
  
  	        GL.TexCoord2(0.0, y1_); GL.Vertex3(x1, y1, 0.1);
  	        GL.TexCoord2(1.0, y1_); GL.Vertex3(x2, y1, 0.1);
  	        GL.TexCoord2(1.0, y2_); GL.Vertex3(x2, y2, 0.1);
  	        GL.TexCoord2(0.0, y2_); GL.Vertex3(x1, y2, 0.1);	
  	                	              
  	        GL.End();	
          }	
          
          GL.PopMatrix();
  	}
  }