PDA

Ver la Versión Completa : DelphiTwain: Accesar propiedades de Scanner


Roberto Angulo
22-01-2007, 20:13:23
Saludos:
Necesito ayuda sobre como establecer las propiedades del scanner desde Codigo, necesito establecer resolución, escala, modo , etc. y adquirir imagen desde un TButton

Lo único que he podido hacer es fijar su modo de transferencia (Archivo) y su formato (JPG)

Gracias por la atención.

kalisto
22-01-2007, 20:33:18
En la pagina http://Torry.net seguro que encuentras mas de un componente que te permita hacer lo que pretendes.

Roberto Angulo
23-01-2007, 17:30:16
Gracias por la atención, esto es lo que llevo y voy resolviendo el asunto



procedure TfrmEmpleados.JvBtnObtener_ActaClick(Sender: TObject);
var
SourceIndex: Integer;
XV : WORD ;
begin
//Try loading the library
if Twain.LoadLibrary then
begin
//Same as SourceManangerLoaded := TRUE
Twain.LoadSourceManager();
//Select the source
SourceIndex := Twain.SelectSource();
if SourceIndex <> -1 then
BEGIN
with Twain.Source[SourceIndex] do
begin
//Prepare for transfering using ttmFile mode
Loaded := TRUE;
TransferMode := ttmFile;
ShowUI := False ;
Enabled := TRUE;
SetIXResolution(200) ;
end ;
END
else ShowMessage('Cancelado')
end
else MessageDlg('No Está Instalado el Controlador Twain NECESARIO', mtError, [mbOK], 0)
end;

Roberto Angulo
24-01-2007, 22:06:58
Esta funcion es parte de DelphiTwain


{Sets an one value capability}
function TTwainSource.SetOneValue(Capability: TW_UINT16;
ItemType: TW_UINT16; Value: Pointer): TCapabilityRet;
var
Data: HGLOBAL;
OneV: pTW_ONEVALUE;
ItemSize,ItemSize2: Integer;
begin
{Allocate enough memory for the TW_ONEVALUE and obtain pointer}
ItemSize := TWTypeSize(ItemType);
//npeter: TW_ONEVALUE minimal size !!!
//I think to meet the specifications the
//Item's size must be at least sizeof(TW_UINT32)!
//when I did it, some mistic errors on some drivers went gone
if ItemSize<TWTypeSize(TWTY_UINT32) then ItemSize2:=TWTypeSize(TWTY_UINT32) else ItemSize2:=ItemSize;
Data := GlobalAlloc(GHND, sizeof(OneV^.ItemType) + ItemSize2);
OneV := GlobalLock(Data);
{Fill value}
OneV^.ItemType := ItemType;
CopyMemory(@OneV^.Item, Value, ItemSize);
GlobalUnlock(Data);
{Call method to set}
Result := SetCapabilityRec(Capability, TWON_ONEVALUE, Data);
{Unload memory}
GlobalFree(Data);
end;

Roberto Angulo
24-01-2007, 22:11:25
y estas son valores que aparecen en la Unidad Twain


Código Delphi [-] (http://www.clubdelphi.com/foros/#)

ICAP_JPEGQUALITY = $1153; { Added 1.9 }
{$EXTERNALSYM ICAP_JPEGQUALITY}



{ ICAP_JPEGQUALITY values (JQ_ means jpeg quality) }
TWJQ_UNKNOWN = -4;
{$EXTERNALSYM TWJQ_UNKNOWN}
TWJQ_LOW = -3;
{$EXTERNALSYM TWJQ_LOW}
TWJQ_MEDIUM = -2;
{$EXTERNALSYM TWJQ_MEDIUM}
TWJQ_HIGH = -1;
{$EXTERNALSYM TWJQ_HIGH}







Espero puedan ayudarme a establecer la Calidad del JPG, pues deseo que tenga calidad sin que el tamaño del Archivo sea muy grande

mrnovice
31-07-2008, 21:38:17
Quizás te sirva, en twain.org viene el estàndar TWAIN1.9 pdf creo el 2 ya salió en este manualito jeje, vienen primordialmente triplets y capacidades creo que lo que buscas son capacidades, en el manual de DelphiTwain viene como usar esas capacidades, las capacidades como ICAP_XRESOLUTION, te permiten manipular las propiedades del dispositivo, sólo tienes que buscar en TWAIN1.9PDF lo que quieres modificar eso sì està en inglés, suerte espero que te haya servido cualquier duda notificalo.