Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Les Modes d’interpolation: Exemple

Modifier,le,mode,de,composition,d'une,image
{filelink=16675}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
 
public class ModeInterpolation : Form {
 
    protected override void OnPaint(PaintEventArgs e) {
        Text = "Interpolation et redimension";
        Graphics gImage = e.Graphics;
        Bitmap bmp = new Bitmap("find.jpg");
        gImage.FillRectangle(Brushes.Blue, this.ClientRectangle);
 
        int largeur = bmp.Width;
        int hauteur = bmp.Height;
 
        gImage.InterpolationMode = InterpolationMode.HighQualityBicubic;
        gImage.DrawImage(
          bmp,
          new Rectangle(10, 10, largeur + 20, hauteur + 20),
          new Rectangle(0, 0, largeur, hauteur),
          GraphicsUnit.Pixel);
 
        gImage.InterpolationMode = InterpolationMode.NearestNeighbor;
        gImage.DrawImage(
          bmp,
          new Rectangle(50, 50, largeur + 20, hauteur + 20),
          new Rectangle(20, 20, largeur, hauteur),
          GraphicsUnit.Pixel);
    }
    public static void Main() {
        Application.Run(new ModeInterpolation());
    }
}

No comments yet.

Leave a Comment