<commit_before>#region MIT.
// 
// Examples.
// Copyright (C) 2008 <NAME>
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// 
// Created: Thursday, October 02, 2008 10:46:02 PM
// 
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Drawing = System.Drawing;
using System.Text;
using System.Windows.Forms;
using Dialogs;
using GorgonLibrary;
using GorgonLibrary.Graphics;

namespace GorgonLibrary.Example
{
	/// <summary>
	/// Main application form.
	/// </summary>
	public partial class MainForm 
		: Form
	{
		#region Variables.
		private FXShader _cloakShader = null;				// Cloaking shader.
		private FXShader _scratchShader = null;				// Film scratch shader.
		private ImageShader _imageShader = null;			// Image shader.
		private Image _noiseImage = null;					// Noise image.
		private Image _backgroundImage = null;				// Background image.
		private RenderImage _backTarget = null;				// Background target.
		private RenderImage _grainTarget = null;			// Film grain target.
		private RenderImage _finalBuffer = null;			// Final post composite buffer.
		private Sprite _grainSprite = null;					// Grain sprite.
		private Sprite _bufferSprite = null;				// Buffer sprite.
		private Image _shipImage = null;					// Ship image.
		private Sprite _ship = null;						// Ship sprite.
		private Sprite _background = null;					// background sprite.
		private Vector4D _mouse = Vector4D.Zero;			// Mouse position.
		private bool _cloaking = false;						// Flag to indicate that we're cloaking.
		private bool _cloakDir = false;						// Cloaking direction.
		private bool _cloakFade = false;					// Cloaking fade.
		private float _cloakAmount = 1.0f;					// Cloak amount.
		private float _cloakIndex = 6.5f;					// Refraction amount.
		private float _degrees = 0.0f;						// Rotation in degrees.
		private PreciseTimer _frameTimer;					// Frame timer.		
		private Random _rnd = new Random();					// Random number generator.
		private Vector2D _offset = Vector2D.Zero;			// Offset.
		#endregion

		#region Methods.
		/// <summary>
		/// Function to set up the cloak on the sprite.
		/// </summary>
		private void InstallCloak()
		{
			_cloakShader.Parameters["spriteDimensions"].SetValue(new Vector4D(_ship.Width, _ship.Height, 0, 0));
			_cloakShader.Parameters["backbufferSize"].SetValue(new Vector4D(_backTarget.Width, _backTarget.Height, 0, 0));
			_cloakShader.Parameters["background"].SetValue(_backTarget.Image);
			_cloakShader.Parameters["sprite"].SetValue(_shipImage);
			_cloakShader.Parameters["cloakAmount"].SetValue(1.0f);
			_cloakShader.Parameters["refractionIndex"].SetValue(_cloakIndex);
		}

		/// <summary>
		/// Function to draw the film grain effect.
		/// </summary>
		private void DrawGrain()
		{
			int c = 0;						// Color.
			Vector2D pos = Vector2D.Zero;	// Position.

			Gorgon.CurrentRenderTarget = _grainTarget;
			_grainTarget.Clear(Drawing.Color.FromArgb((byte)_rnd.Next(32), 0, 0, 0));
			
			_grainTarget.BeginDrawing();
			for (int i = 0; i < 25; i++)
			{
				c = (byte)_rnd.Next(255);

				_grainTarget.SetPoint(_rnd.Next(_grainTarget.Width), _rnd.Next(_grainTarget.Height), Drawing.Color.FromArgb(255, c, c, c));

				// Create random "hair" lines.
				if (_rnd.Next(100) > 97)
				{
					pos.X = _rnd.Next((int)_grainSprite.Width);
					pos.Y = _rnd.Next((int)_grainSprite.Height);
					if (c < 128)<commit_msg>Oops.  Broke something.  Fixed something.<commit_after>#region MIT.
// 
// Examples.
// Copyright (C) 2008 <NAME>
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// 
// Created: Thursday, October 02, 2008 10:46:02 PM
// 
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Drawing = System.Drawing;
using System.Text;
using System.Windows.Forms;
using Dialogs;
using GorgonLibrary;
using GorgonLibrary.Graphics;

namespace GorgonLibrary.Example
{
	/// <summary>
	/// Main application form.
	/// </summary>
	public partial class MainForm 
		: Form
	{
		#region Variables.
		private FXShader _cloakShader = null;				// Cloaking shader.
		private FXShader _scratchShader = null;				// Film scratch shader.
		private ImageShader _imageShader = null;			// Image shader.
		private Image _noiseImage = null;					// Noise image.
		private Image _backgroundImage = null;				// Background image.
		private RenderImage _backTarget = null;				// Background target.
		private RenderImage _grainTarget = null;			// Film grain target.
		private RenderImage _finalBuffer = null;			// Final post composite buffer.
		private Sprite _grainSprite = null;					// Grain sprite.
		private Sprite _bufferSprite = null;				// Buffer sprite.
		private Image _shipImage = null;					// Ship image.
		private Sprite _ship = null;						// Ship sprite.
		private Sprite _background = null;					// background sprite.
		private Vector4D _mouse = Vector4D.Zero;			// Mouse position.
		private bool _cloaking = false;						// Flag to indicate that we're cloaking.
		private bool _cloakDir = false;						// Cloaking direction.
		private bool _cloakFade = false;					// Cloaking fade.
		private float _cloakAmount = 1.0f;					// Cloak amount.
		private float _cloakIndex = 6.5f;					// Refraction amount.
		private float _degrees = 0.0f;						// Rotation in degrees.
		private PreciseTimer _frameTimer;					// Frame timer.		
		private Random _rnd = new Random();					// Random number generator.
		private Vector2D _offset = Vector2D.Zero;			// Offset.
		#endregion

		#region Methods.
		/// <summary>
		/// Function to set up the cloak on the sprite.
		/// </summary>
		private void InstallCloak()
		{
			_cloakShader.Parameters["spriteDimensions"].SetValue(new Vector4D(_ship.Width, _ship.Height, 0, 0));
			_cloakShader.Parameters["backbufferSize"].SetValue(new Vector4D(_backTarget.Width, _backTarget.Height, 0, 0));
			_cloakShader.Parameters["background"].SetValue(_backTarget.Image);
			_cloakShader.Parameters["sprite"].SetValue(_shipImage);
			_cloakShader.Parameters["cloakAmount"].SetValue(1.0f);
			_cloakShader.Parameters["refractionIndex"].SetValue(_cloakIndex);
		}

		/// <summary>
		/// Function to draw the film grain effect.
		/// </summary>
		private void DrawGrain()
		{
			int c = 0;						// Color.
			Vector2D pos = Vector2D.Zero;	// Position.

			Gorgon.CurrentRenderTarget = _grainTarget;
			_grainTarget.Clear(Drawing.Color.FromArgb((byte)_rnd.Next(32), 255, 255, 255));
			
			_grainTarget.BeginDrawing();
			for (int i = 0; i < 25; i++)
			{
				c = (byte)_rnd.Next(255);

				_grainTarget.SetPoint(_rnd.Next(_grainTarget.Width), _rnd.Next(_grainTarget.Height), Drawing.Color.FromArgb(255, c, c, c));

				// Create random "hair" lines.
				if (_rnd.Next(100) > 97)
				{
					pos.X = _rnd.Next((int)_grainSprite.Width);
					pos.Y = _rnd.Next((int)_grainSprite.Height);
					if (c < 128)
{'fraction_non_alphanumeric': 0.10773290500229463, 'fraction_numerical': 0.014226709499770536, 'mean_word_length': 3.285644051130777, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '816460', 'n_tokens_mistral': 3116, 'n_tokens_neox': 2627, 'n_words': 871}