public IEnumerator ContadorDepasos() { if (pasos > 3) { EjecutaEfecto(); pixelate = FindObjectOfType <Pixelate>(); pasos = 1; float tiempo = 0.01f; for (int i = 0; i < 8; i++) { yield return(new WaitForSeconds(tiempo)); pixelate.pixelSizeX++; } for (int i = 0; i < 8; i++) { pixelate.pixelSizeX--; yield return(new WaitForSeconds(tiempo)); } } else { pasos++; } yield return(0); }
private void pixelateToolStripMenuItem_Click(object sender, EventArgs e) { using (var form = new Pixelate(_presenter)) { form.ShowDialog(this); } }
private void Awake() { // Try to set as main pixel camera if (main == null) { main = this; } }
public void resumeToGame() { pauseObject.SetActive(false); Time.timeScale = 1; pixeldCamera = pixelateCamera.GetComponent <Pixelate>(); pixeldCamera.pixelSizeX = 0; lifebars.SetActive(true); }
public override void OnInspectorGUI() { Pixelate pc = (Pixelate)target; // When the inspector is drawn (or any values are changed) re-initialize the render texture if (DrawDefaultInspector() || pc.CheckScreenResize()) { pc.Init(); } }
/// <summary> /// Pixelates an image with the given size. /// </summary> /// <param name="pixelSize"> /// The size of the pixels to create.</param> /// <param name="rectangle"> /// The area in which to pixelate the image. If not set, the whole image is pixelated. /// </param> /// <returns> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// </returns> public ImageFactory Pixelate(int pixelSize, Rectangle?rectangle = null) { if (this.ShouldProcess && pixelSize > 0) { Pixelate pixelate = new Pixelate { DynamicParameter = new Tuple <int, Rectangle?>(pixelSize, rectangle) }; this.CurrentImageFormat.ApplyProcessor(pixelate.ProcessImage, this); } return(this); }
void Update() { if (Input.GetKeyDown("escape") && (pauseObject.activeSelf == false) && (settingsObject.activeSelf == false)) { lifebars.SetActive(false); pixeldCamera = pixelateCamera.GetComponent <Pixelate>(); Time.timeScale = 0; float timeElapsed = 0; while (timeElapsed < 2) { timeElapsed += Time.deltaTime; pixeldCamera.pixelSizeX = (int)(timeElapsed * 9); } pauseObject.SetActive(true); } }
private void button2_Click(object sender, EventArgs e) { if (Data.imageLocation != "") { if (checkBox1.Checked) { Data.threshold = trackBar1.Value; Data.resolution = trackBar3.Value; Data.compression = trackBar2.Value; Data.accuracy = trackBar4.Value; } else { Data.threshold = 50; Data.resolution = 600; Data.compression = 50; Data.accuracy = 4; } // Rozpoczecie procesu List <string> outputColors = new List <string>(); Bitmap holder = new Bitmap(Data.imageLocation); Bitmap map = new Bitmap(holder, Data.resolution, Data.resolution); //Tutaj bede jedne z paramatrow Alchemy.analyze(Pixelate.convert(map, new Rectangle(0, 0, map.Width, map.Height), 50), outputColors); for (int i = 0; i < 7; i++) { Data.colors[i] = outputColors[i]; } this.Hide(); outputWindow outputWin = new outputWindow(); outputWin.ShowDialog(); this.Close(); } }
private void Start() { instance = this; }
public IEnumerator AddEffect(string effect) { const float time = 60f; CameraEffects camEffect; try { camEffect = (CameraEffects)Enum.Parse(typeof(CameraEffects), effect, true); } // Couldn't parse the effect, we'll go with a random one (at least for now). catch (ArgumentException) { var values = (CameraEffects[])Enum.GetValues(typeof(CameraEffects)); camEffect = values[Random.Range(0, values.Length)]; } tk2dCamera tk2dCam = GameCameras.instance.tk2dCam; UCamera cam = GameCameras.instance.tk2dCam.GetAttr <tk2dCamera, UCamera>("_unityCamera"); switch (camEffect) { case CameraEffects.Zoom: { tk2dCam.ZoomFactor = 5f; _activeEffects |= camEffect; yield return(new WaitForSecondsRealtime(time / 6)); tk2dCam.ZoomFactor = 1f; _activeEffects &= ~camEffect; break; } case CameraEffects.Invert: { ApplyShader ivc = cam.gameObject.GetComponent <ApplyShader>() ?? cam.gameObject.AddComponent <ApplyShader>(); ivc.CurrentMaterial = _invertMat; ivc.enabled = true; yield return(new WaitForSecondsRealtime(time)); ivc.enabled = false; break; } case CameraEffects.Pixelate: { Pixelate pix = cam.gameObject.GetComponent <Pixelate>() ?? cam.gameObject.AddComponent <Pixelate>(); pix.mainCamera ??= cam; pix.enabled = true; yield return(new WaitForSecondsRealtime(time)); pix.enabled = false; break; } case CameraEffects.Backwards: { float prev_z = cam.transform.position.z; float new_z = cam.transform.position.z + 80; /* * When you get hit, spell control tries to reset the camera. * This camera reset moves the camera super far back in z * and as a result you get an unusable black screen. * * This prevents that. */ void PreventCameraReset(SetPosition.orig_DoSetPosition orig, HutongGames.PlayMaker.Actions.SetPosition self) { if (self.Fsm.Name == "Spell Control" && self.Fsm.ActiveState.Name == "Reset Cam Zoom") { return; } orig(self); } SetPosition.DoSetPosition += PreventCameraReset; cam.transform.SetPositionZ(new_z); Quaternion prev_rot = cam.transform.rotation; // Rotate around the y-axis to flip the vector. cam.transform.Rotate(Vector3.up, 180); _activeEffects |= CameraEffects.Mirror; // Much shorter than the other effects due to it being a lot harder to play around yield return(new WaitForSecondsRealtime(time / 4)); SetPosition.DoSetPosition -= PreventCameraReset; _activeEffects ^= CameraEffects.Mirror; // Reset the camera. cam.transform.rotation = prev_rot; cam.transform.SetPositionZ(prev_z); break; } default: _activeEffects |= camEffect; yield return(new WaitForSecondsRealtime(time)); _activeEffects &= ~camEffect; break; } }
/// <summary> /// Pixelates and image with the given pixel size. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="size">The size of the pixels.</param> /// <param name="rectangle"> /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// </param> /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param> /// <returns>The <see cref="Image"/>.</returns> public static Image Pixelate(this Image source, int size, Rectangle rectangle, ProgressEventHandler progressHandler = null) { Pixelate processor = new Pixelate(size); processor.OnProgress += progressHandler; try { return source.Process(rectangle, processor); } finally { processor.OnProgress -= progressHandler; } }
// POST api/<controller> public string Post([FromBody] Pixelate req) { var response = Pixelate.ProcessImage(req); return(response); }