Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Pasar Una Imagen A Escala de Grises
Pasar Una Imagen A Escala de Grises
to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here conejo = Content.Load<Texture2D>("Imagenes/conejo"); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(SpriteBlendMode.AlphaBlend); spriteBatch.Draw(imagenEfectiva, Vector2.Zero, Color.White); spriteBatch.End(); base.Draw(gameTime); }
public Texture2D GrayScale(Texture2D source) { Texture2D target = new Texture2D(source.GraphicsDevice, source.Width, source.Height); return target; }
public Texture2D GrayScale(Texture2D source) { Texture2D target = new Texture2D(source.GraphicsDevice, source.Width, source.Height); byte[] data = new byte1; source.GetData<byte>(data); return target; }
public Texture2D GrayScale(Texture2D source) { byte y = 0; Texture2D target = new Texture2D(source.GraphicsDevice, source.Width, source.Height); byte[] data = new byte1; source.GetData<byte>(data); for (int i = 0; i < data.Length; i += 4) { // Y = R * 0.3 + G * 0.59 + B * 0.11 y = (byte)(data[i] * 0.3f + data[i + 1] * 0.59f + data[i + 2] * 0.11f); data[i + 2] = data[i + 1] = data[i] = y;
} return target; } public Texture2D GrayScale(Texture2D source) { byte y = 0; Texture2D target = new Texture2D(source.GraphicsDevice, source.Width, source.Height); byte[] data = new byte1; source.GetData<byte>(data); for (int i = 0; i < data.Length; i += 4) { // Y = R * 0.3 + G * 0.59 + B * 0.11 y = (byte)(data[i] * 0.11f + data[i + 1] * 0.59f + data[i + 2] * 0.3f); data[i + 2] = data[i + 1] = data[i] = y; } target.SetData<byte>(data); return target; } public Texture2D GrayScale(Texture2D source) { Texture2D target = new Texture2D(source.GraphicsDevice, source.Width, source.Height); byte[] data = new byte1; source.GetData<byte>(data); for (int i = 0; i < data.Length; i += 4) data[i + 2] = data[i + 1] = data[i] = (byte)(data[i] * 0.3f + data[i + 1] * 0.59f + data[i + 2] * 0.11f); target.SetData<byte>(data); return target; }