Scanner csharp

From Ilianko
Revision as of 11:44, 4 May 2015 by Anko (talk | contribs) (→‎TWAIN)

Програмен достъп до скенер

TWAIN

TWAIN е програмен интерфейс (API) и комуникционен протокол за управление на комуникацията между софтуeрни приложения и устройства за въвеждане на графична информация (примерно изображения от скенери и цифрови фотопарати).

TWAIN TWAIN is not a hardware-level protocol; it requires a driver called Data Source for each device.[1]

WIA

Scanner Access Now Easy (SANE)

xxx

// _twain
// 
this.components = new System.ComponentModel.Container();
this.twain = new Saraff.Twain.Twain32(this.components);
this.twain.AppProductName = "Saraff.Twain, Version=1.0.0.0";
this.twain.Parent = this;
this.twain.AcquireCompleted += new System.EventHandler(this.getScan);
private Saraff.Twain.Twain32 twain;
private void scanner_Click(object sender, EventArgs e)
{
   this.twain.CloseDataSource();
   this.twain.SelectSource();
}
private void scanButton_Click(object sender, EventArgs e)
{
  this.twain.Acquire();
}
private void getScan(object sender, EventArgs e)
{
  if ( twain.ImageCount > 0)
  {
    pictureBox1.Image = twain.GetImage(0);
  }
}