diff --git a/types/adone/adone.d.ts b/types/adone/adone.d.ts
index 91ebc4db7c..d4e8b67b7b 100644
--- a/types/adone/adone.d.ts
+++ b/types/adone/adone.d.ts
@@ -1,4 +1,6 @@
///
+///
+///
declare namespace adone {
const _null: symbol;
@@ -104,4 +106,8 @@ declare namespace adone {
export const expect: assertion.I.ExpectFunction;
export const std: typeof nodestd;
+
+ export const lodash: _.LoDashStatic;
+
+ export const benchmark: typeof tbenchmark;
}
diff --git a/types/adone/benchmark.d.ts b/types/adone/benchmark.d.ts
new file mode 100644
index 0000000000..042e1ae62c
--- /dev/null
+++ b/types/adone/benchmark.d.ts
@@ -0,0 +1,5 @@
+import Benchmark = require("benchmark");
+
+export { Benchmark };
+
+export as namespace tbenchmark;
diff --git a/types/adone/glosses/fs.d.ts b/types/adone/glosses/fs.d.ts
index 7517764faf..2afc6ec8f7 100644
--- a/types/adone/glosses/fs.d.ts
+++ b/types/adone/glosses/fs.d.ts
@@ -1158,37 +1158,35 @@ declare namespace adone {
*/
function watch(paths: string | string[], options?: I.Watcher.ConstructorOptions): Watcher;
- namespace is {
- /**
- * Returns true if the given path refers to a file
- */
- function file(path: string): Promise;
+ /**
+ * Returns true if the given path refers to a file
+ */
+ function isFile(path: string): Promise;
- /**
- * Returns true if the given path refers to a file
- */
- function fileSync(path: string): boolean;
+ /**
+ * Returns true if the given path refers to a file
+ */
+ function isFileSync(path: string): boolean;
- /**
- * Returns true if the given path refers to a direcotry
- */
- function directory(path: string): Promise;
+ /**
+ * Returns true if the given path refers to a direcotry
+ */
+ function isDirectory(path: string): Promise;
- /**
- * Returns true if the given path refers to a direcotry
- */
- function directorySync(path: string): boolean;
+ /**
+ * Returns true if the given path refers to a direcotry
+ */
+ function isDirectorySync(path: string): boolean;
- /**
- * Returns true if the given path refers to an executable file
- */
- function executable(path: string): Promise;
+ /**
+ * Returns true if the given path refers to an executable file
+ */
+ function isExecutable(path: string): Promise;
- /**
- * Returns true if the given path refers to an executable file
- */
- function executableSync(path: string): boolean;
- }
+ /**
+ * Returns true if the given path refers to an executable file
+ */
+ function isExecutableSync(path: string): boolean;
namespace I.Which {
interface Options {
@@ -1920,5 +1918,19 @@ declare namespace adone {
* Creates a new TailWatcher instance with the given arguments
*/
function watchTail(filename: string, options?: I.TailWatcher.ConstructorOptions): TailWatcher;
+
+ namespace I {
+ interface WriteFileAtomicOptions {
+ chown?: {
+ gid?: number;
+ uid?: number;
+ };
+ encoding?: string | null;
+ fsync?: boolean;
+ mode?: number;
+ }
+ }
+
+ function writeFileAtomic(filename: string, data: Buffer | string | Uint8Array, options?: I.WriteFileAtomicOptions): Promise;
}
}
diff --git a/types/adone/glosses/is.d.ts b/types/adone/glosses/is.d.ts
index 20d898ca7b..d112d3f109 100644
--- a/types/adone/glosses/is.d.ts
+++ b/types/adone/glosses/is.d.ts
@@ -676,5 +676,9 @@ declare namespace adone {
export function emitter(obj: any): obj is event.Emitter;
export function asyncEmitter(obj: any): obj is event.AsyncEmitter;
+
+ export const openbsd: boolean;
+
+ export const aix: boolean;
}
}
diff --git a/types/adone/test/glosses/fs.ts b/types/adone/test/glosses/fs.ts
index e7c5333624..86236038a0 100644
--- a/types/adone/test/glosses/fs.ts
+++ b/types/adone/test/glosses/fs.ts
@@ -602,13 +602,12 @@ namespace fsTests {
}
namespace isTests {
- const { is } = fs;
- is.file("hello").then((x: boolean) => {});
- { const a: boolean = is.fileSync("hello"); }
- is.directory("hello").then((x: boolean) => {});
- { const a: boolean = is.directorySync("hello"); }
- is.executable("hello").then((x: boolean) => {});
- { const a: boolean = is.executableSync("hello"); }
+ fs.isFile("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isFileSync("hello"); }
+ fs.isDirectory("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isDirectorySync("hello"); }
+ fs.isExecutable("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isExecutableSync("hello"); }
}
namespace whichTests {
@@ -944,4 +943,17 @@ namespace fsTests {
fs.watchTail("file", { separator: /\n/ });
fs.watchTail("file", { useWatchFile: true });
}
+
+ namespace writeFileAtomicTests {
+ fs.writeFileAtomic("a", "b").then(() => {});
+ fs.writeFileAtomic("a", Buffer.from("b")).then(() => {});
+ fs.writeFileAtomic("a", new Uint8Array(10)).then(() => {});
+ fs.writeFileAtomic("a", "a", {}).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: {} }).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: { gid: 0 } }).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: { uid: 0 } }).then(() => {});
+ fs.writeFileAtomic("a", "a", { encoding: "utf8" }).then(() => {});
+ fs.writeFileAtomic("a", "a", { fsync: false }).then(() => {});
+ fs.writeFileAtomic("a", "a", { mode: 0o666 }).then(() => {});
+ }
}
diff --git a/types/adone/test/glosses/is.ts b/types/adone/test/glosses/is.ts
index 045818f0ec..455dd745da 100644
--- a/types/adone/test/glosses/is.ts
+++ b/types/adone/test/glosses/is.ts
@@ -336,6 +336,8 @@ namespace isTests {
{ const a: boolean = is.freebsd; }
{ const a: boolean = is.darwin; }
{ const a: boolean = is.sunos; }
+ { const a: boolean = is.openbsd; }
+ { const a: boolean = is.aix; }
{ const a: boolean = is.uppercase("abc"); }
{ const a: boolean = is.lowercase("abc"); }
{ const a: boolean = is.digits("012"); }
diff --git a/types/adone/test/index.ts b/types/adone/test/index.ts
index ac012b9535..aec454539b 100644
--- a/types/adone/test/index.ts
+++ b/types/adone/test/index.ts
@@ -54,4 +54,15 @@ namespace AdoneRootTests {
obj = adone.package;
{ const a: typeof adone.assertion.assert = adone.assert; }
{ const a: typeof adone.assertion.expect = adone.expect; }
+
+ namespace lodashTests {
+ adone.lodash.get({}, "a");
+ adone.lodash.defaults({}, {});
+ adone.lodash.zip([]);
+ }
+
+ namespace benchmarkTests {
+ const b = new adone.benchmark.Benchmark.Suite();
+ b.add(() => {}).add("", () => {}).run();
+ }
}
diff --git a/types/adone/tsconfig.json b/types/adone/tsconfig.json
index 6e6b3fe1c3..6a1af264a3 100644
--- a/types/adone/tsconfig.json
+++ b/types/adone/tsconfig.json
@@ -22,6 +22,7 @@
"files": [
"adone-tests.ts",
"adone.d.ts",
+ "benchmark.d.ts",
"glosses/archives.d.ts",
"glosses/assertion.d.ts",
"glosses/collections/array_set.d.ts",
diff --git a/types/cleave.js/options/creditCard.d.ts b/types/cleave.js/options/creditCard.d.ts
new file mode 100644
index 0000000000..b7f55ff5b0
--- /dev/null
+++ b/types/cleave.js/options/creditCard.d.ts
@@ -0,0 +1,19 @@
+import Cleave = require("../");
+
+// Credit Card Options
+export type CreditCardType =
+ | "amex"
+ | "dankort"
+ | "diners"
+ | "discover"
+ | "instapayment"
+ | "jcb"
+ | "maestro"
+ | "mastercard"
+ | "uatp"
+ | "unknown"
+ | "unionPay"
+ | "mir"
+ | "visa";
+
+export type CreditCardTypeChangeHandler = (this: Cleave, type: CreditCardType) => void;
diff --git a/types/cleave.js/options.d.ts b/types/cleave.js/options/index.d.ts
similarity index 76%
rename from types/cleave.js/options.d.ts
rename to types/cleave.js/options/index.d.ts
index 81757fe097..60e2e99e40 100644
--- a/types/cleave.js/options.d.ts
+++ b/types/cleave.js/options/index.d.ts
@@ -1,19 +1,4 @@
-// Credit Card Options
-export type CreditCardType =
- | "amex"
- | "dankort"
- | "diners"
- | "discover"
- | "instapayment"
- | "jcb"
- | "maestro"
- | "mastercard"
- | "uatp"
- | "unknown"
- | "unionPay"
- | "mir"
- | "visa";
-export type CreditCardTypeChangeHandler = (owner: HTMLInputElement, type: CreditCardType) => void;
+import { CreditCardTypeChangeHandler } from "./creditCard";
export interface CleaveOptions {
creditCard?: boolean;
diff --git a/types/cleave.js/tsconfig.json b/types/cleave.js/tsconfig.json
index c2d5447360..ec4da5d047 100644
--- a/types/cleave.js/tsconfig.json
+++ b/types/cleave.js/tsconfig.json
@@ -21,7 +21,8 @@
"files": [
"cleave.js-tests.tsx",
"index.d.ts",
- "options.d.ts",
+ "options/creditCard.d.ts",
+ "options/index.d.ts",
"react/index.d.ts"
]
}
\ No newline at end of file
diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts
index ef0980abfd..856291a647 100644
--- a/types/dwt/addon.pdf.d.ts
+++ b/types/dwt/addon.pdf.d.ts
@@ -1,5 +1,5 @@
/*!
-* Dynamsoft WebTwain PDF Addon
+* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
@@ -25,7 +25,7 @@ interface PDF {
* The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional.
* The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
Download(remoteFile: string,
optionalAsyncSuccessFunc?: () => void,
@@ -35,7 +35,7 @@ interface PDF {
* Input the password to decrypt PDF files using PDF Rasterizer add-on.
* @method Dynamsoft.WebTwain#SetPassword
* @param {string} password Specifies the PDF password.
- * @return {bool}
+ * @return {boolean}
*/
SetPassword(password: string): boolean;
@@ -43,7 +43,7 @@ interface PDF {
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
* @method Dynamsoft.WebTwain#SetConvertMode
* @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode.
- * @return {bool}
+ * @return {boolean}
*/
SetConvertMode(convertMode: EnumDWT_ConverMode): boolean;
@@ -51,7 +51,7 @@ interface PDF {
* Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN.
* @method Dynamsoft.WebTwain#ReadRect
* @param {float} fResolution Specifies the resolution for convert image from PDF file.
- * @return {bool}
+ * @return {boolean}
*/
SetResolution(fResolution: number): boolean;
@@ -59,7 +59,7 @@ interface PDF {
* Judges whether the local PDF is text-based or not.
* @method Dynamsoft.WebTwain#ReadRect
* @param {string} localFile specifies the local path of the target PDF.
- * @return {bool}
+ * @return {boolean}
*/
IsTextBasedPDF(localFile: string): boolean;
}
@@ -69,5 +69,5 @@ interface WebTwainAddon {
}
interface WebTwain {
- Addon: WebTwainAddon;
+ Addon: WebTwainAddon;
}
diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts
index b940c6ae4e..69bd65bb9f 100644
--- a/types/dwt/index.d.ts
+++ b/types/dwt/index.d.ts
@@ -3,11 +3,12 @@
// Definitions by: Xiao Ling
// Josh Hall
// Lincoln Hu
+// Tom Kent
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*!
-* Dynamsoft WebTwain JavaScript Intellisense
+* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
@@ -20,51 +21,87 @@
* @namespace Dynamsoft
*/
declare namespace Dynamsoft {
+ namespace Lib {
+ /*ignored
+ Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton
+ Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri
+ addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty
+ base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle
+ debug detect detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite
+ each empty endsWith
+ */
+
+ let env: {
+ WSSession: number, WSVersion: string,
+ bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean,
+ bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean,
+ basePath: string, iPluginLength: number, isX64: boolean, pathType: number,
+ strChromeVersion: number, strFirefoxVersion: string, strIEVersion: string
+ };
+
+ /*ignored
+ error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss
+ getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript
+ getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install
+ io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject
+ isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix
+ needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser
+ product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS
+ startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim
+ type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win
+ ...other internal ones
+ */
+ }
namespace WebTwainEnv {
- function GetWebTwain (cid: string): WebTwain;
- function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
+ let JSVersion: string;
+ let PluginVersion: string;
+ let ActiveXVersion: string;
+ let ServerVersionInfo: string;
+
+ let Trial: boolean;
+ let AutoLoad: boolean;
+ let ProductKey: string;
+ let ResourcesPath: string;
+
+ let IfUpdateService: boolean;
+ let IfUseActiveXForIE10Plus: boolean;
+ let UseDefaultInstallUI: string;
+ let ActiveXInstallWithCAB: boolean;
+ let Debug: boolean;
+
+ let ContainerMap: {};
+ let Containers: Container[];
+ let DynamicContainers: string[];
+ let DynamicDWTMap: {};
+
+ function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
+ function GetWebTwain(cid: string): WebTwain;
+ function DeleteDWTObject(objID: string): void;
function Load(): void;
function Unload(): void;
- let AutoLoad: boolean;
- let Containers: Container[];
+ function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
+
+ /*ignored
+ initQueue inited UseDefaultInstallUI
+ OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed OnWebTwainReady
+ */
+ function OnWebTwainPostExecute(): void;
+ function OnWebTwainPreExecute(): void;
+
+ function RemoveAllAuthorizations(): void;
+ function ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void;
+ function CloseDialog(): void;
}
}
-/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */
-declare enum EnumDWT_PixelType {
- TWPT_BW = 0,
- TWPT_GRAY = 1,
- TWPT_RGB = 2,
- TWPT_PALLETE = 3,
- TWPT_CMY = 4,
- TWPT_CMYK = 5,
- TWPT_YUV = 6,
- TWPT_YUVK = 7,
- TWPT_CIEXYZ = 8,
- TWPT_LAB = 9,
- TWPT_SRGB = 10,
- TWPT_SCRGB = 11,
- TWPT_INFRARED = 16
-}
-
+/** Border Styles */
declare enum EnumDWT_BorderStyle {
- /** No border. */
- TWBS_NONE = 0,
- /** Flat border. */
- TWBS_SINGLEFLAT = 1,
- /** 3D border. */
- TWBS_SINGLE3D = 2
-}
-
-/** For query the operation that are supported by the data source on a capability .
- * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT
- */
-declare enum EnumDWT_MessageType {
- TWQC_GET = 1,
- TWQC_SET = 2,
- TWQC_GETDEFAULT = 4,
- TWQC_GETCURRENT = 8,
- TWQC_RESET = 16
+ /** No border. */
+ TWBS_NONE = 0,
+ /** Flat border. */
+ TWBS_SINGLEFLAT = 1,
+ /** 3D border. */
+ TWBS_SINGLE3D = 2
}
/** Capabilities */
@@ -272,45 +309,45 @@ declare enum EnumDWT_Cap {
* any frames with a left offset of zero.
* TWFA_RIGHT: The alignment is to the right.
*/
- CAP_FEEDERALIGNMENT = 4141,
+ CAP_FEEDERALIGNMENT = 4141,
/** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page.
* TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page.
*/
- CAP_FEEDERORDER = 4142,
+ CAP_FEEDERORDER = 4142,
/** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring
* multiple images of the same page without changes to the physical registration of that page.
*/
- CAP_REACQUIREALLOWED = 4144,
+ CAP_REACQUIREALLOWED = 4144,
/** The minutes of battery power remaining to the device. */
- CAP_BATTERYMINUTES = 4146,
+ CAP_BATTERYMINUTES = 4146,
/** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */
- CAP_BATTERYPERCENTAGE = 4147,
+ CAP_BATTERYPERCENTAGE = 4147,
/** Added 1.91 */
- CAP_CAMERASIDE = 4148,
+ CAP_CAMERASIDE = 4148,
/** Added 1.91 */
- CAP_SEGMENTED = 4149,
+ CAP_SEGMENTED = 4149,
/** Added 2.0 */
- CAP_CAMERAENABLED = 4150,
+ CAP_CAMERAENABLED = 4150,
/** Added 2.0 */
- CAP_CAMERAORDER = 4151,
+ CAP_CAMERAORDER = 4151,
/** Added 2.0 */
- CAP_MICRENABLED = 4152,
+ CAP_MICRENABLED = 4152,
/** Added 2.0 */
- CAP_FEEDERPREP = 4153,
+ CAP_FEEDERPREP = 4153,
/** Added 2.0 */
- CAP_FEEDERPOCKET = 4154,
+ CAP_FEEDERPOCKET = 4154,
/** Added 2.1 */
- CAP_AUTOMATICSENSEMEDIUM = 4155,
+ CAP_AUTOMATICSENSEMEDIUM = 4155,
/** Added 2.1 */
- CAP_CUSTOMINTERFACEGUID = 4156,
+ CAP_CUSTOMINTERFACEGUID = 4156,
/** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */
- ICAP_AUTOBRIGHT = 4352,
+ ICAP_AUTOBRIGHT = 4352,
/** The brightness values available within the Source. */
- ICAP_BRIGHTNESS = 4353,
+ ICAP_BRIGHTNESS = 4353,
/** The contrast values available within the Source. */
- ICAP_CONTRAST = 4355,
+ ICAP_CONTRAST = 4355,
/** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */
- ICAP_CUSTHALFTONE = 4356,
+ ICAP_CUSTHALFTONE = 4356,
/** Specifies the exposure time used to capture the image, in seconds. */
ICAP_EXPOSURETIME = 4357,
/** Describes the color characteristic of the subtractive filter applied to the image data. Multiple
@@ -567,204 +604,85 @@ declare enum EnumDWT_Cap {
ICAP_SUPPORTEDEXTIMAGEINFO = 4446
}
-/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected.
- * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities =
- * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION.
- */
-declare enum EnumDWT_CapType {
- /** Nothing. */
- TWON_NONE = 0,
- /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and
- * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS
- * capability, would use this type of container.
+/** ICAP_BITORDER values. */
+declare enum EnumDWT_CapBitOrder {
+ TWBO_LSBFIRST = 0,
+ /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */
+ TWBO_MSBFIRST = 1
+}
+
+/** ICAP_BITDEPTHREDUCTION values. */
+declare enum EnumDWT_CapBitdepthReduction {
+ TWBR_THRESHOLD = 0,
+ TWBR_HALFTONE = 1,
+ TWBR_CUSTHALFTONE = 2,
+ TWBR_DIFFUSION = 3
+}
+
+/** CAP_FEEDERALIGNMENT values. */
+declare enum EnumDWT_CapFeederAlignment {
+ /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */
+ TWFA_NONE = 0,
+ /** The alignment is to the left. */
+ TWFA_LEFT = 1,
+ /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the
+ * device. If this is set, then the Application should calculate any frames with a left offset of zero.
*/
- TWON_ARRAY = 3,
- /** This is the most general type because it defines a list of values from which the Current Value can be chosen.
- * The values do not progress uniformly through a range and there is not a consistent step size between the values.
- * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600).
- */
- TWON_ENUMERATION = 4,
- /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value.
- * For example, a capability that indicates the presence of a document feeder could be of this type.
- */
- TWON_ONEVALUE = 5,
- /** Many capabilities allow users to select their current value from a range of regularly spaced values.
- * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values.
- * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600).
- */
- TWON_RANGE = 6
+ TWFA_CENTER = 2,
+ /** The alignment is to the right. */
+ TWFA_RIGHT = 3
}
-/** ICAP_XFERMECH values. */
-declare enum EnumDWT_TransferMode {
- /** Native transfers require the data to be transferred to a single large block of RAM. Therefore,
- * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully.
- */
- TWSX_NATIVE = 0,
- /** Disk File Mode Transfers. */
- TWSX_FILE = 1,
- /** Buffered Memory Mode Transfers. */
- TWSX_MEMORY = 2,
- /** added 1.91 */
- TWSX_MEMFILE = 4
+/** CAP_FEEDERORDER values. */
+declare enum EnumDWT_CapFeederOrder {
+ /** The feeder starts with the top of the first page. */
+ TWFO_FIRSTPAGEFIRST = 0,
+ /** The feeder starts with the top of the last page. */
+ TWFO_LASTPAGEFIRST = 1
}
-/** ICAP_IMAGEFILEFORMAT values. */
-declare enum EnumDWT_FileFormat {
- /** Used for document imaging. Tagged Image File Format */
- TWFF_TIFF = 0,
- /** Native Macintosh format. Macintosh PICT */
- TWFF_PICT = 1,
- /** Native Microsoft format. Windows Bitmap */
- TWFF_BMP = 2,
- /** Used for document imaging. X-Windows Bitmap */
- TWFF_XBM = 3,
- /** Wrapper for JPEG images. JPEG File Interchange Format */
- TWFF_JFIF = 4,
- /** FlashPix, used with digital cameras. Flash Pix */
- TWFF_FPX = 5,
- /** Multi-page TIFF files. Multi-page tiff file */
- TWFF_TIFFMULTI = 6,
- /** An image format standard intended for use on the web, replaces GIF. */
- TWFF_PNG = 7,
- /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */
- TWFF_SPIFF = 8,
- /** File format for use with digital cameras. */
- TWFF_EXIF = 9,
- /** A file format from Adobe. 1.91 NB: this is not PDF/A */
- TWFF_PDF = 10,
- /** A file format from the Joint Photographic Experts Group. 1.91 */
- TWFF_JP2 = 11,
- /** 1.91 */
- TWFF_JPN = 12,
- /** 1.91 */
- TWFF_JPX = 13,
- /** A file format from LizardTech. 1.91 */
- TWFF_DEJAVU = 14,
- /** A file format from Adobe. 2.0 */
- TWFF_PDFA = 15,
- /** 2.1 Adobe PDF/A, Version 2 */
- TWFF_PDFA2 = 16
+/** ICAP_FILTER values. */
+declare enum EnumDWT_CapFilterType {
+ TWFT_RED = 0,
+ TWFT_GREEN = 1,
+ TWFT_BLUE = 2,
+ TWFT_NONE = 3,
+ TWFT_WHITE = 4,
+ TWFT_CYAN = 5,
+ TWFT_MAGENTA = 6,
+ TWFT_YELLOW = 7,
+ TWFT_BLACK = 8
}
-/** TIFF file compression type. */
-declare enum EnumDWT_TIFFCompressionType {
- /** Auto mode. */
- TIFF_AUTO = 0,
- /** Dump mode. */
- TIFF_NONE = 1,
- /** CCITT modified Huffman RLE. */
- TIFF_RLE = 2,
- /** CCITT Group 3 fax encoding. */
- TIFF_FAX3 = 3,
- /** CCITT T.4 (TIFF 6 name). */
- TIFF_T4 = 3,
- /** CCITT Group 4 fax encoding */
- TIFF_FAX4 = 4,
- /** CCITT T.6 (TIFF 6 name). */
- TIFF_T6 = 4,
- /** Lempel Ziv and Welch */
- TIFF_LZW = 5,
- TIFF_JPEG = 7,
- TIFF_PACKBITS = 32773
+/** ICAP_FLASHUSED2 values. */
+declare enum EnumDWT_CapFlash {
+ TWFL_NONE = 0,
+ TWFL_OFF = 1,
+ TWFL_ON = 2,
+ TWFL_AUTO = 3,
+ TWFL_REDEYE = 4
}
-/** The method to do interpolation. */
-declare enum EnumDWT_InterpolationMethod {
- IM_NEARESTNEIGHBOUR = 1,
- IM_BILINEAR = 2,
- IM_BICUBIC = 3,
- IM_BESTQUALITY = 5
+/** ICAP_FLIPROTATION values. */
+declare enum EnumDWT_CapFlipRotation {
+ /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */
+ TWFR_BOOK = 0,
+ /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */
+ TWFR_FANFOLD = 1
}
-/** Image type */
-declare enum EnumDWT_ImageType {
- /** Native Microsoft format. */
- IT_BMP = 0,
- /** JPEG format. */
- IT_JPG = 1,
- /** Tagged Image File Format. */
- IT_TIF = 2,
- /** An image format standard intended for use on the web, replaces GIF. */
- IT_PNG = 3,
- /** A file format from Adobe. */
- IT_PDF = 4,
- IT_ALL = 5
-}
-
-/** PDF file compression type. */
-declare enum EnumDWT_PDFCompressionType {
- /** Auto mode. */
- PDF_AUTO = 0,
- /** CCITT Group 3 fax encoding. */
- PDF_FAX3 = 1,
- /** CCITT Group 4 fax encoding */
- PDF_FAX4 = 2,
- /** Lempel Ziv and Welch */
- PDF_LZW = 3,
- /** CCITT modified Huffman RLE. */
- PDF_RLE = 4,
- PDF_JPEG = 5
-}
-
-declare enum EnumDWT_ShowMode {
- /** Activates the window and displays it in its current size and position. */
- SW_ACTIVE = 0,
- /** Maximizes the window */
- SW_MAX = 1,
- /** Minimize the window */
- SW_MIN = 2,
- /** Close the latest opened editor window */
- SW_CLOSE = 3,
- /** Check whether a window exists */
- SW_IFLIVE = 4
-}
-
-/** The kind of data stored in the container. */
-declare enum EnumDWT_CapValueType {
- TWTY_INT8 = 0,
- /** Means Item is a TW_INT16 */
- TWTY_INT16 = 1,
- /** Means Item is a TW_INT32 */
- TWTY_INT32 = 2,
- /** Means Item is a TW_UINT8 */
- TWTY_UINT8 = 3,
- /** Means Item is a TW_UINT16 */
- TWTY_UINT16 = 4,
- /** Means Item is a TW_int */
- TWTY_int = 5,
- /** Means Item is a TW_BOOL */
- TWTY_BOOL = 6,
- /** Means Item is a TW_FIX32 */
- TWTY_FIX32 = 7,
- /** Means Item is a TW_FRAME */
- TWTY_FRAME = 8,
- /** Means Item is a TW_STR32 */
- TWTY_STR32 = 9,
- /** Means Item is a TW_STR64 */
- TWTY_STR64 = 10,
- /** Means Item is a TW_STR128 */
- TWTY_STR128 = 11,
- /** Means Item is a TW_STR255 */
- TWTY_STR255 = 12
-}
-
-/** ICAP_UNITS values. */
-declare enum EnumDWT_UnitType {
- TWUN_INCHES = 0,
- TWUN_CENTIMETERS = 1,
- TWUN_PICAS = 2,
- TWUN_POINTS = 3,
- TWUN_TWIPS = 4,
- TWUN_PIXELS = 5,
- TWUN_MILLIMETERS = 6
-}
-
-/** ICAP_DUPLEX values. */
-declare enum EnumDWT_DUPLEX {
- TWDX_NONE = 0,
- TWDX_1PASSDUPLEX = 1,
- TWDX_2PASSDUPLEX = 2
+/** ICAP_IMAGEFILTER values. */
+declare enum EnumDWT_CapImageFilter {
+ TWIF_NONE = 0,
+ TWIF_AUTO = 1,
+ /** Good for halftone images. */
+ TWIF_LOWPASS = 2,
+ /** Good for improving text. */
+ TWIF_BANDPASS = 3,
+ /** Good for improving fine lines. */
+ TWIF_HIGHPASS = 4,
+ TWIF_TEXT = 3,
+ TWIF_FINELINE = 4
}
/** CAP_LANGUAGE values. */
@@ -918,6 +836,92 @@ declare enum EnumDWT_CapLanguage {
TWLG_VIETNAMESE = 113
}
+/** ICAP_LIGHTPATH values. */
+declare enum EnumDWT_CapLightPath {
+ TWLP_REFLECTIVE = 0,
+ TWLP_TRANSMISSIVE = 1
+}
+
+/** ICAP_LIGHTSOURCE values. */
+declare enum EnumDWT_CapLightSource {
+ TWLS_RED = 0,
+ TWLS_GREEN = 1,
+ TWLS_BLUE = 2,
+ TWLS_NONE = 3,
+ TWLS_WHITE = 4,
+ TWLS_UV = 5,
+ TWLS_IR = 6
+}
+
+/** ICAP_NOISEFILTER values. */
+declare enum EnumDWT_CapNoiseFilter {
+ TWNF_NONE = 0,
+ TWNF_AUTO = 1,
+ TWNF_LONEPIXEL = 2,
+ TWNF_MAJORITYRULE = 3
+}
+
+/** ICAP_ORIENTATION values. */
+declare enum EnumDWT_CapORientation {
+ TWOR_ROT0 = 0,
+ TWOR_ROT90 = 1,
+ TWOR_ROT180 = 2,
+ TWOR_ROT270 = 3,
+ TWOR_PORTRAIT = 0,
+ TWOR_LANDSCAPE = 3,
+ /** 2.0 */
+ TWOR_AUTO = 4,
+ /** 2.0 */
+ TWOR_AUTOTEXT = 5,
+ /** 2.0 */
+ TWOR_AUTOPICTURE = 6
+}
+
+/** ICAP_OVERSCAN values. */
+declare enum EnumDWT_CapOverscan {
+ TWOV_NONE = 0,
+ TWOV_AUTO = 1,
+ TWOV_TOPBOTTOM = 2,
+ TWOV_LEFTRIGHT = 3,
+ TWOV_ALL = 4
+}
+
+/** ICAP_PIXELFLAVOR values. */
+declare enum EnumDWT_CapPixelFlavor {
+ /** Zero pixel represents darkest shade. zero pixel represents darkest shade */
+ TWPF_CHOCOLATE = 0,
+ /** Zero pixel represents lightest shade. zero pixel represents lightest shade */
+ TWPF_VANILLA = 1
+}
+
+/** ICAP_PLANARCHUNKY values. */
+declare enum EnumDWT_CapPlanarChunky {
+ TWPC_CHUNKY = 0,
+ TWPC_PLANAR = 1
+}
+
+/** CAP_PRINTER values. */
+declare enum EnumDWT_CapPrinter {
+ TWPR_IMPRINTERTOPBEFORE = 0,
+ TWPR_IMPRINTERTOPAFTER = 1,
+ TWPR_IMPRINTERBOTTOMBEFORE = 2,
+ TWPR_IMPRINTERBOTTOMAFTER = 3,
+ TWPR_ENDORSERTOPBEFORE = 4,
+ TWPR_ENDORSERTOPAFTER = 5,
+ TWPR_ENDORSERBOTTOMBEFORE = 6,
+ TWPR_ENDORSERBOTTOMAFTER = 7
+}
+
+/** CAP_PRINTERMODE values. */
+declare enum EnumDWT_CapPrinterMode {
+ /** Specifies that the printed text will consist of a single string. */
+ TWPM_SINGLESTRING = 0,
+ /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */
+ TWPM_MULTISTRING = 1,
+ /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */
+ TWPM_COMPOUNDSTRING = 2
+}
+
/** TWAIN Supported sizes. */
declare enum EnumDWT_CapSupportedSizes {
/** 0 */
@@ -1046,180 +1050,68 @@ declare enum EnumDWT_CapSupportedSizes {
TWSS_MAXSIZE = 54
}
-/** CAP_FEEDERALIGNMENT values. */
-declare enum EnumDWT_CapFeederAlignment {
- /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */
- TWFA_NONE = 0,
- /** The alignment is to the left. */
- TWFA_LEFT = 1,
- /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the
- * device. If this is set, then the Application should calculate any frames with a left offset of zero.
+/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected.
+ * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities =
+ * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION.
+ */
+declare enum EnumDWT_CapType {
+ /** Nothing. */
+ TWON_NONE = 0,
+ /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and
+ * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS
+ * capability, would use this type of container.
*/
- TWFA_CENTER = 2,
- /** The alignment is to the right. */
- TWFA_RIGHT = 3
-}
-/** CAP_FEEDERORDER values. */
-declare enum EnumDWT_CapFeederOrder {
- /** The feeder starts with the top of the first page. */
- TWFO_FIRSTPAGEFIRST = 0,
- /** The feeder starts with the top of the last page. */
- TWFO_LASTPAGEFIRST = 1
+ TWON_ARRAY = 3,
+ /** This is the most general type because it defines a list of values from which the Current Value can be chosen.
+ * The values do not progress uniformly through a range and there is not a consistent step size between the values.
+ * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600).
+ */
+ TWON_ENUMERATION = 4,
+ /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value.
+ * For example, a capability that indicates the presence of a document feeder could be of this type.
+ */
+ TWON_ONEVALUE = 5,
+ /** Many capabilities allow users to select their current value from a range of regularly spaced values.
+ * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values.
+ * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600).
+ */
+ TWON_RANGE = 6
}
-/** CAP_PRINTER values. */
-declare enum EnumDWT_CapPrinter {
- TWPR_IMPRINTERTOPBEFORE = 0,
- TWPR_IMPRINTERTOPAFTER = 1,
- TWPR_IMPRINTERBOTTOMBEFORE = 2,
- TWPR_IMPRINTERBOTTOMAFTER = 3,
- TWPR_ENDORSERTOPBEFORE = 4,
- TWPR_ENDORSERTOPAFTER = 5,
- TWPR_ENDORSERBOTTOMBEFORE = 6,
- TWPR_ENDORSERBOTTOMAFTER = 7
+/** The kind of data stored in the container. */
+declare enum EnumDWT_CapValueType {
+ TWTY_INT8 = 0,
+ /** Means Item is a TW_INT16 */
+ TWTY_INT16 = 1,
+ /** Means Item is a TW_INT32 */
+ TWTY_INT32 = 2,
+ /** Means Item is a TW_UINT8 */
+ TWTY_UINT8 = 3,
+ /** Means Item is a TW_UINT16 */
+ TWTY_UINT16 = 4,
+ /** Means Item is a TW_int */
+ TWTY_int = 5,
+ /** Means Item is a TW_BOOL */
+ TWTY_BOOL = 6,
+ /** Means Item is a TW_FIX32 */
+ TWTY_FIX32 = 7,
+ /** Means Item is a TW_FRAME */
+ TWTY_FRAME = 8,
+ /** Means Item is a TW_STR32 */
+ TWTY_STR32 = 9,
+ /** Means Item is a TW_STR64 */
+ TWTY_STR64 = 10,
+ /** Means Item is a TW_STR128 */
+ TWTY_STR128 = 11,
+ /** Means Item is a TW_STR255 */
+ TWTY_STR255 = 12
}
-/** CAP_PRINTERMODE values. */
-declare enum EnumDWT_CapPrinterMode {
- /** Specifies that the printed text will consist of a single string. */
- TWPM_SINGLESTRING = 0,
- /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */
- TWPM_MULTISTRING = 1,
- /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */
- TWPM_COMPOUNDSTRING = 2
-}
-
-/** ICAP_BITDEPTHREDUCTION values. */
-declare enum EnumDWT_CapBitdepthReduction {
- TWBR_THRESHOLD = 0,
- TWBR_HALFTONE = 1,
- TWBR_CUSTHALFTONE = 2,
- TWBR_DIFFUSION = 3
-}
-
-/** ICAP_BITORDER values. */
-declare enum EnumDWT_CapBitOrder {
- TWBO_LSBFIRST = 0,
- /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */
- TWBO_MSBFIRST = 1
-}
-
-/** ICAP_FILTER values. */
-declare enum EnumDWT_CapFilterType {
- TWFT_RED = 0,
- TWFT_GREEN = 1,
- TWFT_BLUE = 2,
- TWFT_NONE = 3,
- TWFT_WHITE = 4,
- TWFT_CYAN = 5,
- TWFT_MAGENTA = 6,
- TWFT_YELLOW = 7,
- TWFT_BLACK = 8
-}
-
-/** ICAP_FLASHUSED2 values. */
-declare enum EnumDWT_CapFlash {
- TWFL_NONE = 0,
- TWFL_OFF = 1,
- TWFL_ON = 2,
- TWFL_AUTO = 3,
- TWFL_REDEYE = 4
-}
-
-/** ICAP_FLIPROTATION values. */
-declare enum EnumDWT_CapFlipRotation {
- /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */
- TWFR_BOOK = 0,
- /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */
- TWFR_FANFOLD = 1
-}
-
-/** ICAP_IMAGEFILTER values. */
-declare enum EnumDWT_CapImageFilter {
- TWIF_NONE = 0,
- TWIF_AUTO = 1,
- /** Good for halftone images. */
- TWIF_LOWPASS = 2,
- /** Good for improving text. */
- TWIF_BANDPASS = 3,
- /** Good for improving fine lines. */
- TWIF_HIGHPASS = 4,
- TWIF_TEXT = 3,
- TWIF_FINELINE = 4
-}
-
-/** ICAP_LIGHTPATH values. */
-declare enum EnumDWT_CapLightPath {
- TWLP_REFLECTIVE = 0,
- TWLP_TRANSMISSIVE = 1
-}
-
-/** ICAP_LIGHTSOURCE values. */
-declare enum EnumDWT_CapLightSource {
- TWLS_RED = 0,
- TWLS_GREEN = 1,
- TWLS_BLUE = 2,
- TWLS_NONE = 3,
- TWLS_WHITE = 4,
- TWLS_UV = 5,
- TWLS_IR = 6
-}
-
-/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */
-declare enum EnumDWT_MagType {
- /** Added 2.0 */
- TWMD_MICR = 0,
- /** added 2.1 */
- TWMD_RAW = 1,
- /** added 2.1 */
- TWMD_INVALID = 2
-}
-
-/** ICAP_NOISEFILTER values. */
-declare enum EnumDWT_CapNoiseFilter {
- TWNF_NONE = 0,
- TWNF_AUTO = 1,
- TWNF_LONEPIXEL = 2,
- TWNF_MAJORITYRULE = 3
-}
-
-/** ICAP_ORIENTATION values. */
-declare enum EnumDWT_CapORientation {
- TWOR_ROT0 = 0,
- TWOR_ROT90 = 1,
- TWOR_ROT180 = 2,
- TWOR_ROT270 = 3,
- TWOR_PORTRAIT = 0,
- TWOR_LANDSCAPE = 3,
- /** 2.0 */
- TWOR_AUTO = 4,
- /** 2.0 */
- TWOR_AUTOTEXT = 5,
- /** 2.0 */
- TWOR_AUTOPICTURE = 6
-}
-
-/** ICAP_OVERSCAN values. */
-declare enum EnumDWT_CapOverscan {
- TWOV_NONE = 0,
- TWOV_AUTO = 1,
- TWOV_TOPBOTTOM = 2,
- TWOV_LEFTRIGHT = 3,
- TWOV_ALL = 4
-}
-
-/** ICAP_PIXELFLAVOR values. */
-declare enum EnumDWT_CapPixelFlavor {
- /** Zero pixel represents darkest shade. zero pixel represents darkest shade */
- TWPF_CHOCOLATE = 0,
- /** Zero pixel represents lightest shade. zero pixel represents lightest shade */
- TWPF_VANILLA = 1
-}
-
-/** ICAP_PLANARCHUNKY values. */
-declare enum EnumDWT_CapPlanarChunky {
- TWPC_CHUNKY = 0,
- TWPC_PLANAR = 1
+/** ICAP_DUPLEX values. */
+declare enum EnumDWT_DUPLEX {
+ TWDX_NONE = 0,
+ TWDX_1PASSDUPLEX = 1,
+ TWDX_2PASSDUPLEX = 2
}
/** Data source status. */
@@ -1234,6 +1126,48 @@ declare enum EnumDWT_DataSourceStatus {
TWDSS_ACQUIRING = 3
}
+declare enum EnumDWT_Error {
+ ModuleNotExists = -2371
+}
+
+/** ICAP_IMAGEFILEFORMAT values. */
+declare enum EnumDWT_FileFormat {
+ /** Used for document imaging. Tagged Image File Format */
+ TWFF_TIFF = 0,
+ /** Native Macintosh format. Macintosh PICT */
+ TWFF_PICT = 1,
+ /** Native Microsoft format. Windows Bitmap */
+ TWFF_BMP = 2,
+ /** Used for document imaging. X-Windows Bitmap */
+ TWFF_XBM = 3,
+ /** Wrapper for JPEG images. JPEG File Interchange Format */
+ TWFF_JFIF = 4,
+ /** FlashPix, used with digital cameras. Flash Pix */
+ TWFF_FPX = 5,
+ /** Multi-page TIFF files. Multi-page tiff file */
+ TWFF_TIFFMULTI = 6,
+ /** An image format standard intended for use on the web, replaces GIF. */
+ TWFF_PNG = 7,
+ /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */
+ TWFF_SPIFF = 8,
+ /** File format for use with digital cameras. */
+ TWFF_EXIF = 9,
+ /** A file format from Adobe. 1.91 NB: this is not PDF/A */
+ TWFF_PDF = 10,
+ /** A file format from the Joint Photographic Experts Group. 1.91 */
+ TWFF_JP2 = 11,
+ /** 1.91 */
+ TWFF_JPN = 12,
+ /** 1.91 */
+ TWFF_JPX = 13,
+ /** A file format from LizardTech. 1.91 */
+ TWFF_DEJAVU = 14,
+ /** A file format from Adobe. 2.0 */
+ TWFF_PDFA = 15,
+ /** 2.1 Adobe PDF/A, Version 2 */
+ TWFF_PDFA2 = 16
+}
+
/** Fit window type */
declare enum EnumDWT_FitWindowType {
/** Fit the image to the width and height of the window */
@@ -1244,18 +1178,186 @@ declare enum EnumDWT_FitWindowType {
enumFitWindowWidth = 2
}
-declare enum EnumDWT_UploadDataFormat {
- Binary = 0,
- Base64 = 1
+/** Image type */
+declare enum EnumDWT_ImageType {
+ /** Native Microsoft format. */
+ IT_BMP = 0,
+ /** JPEG format. */
+ IT_JPG = 1,
+ /** Tagged Image File Format. */
+ IT_TIF = 2,
+ /** An image format standard intended for use on the web, replaces GIF. */
+ IT_PNG = 3,
+ /** A file format from Adobe. */
+ IT_PDF = 4,
+ /** All supported formats which are bmp, jpg, tif, png and pdf */
+ IT_ALL = 5
+}
+
+declare enum EnumDWT_InitMsg {
+ Info = 1,
+ Error = 2,
+ NotInstalledError = 3,
+ DownloadError = 4,
+ DownloadNotRestartError = 5
+}
+
+/** The method to do interpolation. */
+declare enum EnumDWT_InterpolationMethod {
+ IM_NEARESTNEIGHBOUR = 1,
+ IM_BILINEAR = 2,
+ IM_BICUBIC = 3,
+ IM_BESTQUALITY = 5
+}
+
+declare enum EnumDWT_Language {
+ English = 0,
+ French = 1,
+ Arabic = 2,
+ Spanish = 3,
+ Portuguese = 4,
+ German = 5,
+ Italian = 6,
+ Russian = 7,
+ Chinese = 8
+}
+
+/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */
+declare enum EnumDWT_MagType {
+ /** Added 2.0 */
+ TWMD_MICR = 0,
+ /** added 2.1 */
+ TWMD_RAW = 1,
+ /** added 2.1 */
+ TWMD_INVALID = 2
+}
+
+/** For query the operation that are supported by the data source on a capability .
+ * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT
+ */
+declare enum EnumDWT_MessageType {
+ TWQC_GET = 1,
+ TWQC_SET = 2,
+ TWQC_GETDEFAULT = 4,
+ TWQC_GETCURRENT = 8,
+ TWQC_RESET = 16
}
declare enum EnumDWT_MouseShape {
- Default = 0,
- Hand = 1,
- Crosshair = 2,
- Zoom = 3
+ Default = 0,
+ Hand = 1,
+ Crosshair = 2,
+ Zoom = 3
}
+/** PDF file compression type. */
+declare enum EnumDWT_PDFCompressionType {
+ /** Auto mode. */
+ PDF_AUTO = 0,
+ /** CCITT Group 3 fax encoding. */
+ PDF_FAX3 = 1,
+ /** CCITT Group 4 fax encoding */
+ PDF_FAX4 = 2,
+ /** Lempel Ziv and Welch */
+ PDF_LZW = 3,
+ /** CCITT modified Huffman RLE. */
+ PDF_RLE = 4,
+ /** JPEG compression. */
+ PDF_JPEG = 5
+}
+
+/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */
+declare enum EnumDWT_PixelType {
+ TWPT_BW = 0,
+ TWPT_GRAY = 1,
+ TWPT_RGB = 2,
+ TWPT_PALLETE = 3,
+ TWPT_CMY = 4,
+ TWPT_CMYK = 5,
+ TWPT_YUV = 6,
+ TWPT_YUVK = 7,
+ TWPT_CIEXYZ = 8,
+ TWPT_LAB = 9,
+ TWPT_SRGB = 10,
+ TWPT_SCRGB = 11,
+ TWPT_INFRARED = 16
+}
+
+declare enum EnumDWT_PlatformType {
+ /// Fit the image to the width and height of the window
+ enumWindow = 0,
+ /// Fit the image to the height of the window
+ enumMac = 1,
+ /// Fit the image to the width of the window
+ enumLinux = 2
+}
+
+declare enum EnumDWT_ShowMode {
+ /** Activates the window and displays it in its current size and position. */
+ SW_ACTIVE = 0,
+ /** Maximizes the window */
+ SW_MAX = 1,
+ /** Minimize the window */
+ SW_MIN = 2,
+ /** Close the latest opened editor window */
+ SW_CLOSE = 3,
+ /** Check whether a window exists */
+ SW_IFLIVE = 4
+}
+
+/** TIFF file compression type. */
+declare enum EnumDWT_TIFFCompressionType {
+ /** Auto mode. */
+ TIFF_AUTO = 0,
+ /** Dump mode. */
+ TIFF_NONE = 1,
+ /** CCITT modified Huffman RLE. */
+ TIFF_RLE = 2,
+ /** CCITT Group 3 fax encoding. */
+ TIFF_FAX3 = 3,
+ /** CCITT T.4 (TIFF 6 name). */
+ TIFF_T4 = 3,
+ /** CCITT Group 4 fax encoding */
+ TIFF_FAX4 = 4,
+ /** CCITT T.6 (TIFF 6 name). */
+ TIFF_T6 = 4,
+ /** Lempel Ziv and Welch */
+ TIFF_LZW = 5,
+ TIFF_JPEG = 7,
+ TIFF_PACKBITS = 32773
+}
+
+/** ICAP_XFERMECH values. */
+declare enum EnumDWT_TransferMode {
+ /** Native transfers require the data to be transferred to a single large block of RAM. Therefore,
+ * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully.
+ */
+ TWSX_NATIVE = 0,
+ /** Disk File Mode Transfers. */
+ TWSX_FILE = 1,
+ /** Buffered Memory Mode Transfers. */
+ TWSX_MEMORY = 2/*,*/
+ /** added 1.91 , not supported in DWT yet*/
+ /** TWSX_MEMFILE = 4*/
+}
+
+/** ICAP_UNITS values. */
+declare enum EnumDWT_UnitType {
+ TWUN_INCHES = 0,
+ TWUN_CENTIMETERS = 1,
+ TWUN_PICAS = 2,
+ TWUN_POINTS = 3,
+ TWUN_TWIPS = 4,
+ TWUN_PIXELS = 5,
+ TWUN_MILLIMETERS = 6
+}
+
+declare enum EnumDWT_UploadDataFormat {
+ Binary = 0,
+ Base64 = 1
+}
+
+/** interface for a DWT container which basically defines a DIV on the page */
interface Container {
ContainerId: string;
Width: string | number;
@@ -1268,62 +1370,85 @@ interface Container {
// properties (get/set) / sync functions
interface WebTwain {
/**
- * Returns or sets whether multi-page selection is supported.
- * @type {bool}
+ * Returns whether the instance of a DWT is initialized
+ * @type {boolean}
*/
+ bReady: boolean;
+
+ /**
+ * Returns the runtime id of the dwt object
+ * @type {string}
+ */
+ readonly clientId: string;
+
+ /**
+ * Returns the runtime class for the dwt container DIV
+ * @type {string}
+ */
+ containerClass: string;
+
+ /*ignored
+ httpUrl
+ objectName
+
+ ...other internal ones
+ */
+
+ /*
+ * Properties
+ */
+
+ /**
+ * Returns or sets whether multi-page selection is supported.
+ * @type {boolean}
+ */
AllowMultiSelect: boolean;
/**
* [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE.
- * @type {bool}
+ * @type {boolean}
*/
AllowPluginAuthentication: boolean;
/**
* [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false.
- * @type {bool}
+ * @type {boolean}
*/
AsyncMode: boolean;
/**
* Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
BackgroundColor: number;
/**
* Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
BackgroundFillColor: number;
- /**
- * [Deprecated.] Returns the number of barcode detected in an image.
- * @type {int}
- */
- BarcodeCount: number;
-
/**
* Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
BitDepth: number;
/**
* Returns the current deviation of the pixels in the image.
- * @type {float}
+ * @type {number}
*/
BlankImageCurrentStdDev: number;
/**
* Returns or sets the standard deviation of the pixels in the image.
- * @type {float}
+ * @type {number}
*/
BlankImageMaxStdDev: number;
/**
* Returns or sets the dividing line between black and white. The default value is 128.
- * @type {int}
+ * @type {number}
*/
BlankImageThreshold: number;
@@ -1335,79 +1460,73 @@ interface WebTwain {
/**
* Returns or sets the brightness values available within the Source. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Brightness: number;
/**
* [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning.
- * @type {int}
+ * @type {number}
*/
BrokerProcessType: number;
/**
* Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk.
- * @type {int}
+ * @type {number}
*/
BufferMemoryLimit: number;
- /**
- * Specifies the capabiltiy to be negotiated. This is a runtime property.
- * @type {EnumDWT_Cap}
- */
- Capability: EnumDWT_Cap;
-
/**
* Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
CapCurrentIndex: number;
/**
* Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapCurrentValue: number;
/**
* Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
CapDefaultIndex: number;
/**
* Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property.
- * @type {double}
+ * @type {number}
*/
CapDefaultValue: number;
+ /**
+ * Retruns the description for a capability
+ * @type {string}
+ */
+ CapDescription: string;
+
/**
* Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapMaxValue: number;
/**
* Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapMinValue: number;
/**
* [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
CapNumItems: number;
- /**
- * [Deprecated.] Replaced by GetCapItemsString method and SetCapItemsString method.
- * @type {string}
- */
- CapItemsString: string;
-
/**
* Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapStepSize: number;
@@ -1419,7 +1538,7 @@ interface WebTwain {
/**
* Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapValue: number;
@@ -1431,25 +1550,25 @@ interface WebTwain {
/**
* Sets or returns the value type for reading the value of a capability. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
CapValueType: number;
+ /**
+ * Specifies the capabiltiy to be negotiated. This is a runtime property.
+ * @type {EnumDWT_Cap}
+ */
+ Capability: EnumDWT_Cap;
+
/**
* Returns or sets the contrast values available within the Source. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Contrast: number;
- /**
- * Sets or returns the product name string for the application identity.
- * @type {string}
- */
- ProductName: string;
-
/**
* Returns or sets current index of image in buffer. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
CurrentImageIndexInBuffer: number;
@@ -1461,7 +1580,7 @@ interface WebTwain {
/**
* Returns the value indicating the data source status. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
DataSourceStatus: number;
@@ -1473,19 +1592,19 @@ interface WebTwain {
/**
* Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
Duplex: number;
/**
* [Deprecated.] Returns or sets whether the user can zoom image using hot key.
- * @type {bool}
+ * @type {boolean}
*/
EnableInteractiveZoom: boolean;
/**
* Returns the error code. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ErrorCode: number;
@@ -1495,12 +1614,6 @@ interface WebTwain {
*/
ErrorString: string;
- /**
- * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode.
- * @type {EnumDWT_FitWindowType}
- */
- FitWindowType: EnumDWT_FitWindowType;
-
/**
* Returns or sets the password used to log into the FTP server.
* @type {string}
@@ -1509,7 +1622,7 @@ interface WebTwain {
/**
* Returns or sets the port number of the FTP server.
- * @type {int}
+ * @type {number}
*/
FTPPort: number;
@@ -1519,12 +1632,42 @@ interface WebTwain {
*/
FTPUserName: string;
+ /**
+ * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode.
+ * @type {EnumDWT_FitWindowType}
+ */
+ FitWindowType: EnumDWT_FitWindowType;
+
+ /**
+ * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property.
+ * @type {string}
+ */
+ HTTPPostResponseString: string;
+
+ /**
+ * Returns whether a HTTP request has credentials
+ * @type {boolean}
+ */
+ HTTPRequestswithCredentials: boolean;
+
+ /**
+ * Returns or sets the height of the dwt viewer object
+ * @type {string|number}
+ */
+ Height: string | number;
+
/**
* Returns how many images are in buffer. This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
HowManyImagesInBuffer: number;
+ /**
+ * Specifies the content type of a http upload.
+ * @type {string}
+ */
+ HttpContentTypeFieldValue: string;
+
/**
* Specifies the field name of uploaded image through POST.
* @type {string}
@@ -1539,15 +1682,9 @@ interface WebTwain {
/**
* Returns or sets the port number of the HTTP server.
- * @type {int}
+ * @type {number|string}
*/
- HTTPPort: number;
-
- /**
- * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property.
- * @type {string}
- */
- HTTPPostResponseString: string;
+ HTTPPort: number | string;
/**
* [Deprecated.] Returns or sets the user name used to log into the HTTP server.
@@ -1557,205 +1694,211 @@ interface WebTwain {
/**
* Returns or sets whether the feature of disk caching is enabled.
- * @type {bool}
+ * @type {boolean}
*/
IfAllowLocalCache: boolean;
/**
* Returns or sets whether insert or append new scanned images.
- * @type {bool}
+ * @type {boolean}
*/
IfAppendImage: boolean;
/**
* Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoBright: boolean;
/**
* Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoDiscardBlankpages: boolean;
/**
* Returns or sets whether the Source enable automatic document feeding process. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoFeed: boolean;
+ /**
+ * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property.
+ * @type {boolean}
+ */
+ IfAutoScan: boolean;
+
+ /**
+ * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images
+ * @type {boolean}
+ */
+ IfAutoScroll: boolean;
+
/**
* Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual.
- * @type {bool}
+ * @type {boolean}
*/
IfAutomaticBorderDetection: boolean;
/**
* Turns automatic skew correction on and off.
- * @type {bool}
+ * @type {boolean}
*/
IfAutomaticDeskew: boolean;
- /**
- * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property.
- * @type {bool}
- */
- IfAutoScan: boolean;
-
/**
* Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfDisableSourceAfterAcquire: boolean;
/**
* Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfDuplexEnabled: boolean;
/**
* Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfFeederEnabled: boolean;
/**
* Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property.
- * @type {bool}
+ * @type {boolean}
*/
IfFeederLoaded: boolean;
/**
* Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode.
- * @type {bool}
+ * @type {boolean}
*/
IfFitWindow: boolean;
/**
* [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE.
- * @type {bool}
+ * @type {boolean}
*/
IfModalUI: boolean;
/**
* Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images.
- * @type {bool}
+ * @type {boolean}
*/
IfOpenImageWithGDIPlus: boolean;
- /**
- * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property.
- * @type {bool}
- */
- IfPaperDetectable: boolean;
-
/**
* Returns or sets whether FTP passive mode is enabled.
- * @type {bool}
+ * @type {boolean}
*/
IfPASVMode: boolean;
+ /**
+ * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property.
+ * @type {boolean}
+ */
+ IfPaperDetectable: boolean;
+
+ /**
+ * Returns or sets whether SSL is used when uploading or downloading images.
+ * @type {boolean}
+ */
+ IfSSL: boolean;
+
/**
* [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfScanInNewThread: boolean;
/**
* Sets or returns whether to show the cancel dialog when uploading images to server.
- * @type {bool}
+ * @type {boolean}
*/
IfShowCancelDialogWhenImageTransfer: boolean;
/**
* Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder.
- * @type {bool}
+ * @type {boolean}
*/
IfShowFileDialog: boolean;
/**
* Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfShowIndicator: boolean;
/**
* [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface.
- * @type {bool}
+ * @type {boolean}
*/
IfShowPrintUI: boolean;
/**
* Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfShowProgressBar: boolean;
/**
* Returns or sets whether the Source displays the User Interface.
- * @type {bool}
+ * @type {boolean}
*/
IfShowUI: boolean;
/**
- * Returns or sets whether SSL is used when uploading or downloading images.
- * @type {bool}
+ * Returns or sets whether to throw exceptions
+ * @type {boolean}
*/
- IfSSL: boolean;
+ IfThrowException: boolean;
/**
* Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfTiffMultiPage: boolean;
/**
* Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property.
- * @type {bool}
+ * @type {boolean}
*/
IfUIControllable: boolean;
/**
* Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices.
- * @type {bool}
+ * @type {boolean}
*/
IfUseTwainDSM: boolean;
- /**
- * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images
- * @type {bool}
- */
- IfAutoScroll: boolean;
-
/**
* [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
ImageBitsPerPixel: number;
/**
* Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only.
- * @type {int}
+ * @type {number}
*/
ImageCaptureDriverType: number;
/**
* [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfEnableEnumerator: boolean;
/**
* [Deprecated.] Returns or sets whether the Image Editor is a modal window.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfModal: boolean;
/**
* [Deprecated.] Returns or sets whether the Image Editor is read-only.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfReadonly: boolean;
@@ -1767,37 +1910,37 @@ interface WebTwain {
/**
* Returns the document number of the current image. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLayoutDocumentNumber: number;
/**
* Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameBottom: number;
/**
* Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameLeft: number;
/**
* Returns the frame number of the current image. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLayoutFrameNumber: number;
/**
* Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameRight: number;
/**
* Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameTop: number;
@@ -1809,13 +1952,13 @@ interface WebTwain {
/**
* [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLength: number;
/**
* Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN.
- * @type {short}
+ * @type {number}
*/
ImageMargin: number;
@@ -1827,31 +1970,31 @@ interface WebTwain {
/**
* [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageWidth: number;
/**
* [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageXResolution: number;
/**
* [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageYResolution: number;
/**
* Returns or sets the quality of JPEG files and PDF files using JPEG compression.
- * @type {short}
+ * @type {number}
*/
JPEGQuality: number;
/**
* Returns or sets the log level for debugging.
- * @type {short}
+ * @type {number}
*/
LogLevel: number;
@@ -1863,7 +2006,7 @@ interface WebTwain {
/**
* Return the magnetic type if the scanner support magnetic data recognition.
- * @type {short}
+ * @type {number}
*/
MagType: number;
@@ -1875,46 +2018,40 @@ interface WebTwain {
/**
* Returns or sets the maximum number of images can be held in buffer.
- * @type {short}
+ * @type {number}
*/
MaxImagesInBuffer: number;
/**
* [Deprecated.] Returns or sets how many threads can be used when you upload files through POST.
- * @type {int}
+ * @type {number}
*/
MaxInternetTransferThreads: number;
/**
* Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document.
- * @type {int}
+ * @type {number}
*/
MaxUploadImageSize: number;
/**
* Returns or sets the shape of the mouse.
- * @type {bool}
+ * @type {boolean}
*/
MouseShape: boolean;
/**
* Returns the X co-ordinate of the mouse. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
MouseX: number;
/**
* Returns the Y co-ordinate of the mouse. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
MouseY: number;
- /**
- * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property.
- * @type {short}
- */
- PageSize: number;
-
/**
* Returns or sets the name of the person who creates the PDF document.
* @type {string}
@@ -1975,15 +2112,21 @@ interface WebTwain {
*/
PDFVersion: string;
+ /**
+ * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property.
+ * @type {number}
+ */
+ PageSize: number;
+
/**
* Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
PendingXfers: number;
/**
* Returns or sets the pixel flavor for acquired images. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
PixelFlavor: number;
@@ -2005,6 +2148,12 @@ interface WebTwain {
*/
ProductKey: string;
+ /**
+ * Sets or returns the product name string for the application identity.
+ * @type {string}
+ */
+ ProductName: string;
+
/**
* [Deprecated.] Returns or sets the name of the proxy server.
* @type {string}
@@ -2013,46 +2162,40 @@ interface WebTwain {
/**
* Returns or sets the current resolution for acquired images. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Resolution: number;
/**
* Returns or sets how many scanned images are selected.
- * @type {short}
+ * @type {number}
*/
SelectedImagesCount: number;
/**
* Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
SelectionImageBorderColor: number;
/**
* Specifies a fixed aspect ratio to be used for selecting an area.
- * @type {float}
+ * @type {number}
*/
SelectionRectAspectRatio: number;
+ /**
+ * Specifies whether to show the page number
+ * @type {boolean}
+ */
+ ShowPageNumber: boolean;
+
/**
* Returns how many sources are installed in the system. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
SourceCount: number;
- /**
- * [Deprecated.] Replaced by GetSourceNameItems method.
- * @type {string}
- */
- SourceNameItems: string;
-
- /**
- * [Deprecated.]
- * @type {string}
- */
- GetSourceNames: string;
-
/**
* Returns or sets the compression type of TIFF files. This is a runtime property.
* @type {EnumDWT_TIFFCompressionType}
@@ -2067,160 +2210,194 @@ interface WebTwain {
/**
* Returns or sets the unit of measure. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
Unit: number;
+ /**
+ * Specifies whether to show the vertical scroll bar
+ * @type {boolean}
+ */
+ VScrollBar: boolean;
+
/**
* Sets or returns the version info string for the application identity.
* @type {string}
*/
VersionInfo: string;
+ /**
+ * Returns or sets the width of the dwt object viewer
+ * @type {string|number}
+ */
+ Width: string | number;
+
/**
* Returns and sets the number of images you are willing to transfer per session. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
XferCount: number;
/**
* Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1.
- * @type {float}
+ * @type {number}
*/
Zoom: number;
+ /** ignored
+ style
+ _AutoCropMethod
+ */
/**
- * Binds a specified function to an event, so that the function gets called whenever the event fires.
- * @method WebTwain#RegisterEvent
- * @param {string} name the name of the event that the function is bound to.
- * @param {object} evt specifies the function to call when event fires.
- * @return {bool}
+ * Displays the source's built-in interface to acquire image.
+ * @method WebTwain#AcquireImage
+ * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
*/
- RegisterEvent(name: string, evt: object): boolean;
+ AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
- // --- SCAN start --
+ /**
+ * Add text on an image.
+ * @method WebTwain#AddText
+ * @param {number} sImageIndex the index of the image that you want to add text to.
+ * @param {number} x the x coordinate for the text.
+ * @param {number} y the y coordinate for the text.
+ * @param {string} text the content of the text that you want to add.
+ * @param {number} txtColor the color for the text.
+ * @param {number} backgroundColor the background color.
+ * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter.
+ * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1
+ * @return {boolean}
+ */
+ AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean;
/**
* Cancels all pending transfers.
* @method WebTwain#CancelAllPendingTransfers
- * @return {bool}
+ * @return {boolean}
*/
CancelAllPendingTransfers(): boolean;
/**
- * Closes Data Source.
- * @method WebTwain#CloseSource
- * @return {bool}
+ * Gets information of the capability specified by the Capability property.
+ * @method WebTwain#CapGet
+ * @return {boolean}
*/
- CloseSource(): boolean;
+ CapGet(): boolean;
/**
- * Closes and unloads Data Source Manager.
- * @method WebTwain#CloseSourceManager
- * @return {bool}
+ * Returns the Source's current Value for the specified capability.
+ * @method WebTwain#CapGetCurrent
+ * @return {boolean}
*/
- CloseSourceManager(): boolean;
+ CapGetCurrent(): boolean;
/**
- * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed.
- * @method WebTwain#DisableSource
- * @return {bool}
+ * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value.
+ * @method WebTwain#CapGetDefault
+ * @return {boolean}
*/
- DisableSource(): boolean;
+ CapGetDefault(): boolean;
/**
- * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE.
- * @method WebTwain#FeedPage
- * @return {bool}
+ * Returns the value of the bottom-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameBottom
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- FeedPage(): boolean;
+ CapGetFrameBottom(index: number): number;
/**
- * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc.
- * @method WebTwain#GetDeviceType
- * @return {int}
+ * Returns the value (in Unit) of the left-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameLeft
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- GetDeviceType(): number;
+ CapGetFrameLeft(index: number): number;
/**
- * Get the source name according to the source index.
- * @method WebTwain#GetSourceNameItems
- * @param {short} index int index. Index is 0-based and can not be greater than SourceCount property.
- * @return {string}
+ * Returns the value (in Unit) of the left-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameRight
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- GetSourceNameItems(index: number): string;
+ CapGetFrameRight(index: number): number;
/**
- * Loads the specified Source into main memory and causes its initialization,
- * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is
- * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source.
- * @method WebTwain#OpenSource
- * @return {bool}
+ * Returns the value (in Unit) of the top-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameTop
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- OpenSource(): boolean;
+ CapGetFrameTop(index: number): number;
+
+ /* ignored
+ * CapGetHelp
+ * CapGetLabel
+ * CapGetLabels
+ */
/**
- * Loads and opens Data Source Manager.
- * @method WebTwain#OpenSourceManager
- * @return {bool}
+ * Queries whether the Source supports a particular operation on the capability.
+ * @method WebTwain#CapIfSupported
+ * @param {EnumDWT_MessageType} messageType specifies the type of capability operation.
+ * @return {boolean}
*/
- OpenSourceManager(): boolean;
+ CapIfSupported(messageType: EnumDWT_MessageType): boolean;
/**
- * Reverts the current image layout to the Data Source's default.
- * @method WebTwain#ResetImageLayout
- * @return {bool}
+ * Changes the Current Value of the capability specified by Capability property back to its power-on value.
+ * @method WebTwain#CapReset
+ * @return {boolean}
*/
- ResetImageLayout(): boolean;
+ CapReset(): boolean;
/**
- * Sets the Source to return the current page to the input side of the document feeder and
- * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE.
- * @method WebTwain#RewindPage
- * @return {bool}
+ * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property.
+ * @method WebTwain#CapSet
+ * @return {boolean}
*/
- RewindPage(): boolean;
+ CapSet(): boolean;
/**
- * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI)
- * so that user can choose which Data Source to be the current Source.
- * @method WebTwain#SelectSource
- * @return {bool}
+ * Sets the values of the specified frame.
+ * @method WebTwain#CapSetFrame
+ * @param {number} index specifies the values of which frame to set. The index is 0-based.
+ * @param {number} left the value (in Unit) of the left-most edge of the specified frame.
+ * @param {number} top the value (in Unit) of the top-most edge of the specified frame.
+ * @param {number} right the value (in Unit) of the right-most edge of the specified frame.
+ * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame.
+ * @return {boolean}
*/
- SelectSource(): boolean;
+ CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean;
/**
- * Selects the index-the source in SourceNameItems property as the current source.
- * @method WebTwain#SelectSourceByIndex
- * @param {short} index It is the index of SourceNameItems property.
- * @return {bool}
+ * Changes the bitdepth of a specified image.
+ * @method WebTwain#ChangeBitDepth
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sBitDepth specifies the target bit depth.
+ * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time.
+ * @return {boolean}
*/
- SelectSourceByIndex(index: number): boolean;
+ ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean;
/**
- * Sets file name and file format information used in File Transfer Mode.
- * @method WebTwain#SetFileXferInfo
- * @param {string} fileName the name of the file to be used in transfer.
- * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image.
- * @return {bool}
+ * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately.
+ * @method WebTwain#ChangeImageSize
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} iNewWidth specifies the pixel width of the new image.
+ * @param {number} iNewHeight specifies the pixel height of the new image.
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
*/
- SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean;
-
- /**
- * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source.
- * @method WebTwain#SetImageLayout
- * @param {float} left specifies the floating point number for the left side of the image layout rectangle.
- * @param {float} top specifies the floating point number for the top side of the image layout rectangle.
- * @param {float} right specifies the floating point number for the right side of the image layout rectangle.
- * @param {float} bottom specifies the floating point number for the bottom side of the image layout rectangle.
- * @return {bool}
- */
- SetImageLayout(left: number, top: number, right: number, bottom: number): boolean;
+ ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean;
/**
* Clears all the web forms which are used for image uploading.
* @method WebTwain#ClearAllHTTPFormField
- * @return {bool}
+ * @return {boolean}
*/
ClearAllHTTPFormField(): boolean;
@@ -2232,12 +2409,154 @@ interface WebTwain {
ClearTiffCustomTag(): void;
/**
- * Check whether a certain file exists on the local disk.
- * @method WebTwain#FileExists
- * @param {string} localFile specifies the absolute path of the local file.
- * @return {bool}
+ * Closes Data Source.
+ * @method WebTwain#CloseSource
+ * @return {boolean}
*/
- FileExists(localFile: string): boolean;
+ CloseSource(): boolean;
+
+ /**
+ * Closes and unloads Data Source Manager.
+ * @method WebTwain#CloseSourceManager
+ * @return {boolean}
+ */
+ CloseSourceManager(): boolean;
+
+ /**
+ * Closes the current process used to scan
+ * @method WebTwain#CloseWorkingProcess
+ * @return {boolean}
+ */
+ CloseWorkingProcess(): boolean;
+
+ /**
+ * Converts the images specified by the indices to base64.
+ * @method WebTwain#ConvertToBase64
+ * @param {Array} indices indices specifies which images are to be converted to base64.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Converts the images specified by the indices to base64.
+ * @method WebTwain#ConvertToBase64
+ * @param {Array} indices indices specifies which images are to be converted to base64.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Changes a specified image to gray scale.
+ * @method WebTwain#ConvertToGrayScale
+ * @param {number} sIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ ConvertToGrayScale(sIndex: number): boolean;
+
+ /**
+ * Copies the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CopyToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ CopyToClipboard(sImageIndex: number): boolean;
+
+ /**
+ * Create the font for adding text using the method AddText.
+ * @method WebTwain#CreateTextFont
+ * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size.
+ * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference.
+ * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis.
+ * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up.
+ * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used.
+ * @param {number} italic Specifies an italic font if set to TRUE.
+ * @param {number} underline Specifies an underlined font if set to TRUE.
+ * @param {number} strikeOut A strikeout font if set to TRUE.
+ * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font.
+ * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch.
+ * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region.
+ * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font.
+ * @param {number} pitchAndFamily The pitch and family of the font.
+ * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character.
+ * @return {boolean}
+ */
+ CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean;
+
+ /**
+ * Crops the image of a specified index in buffer.
+ * @method WebTwain#Crop
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Crops the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CropToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Cuts the image data in the specified area to the system clipboard in DIB format.
+ * @method WebTwain#CutFrameToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Cuts the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CutToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ CutToClipboard(sImageIndex: number): boolean;
+
+ /**
+ * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed.
+ * @method WebTwain#DisableSource
+ * @return {boolean}
+ */
+ DisableSource(): boolean;
+
+ /**
+ * Enables the source to accept image.
+ * @method WebTwain#EnableSource
+ * @return {boolean}
+ */
+ EnableSource(): boolean;
+
+ /**
+ * Clears the specified area of a specified image, and fill the area with the fill color.
+ * @method WebTwain#Erase
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
/**
* Downloads an image from the FTP server.
@@ -2246,7 +2565,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2258,7 +2577,7 @@ interface WebTwain {
* @param {string} localFile specify a full path to store the file.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2270,7 +2589,7 @@ interface WebTwain {
* @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2278,11 +2597,11 @@ interface WebTwain {
* Uploads the image of a specified index in the buffer to the FTP server.
* @method WebTwain#FTPUpload
* @param {string} FTPServer the name of the FTP server.
- * @param {short} sImageIndex specifies the index of the image in the buffer. The index is 0-based.
+ * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based.
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2294,7 +2613,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2302,12 +2621,12 @@ interface WebTwain {
* Uploads the image of a specified index in the buffer to the FTP server as a specified image format.
* @method WebTwain#FTPUploadEx
* @param {string} FTPServer the name of the FTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2318,7 +2637,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2329,7 +2648,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2340,7 +2659,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2351,994 +2670,49 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
/**
- * Downloads an image from the HTTP server.
- * @method WebTwain#HTTPDownload
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE.
+ * @method WebTwain#FeedPage
+ * @return {boolean}
*/
- HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ FeedPage(): boolean;
/**
- * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPDownloadDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server.
- * @param {string} localFile specify the location to store the downloaded file.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Check whether a certain file exists on the local disk.
+ * @method WebTwain#FileExists
+ * @param {string} localFile specifies the absolute path of the local file.
+ * @return {boolean}
*/
- HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ FileExists(localFile: string): boolean;
/**
- * Downloads an image from the HTTP server.
- * @method WebTwain#HTTPDownloadEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Flips the image of a specified index in buffer.
+ * @method WebTwain#Flip
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
*/
- HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Download an image from the server using a HTTP Post call.
- * @method WebTwain#HTTPDownloadThroughPost
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method.
- * @method WebTwain#HTTPUploadThroughPost
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPUploadThroughPostDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} localFile specifies the path of a local file .
- * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the file to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method.
- * @method WebTwain#HTTPUploadThroughPostEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadAllThroughPostAsPDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPUploadThroughPutDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} localFile specifies the path of a local file.
- * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method.
- * @method WebTwain#HTTPUploadThroughPut
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method.
- * @method WebTwain#HTTPUploadThroughPutEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadAllThroughPutAsPDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Configures how segmented upload is done.
- * @method WebTwain#SetUploadSegment
- * @param {int} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked.
- * @param {int} moduleSize specifies the size of each segment (in KB).
- * @return {bool}
- */
- SetUploadSegment (segmentUploadThreshold: number, moduleSize: number): boolean;
-
- /**
- * Uploads the images specified by the indices to the HTTP server.
- * @method WebTwain#HTTPUpload
- * @param {string} url the url where the images are sent in a POST request.
- * @param {Array} indices indices specifies which images are to be uploaded.
- * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded.
- * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUpload (url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN.
- * @method WebTwain#LoadDibFromClipboard
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads an image into the Dynamic Web TWAIN.
- * @method WebTwain#LoadImage
- * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads an image into the Dynamic Web TWAIN.
- * @method WebTwain#LoadImageEx
- * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads image from a base64 byte array with the specified file format.
- * @method WebTwain#LoadImageFromBase64Binary
- * @param {string} bry specifies the base64 string data.
- * @param {EnumDWT_ImageType} lImageType specifies the file format.
- * @return {bool}
- */
- LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType): boolean;
-
- /**
- * [Deprecated.] Loads image from a byte array with the specified file format.
- * @method WebTwain#LoadImageFromBytes
- * @param {int} lBufferSize Specifies the buffer size.
- * @param {Array} buffer A byte array of the image data.
- * @param {EnumDWT_ImageType} lImageType Specifies the file format.
- * @return {bool}
- */
- LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean;
-
- /**
- * Saves all images in buffer as a MultiPage TIFF file.
- * @method WebTwain#SaveAllAsMultiPageTIFF
- * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves all images in buffer as a Multi-Page PDF file.
- * @method WebTwain#SaveAllAsPDF
- * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a BMP file.
- * @method WebTwain#SaveAsBMP
- * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsBMP(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a JPEG file.
- * @method WebTwain#SaveAsJPEG
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsJPEG(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a PDF file.
- * @method WebTwain#SaveAsPDF
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsPDF(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a PNG file.
- * @method WebTwain#SaveAsPNG
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsPNG(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a TIFF file.
- * @method WebTwain#SaveAsTIFF
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsTIFF(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the selected images in buffer as a Multipage PDF file.
- * @method WebTwain#SaveSelectedImagesAsMultiPagePDF
- * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the selected images in buffer as a Multipage TIFF file.
- * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF
- * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the selected images in buffer to base64 string.
- * @method WebTwain#SaveSelectedImagesToBase64Binary
- * @return {string}
- */
- SaveSelectedImagesToBase64Binary(): string;
-
- /**
- * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format.
- * @method WebTwain#SaveSelectedImagesToBytes
- * @param {int} bufferSize specified the buffer size.
- * @param {Array} buffer A byte array of the image data.
- * @return {int}
- */
- SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number;
-
- /**
- * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST.
- * @method WebTwain#SetCookie
- * @param {string} cookie the cookie on current page.
- * @return {void}
- */
- SetCookie(cookie: string): void;
-
- /**
- * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images.
- * @method WebTwain#SetHTTPFormField
- * @param {string} FieldName specifies the name of a text field in web form.
- * @param {string} FieldValue specifies the value of a text field in web form.
- * @return {bool}
- */
- SetHTTPFormField(FieldName: string, FieldValue: string): boolean;
-
- /**
- * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64.
- * @method WebTwain#SetTiffCustomTag
- * @param {int} tag specifies the tag identifier. The value should be between 600 and 700.
- * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it.
- * @param {bool} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text.
- * @return {bool}
- */
- SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean;
-
- /**
- * Show save file dialog or show open file dialog.
- * @method WebTwain#ShowFileDialog
- * @param {bool} SaveDialog True -- show save file dialog, False -- show open file dialog.
- * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically.
- * @param {int} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based.
- * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended.
- * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms.
- * @param {bool} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file.
- * @param {bool} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file.
- * @param {int} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless.
- * @return {bool}
- */
- ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean;
-
- /**
- * Gets information of the capability specified by the Capability property.
- * @method WebTwain#CapGet
- * @return {bool}
- */
- CapGet(): boolean;
-
- /**
- * Returns the Source's current Value for the specified capability.
- * @method WebTwain#CapGetCurrent
- * @return {bool}
- */
- CapGetCurrent(): boolean;
-
- /**
- * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value.
- * @method WebTwain#CapGetDefault
- * @return {bool}
- */
- CapGetDefault(): boolean;
-
- /**
- * Returns the value of the bottom-most edge of the specified frame.
- * @method WebTwain#CapGetFrameBottom
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameBottom(index: number): number;
-
- /**
- * Returns the value (in Unit) of the left-most edge of the specified frame.
- * @method WebTwain#CapGetFrameLeft
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameLeft(index: number): number;
-
- /**
- * Returns the value (in Unit) of the left-most edge of the specified frame.
- * @method WebTwain#CapGetFrameRight
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameRight(index: number): number;
-
- /**
- * Returns the value (in Unit) of the top-most edge of the specified frame.
- * @method WebTwain#CapGetFrameTop
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameTop(index: number): number;
-
- /**
- * Queries whether the Source supports a particular operation on the capability.
- * @method WebTwain#CapIfSupported
- * @param {EnumDWT_MessageType} messageType specifies the type of capability operation.
- * @return {bool}
- */
- CapIfSupported(messageType: EnumDWT_MessageType): boolean;
-
- /**
- * Changes the Current Value of the capability specified by Capability property back to its power-on value.
- * @method WebTwain#CapReset
- * @return {bool}
- */
- CapReset(): boolean;
-
- /**
- * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property.
- * @method WebTwain#CapSet
- * @return {bool}
- */
- CapSet(): boolean;
-
- /**
- * Sets the values of the specified frame.
- * @method WebTwain#CapSetFrame
- * @param {short} index specifies the values of which frame to set. The index is 0-based.
- * @param {float} left the value (in Unit) of the left-most edge of the specified frame.
- * @param {float} top the value (in Unit) of the top-most edge of the specified frame.
- * @param {float} right the value (in Unit) of the right-most edge of the specified frame.
- * @param {float} bottom the value (in Unit) of the bottom-most edge of the specified frame.
- * @return {bool}
- */
- CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean;
+ Flip(sImageIndex: number): boolean;
/**
* Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
* @method WebTwain#GetCapItems
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @return {double}
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @return {number}
*/
GetCapItems(index: number): number;
/**
* Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
* @method WebTwain#GetCapItemsString
- * @param {int} index Index is 0-based. It is the index of the cap item.
+ * @param {number} index Index is 0-based. It is the index of the cap item.
* @return {string}
*/
GetCapItemsString(index: number): string;
- /**
- * Set the value of the specified cap item.
- * @method WebTwain#SetCapItems
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @param {double} newVal The Double type of CapItems property is used to present Double, Single(float), Long, int and even boolean types. For string type, please use CapItemsstring property.
- * @return {void}
- */
- SetCapItems(index: number, newVal: number): void;
-
- /**
- * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
- * @method WebTwain#SetCapItemsString
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @param {string} newVal The new value to be set.
- * @return {void}
- */
- SetCapItemsString(index: number, newVal: string): void;
- // --- SCAN end --
-
- // --- View & Edit start --
-
- /**
- * Add text on an image.
- * @method WebTwain#AddText
- * @param {short} sImageIndex the index of the image that you want to add text to.
- * @param {int} x the x coordinate for the text.
- * @param {int} y the y coordinate for the text.
- * @param {string} text the content of the text that you want to add.
- * @param {int} txtColor the color for the text.
- * @param {int} backgroundColor the background color.
- * @param {float} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter.
- * @param {float} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1
- * @return {bool}
- */
- AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean;
-
- /**
- * Create the font for adding text using the method AddText.
- * @method WebTwain#CreateTextFont
- * @param {int} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size.
- * @param {int} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference.
- * @param {int} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis.
- * @param {int} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up.
- * @param {int} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used.
- * @param {short} italic Specifies an italic font if set to TRUE.
- * @param {short} underline Specifies an underlined font if set to TRUE.
- * @param {short} strikeOut A strikeout font if set to TRUE.
- * @param {short} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font.
- * @param {short} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch.
- * @param {short} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region.
- * @param {short} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font.
- * @param {short} pitchAndFamily The pitch and family of the font.
- * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character.
- * @return {bool}
- */
- CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean;
-
- /**
- * Copies the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CopyToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- CopyToClipboard(sImageIndex: number): boolean;
-
- /**
- * Clears the specified area of a specified image, and fill the area with the fill color.
- * @method WebTwain#Erase
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Returns the pixel bit depth of the selected image.
- * @method WebTwain#GetImageBitDepth
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {short}
- */
- GetImageBitDepth(sImageIndex: number): number;
-
- /**
- * Returns the width (pixels) of the selected image. This is a read-only property.
- * @method WebTwain#GetImageWidth
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {int}
- */
- GetImageWidth(sImageIndex: number): number;
-
- /**
- * Returns the height (pixels) of the selected image. This is a read-only property.
- * @method WebTwain#GetImageHeight
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {int}
- */
- GetImageHeight(sImageIndex: number): number;
-
- /**
- * Returns the file size of the new image resized from the image of a specified index in buffer.
- * @method WebTwain#GetImageSize
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} iWidth specifies the pixel width of the new image.
- * @param {int} iHeight specifies the pixel height of the new image.
- * @return {double}
- */
- GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number;
-
- /**
- * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer.
- * @method WebTwain#GetImageSizeWithSpecifiedType
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {short} sImageType specifies the type of an image file..
- * @return {int}
- */
- GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number;
-
- /**
- * Return the horizontal resolution of the specified image.
- * @method WebTwain#GetImageXResolution
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {int}
- */
- GetImageXResolution(sImageIndex: number): number;
-
- /**
- * Return the vertical resolution of the specified image.
- * @method WebTwain#GetImageYResolution
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {int}
- */
- GetImageYResolution(sImageIndex: number): number;
-
- /**
- * Returns the index of the selected image.
- * @method WebTwain#GetSelectedImageIndex
- * @param {short} sSelectedIndex specifies the index of the selected image.
- * @return {short}
- */
- GetSelectedImageIndex(sSelectedIndex: number): number;
-
- /**
- * You can use the method to select images programatically which is ususally done by mouse clicking.
- * @method WebTwain#SetSelectedImageIndex
- * @param {short} sSelectedIndex this is the index of an array that holds the indices of selected images.
- * @param {short} newVal specifies the index of an image that you want to select.
- * @return {void}
- */
- SetSelectedImageIndex(selectedIndex: number, newVal: number): void;
-
- /**
- * Pre-calculate the file size of the local image file that is saved from the selected images in buffer.
- * @method WebTwain#GetSelectedImagesSize
- * @param {int} iImageType specifies the type of an image file.
- * @return {int}
- */
- GetSelectedImagesSize(iImageType: number): number;
-
- /**
- * Check the skew angle of an image by its index in buffer.
- * @method WebTwain#GetSkewAngle
- * @param {short} sImageIndex the index of the image in the buffer.
- * @return {double}
- */
- GetSkewAngle(sImageIndex: number): number;
-
- /**
- * Check the skew angle of a rectangular part of an image by its index in buffer.
- * @method WebTwain#GetSkewAngleEx
- * @param {short} sImageIndex the index of the image in the buffer.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {double}
- */
- GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number;
-
- /**
- * [Deprecated.] Detects whether a certain area on an image is blank.
- * @method WebTwain#IsBlankImageEx
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @param {bool} bFuzzyMatch specifies whether use fuzzy matching when detecting.
- * @return {bool}
- */
- IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean;
-
- /**
- * Mirrors the image of a specified index in buffer.
- * @method WebTwain#Mirror
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- Mirror(sImageIndex: number): boolean;
-
- /**
- * Decorates image of a specified index in buffer with rectangles of transparent color.
- * @method WebTwain#OverlayRectangle
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @param {int} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red.
- * @param {float} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent.
- * @return {bool}
- */
- OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean;
-
- /**
- * Removes all images in buffer.
- * @method WebTwain#RemoveAllImages
- * @return {void}
- */
- RemoveAllImages(): void;
-
- /**
- * Removes selected images in buffer.
- * @method WebTwain#RemoveAllSelectedImages
- * @return {bool}
- */
- RemoveAllSelectedImages(): boolean;
-
- /**
- * Removes the image of a specified index in buffer.
- * @method WebTwain#RemoveImage
- * @param {short} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based.
- * @return {bool}
- */
- RemoveImage(sImageIndexToBeDeleted: number): boolean;
-
- // Image Operate
- /**
- * Rotates the image of a specified index in buffer by specified angle.
- * @method WebTwain#Rotate
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {float} fAngle Specifies the rotation angle.
- * @param {bool} bKeepSize Keep size or not.
- * @return {bool}
- */
- Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by specified angle.
- * @method WebTwain#RotateEx
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {float} fAngle Specifies the rotation angle.
- * @param {bool} bKeepSize Keep size or not.
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise.
- * @method WebTwain#RotateLeft
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- RotateLeft(sImageIndex: number): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by 90 degrees clockwise.
- * @method WebTwain#RotateRight
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- RotateRight(sImageIndex: number): boolean;
-
- /**
- * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately.
- * @method WebTwain#ChangeImageSize
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} iNewWidth specifies the pixel width of the new image.
- * @param {int} iNewHeight specifies the pixel height of the new image.
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Flips the image of a specified index in buffer.
- * @method WebTwain#Flip
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- Flip(sImageIndex: number): boolean;
-
- /**
- * Crops the image of a specified index in buffer.
- * @method WebTwain#Crop
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Crops the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CropToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Cuts the image data in the specified area to the system clipboard in DIB format.
- * @method WebTwain#CutFrameToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Cuts the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CutToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- CutToClipboard(sImageIndex: number): boolean;
-
- /**
- * Change the DPI (dots per inch) for the specified image.
- * @method WebTwain#SetDPI
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} xResolution The horizontal resolution.
- * @param {int} yResolution The vertical resolution.
- * @param {bool} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true).
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN.
- * @method WebTwain#SetViewMode
- * @param {short} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN.
- * @param {short} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN..
- * @return {void}
- */
- SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void;
-
- /**
- * Moves a specified image.
- * @method WebTwain#MoveImage
- * @param {short} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based.
- * @param {short} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean;
-
- /**
- * Switchs two images of specified indices in buffer.
- * @method WebTwain#SwitchImage
- * @param {short} sImageIndex1 specifies the index of image in buffer. The index is 0-based.
- * @param {short} sImageIndex2 specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean;
-
- /**
- * Shows the GUI of Image Printer.
- * @method WebTwain#Print
- * @return {bool}
- */
- Print(): boolean;
- // --- View & Edit end --
-
- // --- Upload & Save end --
-
- // --- Others ---
- /**
- * Shows the GUI of Image Editor.
- * @method WebTwain#ShowImageEditor
- * @return {bool}
- */
- ShowImageEditor(): boolean;
-
- /**
- * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires.
- * @method WebTwain#UnregisterEvent
- * @param {string} name the name of the event.
- * @param {object} evt specified the function to be unbound.
- * @return {bool}
- */
- UnregisterEvent(name: string, evt: object): boolean;
- // --- Others end ---
-
- /**
- * Enables the source to accept image.
- * @method WebTwain#EnableSource
- * @return {bool}
- */
- EnableSource(): boolean;
-
- /**
- * Displays the source's built-in interface to acquire image.
- * @method WebTwain#AcquireImage
- * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- // start from 10.0
- /**
- * Change the width of an image in buffer.
- * @method WebTwain#SetImageWidth
- * @param {short} sImageIndex specifies which image you'd like to change.
- * @param {int} iNewWidth specifies how wide you'd like to change the image.
- * @return {bool}
- */
- SetImageWidth(sImageIndex: number, iNewWidth: number): boolean;
-
- // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64
- /**
- * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile.
- * @method WebTwain#SetCustomDSDataEx
- * @param {string} value the input string which is encoded with base64.
- * @return {bool}
- */
- SetCustomDSDataEx(value: string): boolean;
-
- // Set custom DS data, load data from the specified file
- /**
- * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile.
- * @method WebTwain#SetCustomDSData
- * @param {string} fileName the absolute path of the file where the custom data source data is stored.
- * @return {bool}
- */
- SetCustomDSData(fileName: string): boolean;
-
// Get custom DS data, and returned string is encoded with base64
/**
* Gets custom DS data, the returned string is base64 encoded.
@@ -3352,120 +2726,962 @@ interface WebTwain {
* Gets custom DS data and save the data in a specified file.
* @method WebTwain#GetCustomDSData
* @param {string} fileName the path of the file used for storing custom DS data.
- * @return {bool}
+ * @return {boolean}
*/
GetCustomDSData(fileName: string): boolean;
/**
- * Changes the bitdepth of a specified image.
- * @method WebTwain#ChangeBitDepth
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {short} sBitDepth specifies the target bit depth.
- * @param {bool} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time.
- * @return {bool}
+ * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc.
+ * @method WebTwain#GetDeviceType
+ * @return {number}
*/
- ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean;
+ GetDeviceType(): number;
/**
- * Changes a specified image to gray scale.
- * @method WebTwain#ConvertToGrayScale
- * @param {short} sIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Returns the pixel bit depth of the selected image.
+ * @method WebTwain#GetImageBitDepth
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
*/
- ConvertToGrayScale(sIndex: number): boolean;
+ GetImageBitDepth(sImageIndex: number): number;
/**
- * [Deprecated.] Shows the GUI of Image Editor with custom settings.
- * @method WebTwain#ShowImageEditorEx
- * @param {int} x specifies the new position of the left top corner of the window.
- * @param {int} y specifies the new position of the left top corner of the window.
- * @param {int} cx specifies the width of the window.
- * @param {int} cy specifies the height of the window.
- * @param {int} nCmdShow specifices how the window should be shown.
- * @return {bool}
+ * Returns the height (pixels) of the selected image. This is a read-only property.
+ * @method WebTwain#GetImageHeight
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
*/
- ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean;
+ GetImageHeight(sImageIndex: number): number;
+
+ /*work on
+ GetImagePartURL
+ */
/**
- * [Deprecated.] Detects whether an image is blank.
- * @method WebTwain#IsBlankImage
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Returns the file size of the new image resized from the image of a specified index in buffer.
+ * @method WebTwain#GetImageSize
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} iWidth specifies the pixel width of the new image.
+ * @param {number} iHeight specifies the pixel height of the new image.
+ * @return {number}
*/
- IsBlankImage(sImageIndex: number): boolean;
+ GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number;
/**
- * Detects whether a specific image is blank.
- * @method WebTwain#IsBlankImageExpress
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer.
+ * @method WebTwain#GetImageSizeWithSpecifiedType
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageType specifies the type of an image file..
+ * @return {number}
*/
- IsBlankImageExpress(sImageIndex: number): boolean;
-
- /**
- * [Deprecated.] Detects whether a specific image is blank.
- * @method WebTwain#GetBarcodeInfo
- * @param {int} barcodeInfoType Defined in TWAIN Specification.
- * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based.
- * @return {object}
- */
- GetBarcodeInfo(barcodeInfoType: number, barcodeIndex: number): object;
-
- /**
- * [Deprecated.] Gets the content from a specified barcode.
- * @method WebTwain#GetBarcodeText
- * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based.
- * @return {bool}
- */
- GetBarcodeText(barcodeIndex: number): boolean;
-
- /**
- * Sets the default source to use. It's only valid when IfUseTWAINDSM is set to true.
- * @method WebTwain#SetDefaultSource
- * @param {short} sImageIndex specifies the index of the default source. The index is 0-based.
- * @return {bool}
- */
- SetDefaultSource(sImageIndex: number): boolean;
-
- /**
- * Draws a rectangle on the viewer which represents the selected area.
- * @method WebTwain#SetSelectedImageArea
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left The X axis of the left border.
- * @param {int} top The Y axis of the top border.
- * @param {int} right The X axis of the right border.
- * @param {int} bottom The Y axis of the bottom border.
- * @return {bool}
- */
- SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Converts the images specified by the indices to base64.
- * @method WebTwain#ConvertToBase64
- * @param {Array} indices indices specifies which images are to be converted to base64.
- * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number;
/**
* Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio.
* @method WebTwain#GetImageURL
- * @param {short} index the index of the image.
- * @param {int} iWidth the width of the image.
- * @param {int} iHeight the height of the image.
+ * @param {number} index the index of the image.
+ * @param {number} iWidth the width of the image.
+ * @param {number} iHeight the height of the image.
* @return {string}
*/
GetImageURL(index: number, iWidth: number, iHeight: number): string;
+ /**
+ * Returns the width (pixels) of the selected image. This is a read-only property.
+ * @method WebTwain#GetImageWidth
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
+ */
+ GetImageWidth(sImageIndex: number): number;
+
+ /**
+ * Return the horizontal resolution of the specified image.
+ * @method WebTwain#GetImageXResolution
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {number}
+ */
+ GetImageXResolution(sImageIndex: number): number;
+
+ /**
+ * Return the vertical resolution of the specified image.
+ * @method WebTwain#GetImageYResolution
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {number}
+ */
+ GetImageYResolution(sImageIndex: number): number;
+
+ /**
+ * Return the runtime license info.
+ * @method WebTwain#GetLicenseInfo
+ */
+ GetLicenseInfo(): { Domain: string, Detail: any[] };
+
+ /**
+ * Returns the index of the selected image.
+ * @method WebTwain#GetSelectedImageIndex
+ * @param {number} sSelectedIndex specifies the index of the selected image.
+ * @return {number}
+ */
+ GetSelectedImageIndex(sSelectedIndex: number): number;
+
+ /**
+ * Pre-calculate the file size of the local image file that is saved from the selected images in buffer.
+ * @method WebTwain#GetSelectedImagesSize
+ * @param {number} iImageType specifies the type of an image file.
+ * @return {number}
+ */
+ GetSelectedImagesSize(iImageType: number): number;
+
+ /**
+ * Check the skew angle of an image by its index in buffer.
+ * @method WebTwain#GetSkewAngle
+ * @param {number} sImageIndex the index of the image in the buffer.
+ * @return {number}
+ */
+ GetSkewAngle(sImageIndex: number): number;
+
+ /**
+ * Check the skew angle of a rectangular part of an image by its index in buffer.
+ * @method WebTwain#GetSkewAngleEx
+ * @param {number} sImageIndex the index of the image in the buffer.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {number}
+ */
+ GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number;
+
+ /**
+ * Get the source name according to the source index.
+ * @method WebTwain#GetSourceNameItems
+ * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property.
+ * @return {string}
+ */
+ GetSourceNameItems(index: number): string;
+
+ /*ignored
+ GetSourceNames
+ GetSourceType
+ GetVersionInfoAsync
+ */
+
+ /**
+ * Downloads an image from the HTTP server.
+ * @method WebTwain#HTTPDownload
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPDownloadDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server.
+ * @param {string} localFile specify the location to store the downloaded file.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Downloads an image from the HTTP server.
+ * @method WebTwain#HTTPDownloadEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ HTTPDownloadStreamThroughPost
+ HTTPDownloadThroughGet
+ */
+
+ /**
+ * Download an image from the server using a HTTP Post call.
+ * @method WebTwain#HTTPDownloadThroughPost
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the images specified by the indices to the HTTP server.
+ * @method WebTwain#HTTPUpload
+ * @param {string} url the url where the images are sent in a POST request.
+ * @param {Array} indices indices specifies which images are to be uploaded.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded.
+ * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadAllThroughPostAsPDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadAllThroughPutAsPDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ HTTPUploadStreamThroughPost
+ */
+
+ /**
+ * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method.
+ * @method WebTwain#HTTPUploadThroughPost
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPUploadThroughPostDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} localFile specifies the path of a local file .
+ * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the file to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method.
+ * @method WebTwain#HTTPUploadThroughPostEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method.
+ * @method WebTwain#HTTPUploadThroughPut
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPUploadThroughPutDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} localFile specifies the path of a local file.
+ * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method.
+ * @method WebTwain#HTTPUploadThroughPutEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Detects whether an image is blank.
+ * @method WebTwain#IsBlankImage
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ IsBlankImage(sImageIndex: number): boolean;
+
+ /**
+ * [Deprecated.] Detects whether a certain area on an image is blank.
+ * @method WebTwain#IsBlankImageEx
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @param {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting.
+ * @return {boolean}
+ */
+ IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean;
+
+ /**
+ * Detects whether a specific image is blank.
+ * @method WebTwain#IsBlankImageExpress
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ IsBlankImageExpress(sImageIndex: number): boolean;
+
+ /**
+ * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadDibFromClipboard
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads an image into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadImage
+ * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads an image into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadImageEx
+ * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads image from a base64 byte array with the specified file format.
+ * @method WebTwain#LoadImageFromBase64Binary
+ * @param {string} bry specifies the base64 string data.
+ * @param {EnumDWT_ImageType} lImageType specifies the file format.
+ * @return {boolean}
+ */
+ LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Loads image from a byte array with the specified file format.
+ * @method WebTwain#LoadImageFromBytes
+ * @param {number} lBufferSize Specifies the buffer size.
+ * @param {Array} buffer A byte array of the image data.
+ * @param {EnumDWT_ImageType} lImageType Specifies the file format.
+ * @return {boolean}
+ */
+ LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean;
+
+ /**
+ * Mirrors the image of a specified index in buffer.
+ * @method WebTwain#Mirror
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ Mirror(sImageIndex: number): boolean;
+
+ /**
+ * Moves a specified image.
+ * @method WebTwain#MoveImage
+ * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based.
+ * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean;
+
+ /*ignored
+ OnRefreshUI
+ */
+
+ /**
+ * Loads the specified Source into main memory and causes its initialization,
+ * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is
+ * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source.
+ * @method WebTwain#OpenSource
+ * @return {boolean}
+ */
+ OpenSource(): boolean;
+
+ /**
+ * Loads and opens Data Source Manager.
+ * @method WebTwain#OpenSourceManager
+ * @return {boolean}
+ */
+ OpenSourceManager(): boolean;
+
+ /**
+ * Decorates image of a specified index in buffer with rectangles of transparent color.
+ * @method WebTwain#OverlayRectangle
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @param {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red.
+ * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent.
+ * @return {boolean}
+ */
+ OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean;
+
+ /**
+ * Shows the GUI of Image Printer.
+ * @method WebTwain#Print
+ * @return {boolean}
+ */
+ Print(): boolean;
+
+ /**
+ * Binds a specified function to an event, so that the function gets called whenever the event fires.
+ * @method WebTwain#RegisterEvent
+ * @param {string} name the name of the event that the function is bound to.
+ * @param {object} evt specifies the function to call when event fires.
+ * @return {boolean}
+ */
+ RegisterEvent(name: string, evt: object): boolean;
+
+ /**
+ * Removes all images in buffer.
+ * @method WebTwain#RemoveAllImages
+ * @return {void}
+ */
+ RemoveAllImages(): void;
+
+ /**
+ * Removes selected images in buffer.
+ * @method WebTwain#RemoveAllSelectedImages
+ * @return {boolean}
+ */
+ RemoveAllSelectedImages(): boolean;
+
+ /**
+ * Removes the image of a specified index in buffer.
+ * @method WebTwain#RemoveImage
+ * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RemoveImage(sImageIndexToBeDeleted: number): boolean;
+
+ /**
+ * Reverts the current image layout to the Data Source's default.
+ * @method WebTwain#ResetImageLayout
+ * @return {boolean}
+ */
+ ResetImageLayout(): boolean;
+
+ /**
+ * Sets the Source to return the current page to the input side of the document feeder and
+ * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE.
+ * @method WebTwain#RewindPage
+ * @return {boolean}
+ */
+ RewindPage(): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by specified angle.
+ * @method WebTwain#Rotate
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} fAngle Specifies the rotation angle.
+ * @param {boolean} bKeepSize Keep size or not.
+ * @return {boolean}
+ */
+ Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by specified angle.
+ * @method WebTwain#RotateEx
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} fAngle Specifies the rotation angle.
+ * @param {boolean} bKeepSize Keep size or not.
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
+ */
+ RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise.
+ * @method WebTwain#RotateLeft
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RotateLeft(sImageIndex: number): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by 90 degrees clockwise.
+ * @method WebTwain#RotateRight
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RotateRight(sImageIndex: number): boolean;
+
+ /**
+ * Saves all images in buffer as a MultiPage TIFF file.
+ * @method WebTwain#SaveAllAsMultiPageTIFF
+ * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves all images in buffer as a Multi-Page PDF file.
+ * @method WebTwain#SaveAllAsPDF
+ * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a BMP file.
+ * @method WebTwain#SaveAsBMP
+ * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ SaveAsGIF
+ */
+
+ /**
+ * Saves the image of a specified index in buffer as a JPEG file.
+ * @method WebTwain#SaveAsJPEG
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a PDF file.
+ * @method WebTwain#SaveAsPDF
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a PNG file.
+ * @method WebTwain#SaveAsPNG
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a TIFF file.
+ * @method WebTwain#SaveAsTIFF
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer as a Multipage PDF file.
+ * @method WebTwain#SaveSelectedImagesAsMultiPagePDF
+ * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer as a Multipage TIFF file.
+ * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF
+ * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer to base64 string.
+ * @method WebTwain#SaveSelectedImagesToBase64Binary
+ * @return {string|bool}
+ */
+ SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean;
+
+ /**
+ * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format.
+ * @method WebTwain#SaveSelectedImagesToBytes
+ * @param {number} bufferSize specified the buffer size.
+ * @param {Array} buffer A byte array of the image data.
+ * @return {number}
+ */
+ SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number;
+
+ /**
+ * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI)
+ * so that user can choose which Data Source to be the current Source.
+ * @method WebTwain#SelectSource
+ * @return {boolean}
+ */
+ SelectSource(): boolean;
+
+ /**
+ * Selects the index-the source in SourceNameItems property as the current source.
+ * @method WebTwain#SelectSourceByIndex
+ * @param {number} index It is the index of SourceNameItems property.
+ * @return {boolean}
+ */
+ SelectSourceByIndex(index: number): boolean;
+
+ /*ignored
+ SetCancel
+ */
+
+ /**
+ * Set the value of the specified cap item.
+ * @method WebTwain#SetCapItems
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @param {number} newVal For string type, please use CapItemsstring property.
+ * @return {void}
+ */
+ SetCapItems(index: number, newVal: number): void;
+
+ /**
+ * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
+ * @method WebTwain#SetCapItemsString
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @param {string} newVal The new value to be set.
+ * @return {void}
+ */
+ SetCapItemsString(index: number, newVal: string): void;
+
+ /**
+ * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST.
+ * @method WebTwain#SetCookie
+ * @param {string} cookie the cookie on current page.
+ * @return {void}
+ */
+ SetCookie(cookie: string): void;
+
+ // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64
+ /**
+ * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile.
+ * @method WebTwain#SetCustomDSDataEx
+ * @param {string} value the input string which is encoded with base64.
+ * @return {boolean}
+ */
+ SetCustomDSDataEx(value: string): boolean;
+
+ // Set custom DS data, load data from the specified file
+ /**
+ * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile.
+ * @method WebTwain#SetCustomDSData
+ * @param {string} fileName the absolute path of the file where the custom data source data is stored.
+ * @return {boolean}
+ */
+ SetCustomDSData(fileName: string): boolean;
+
+ /**
+ * Change the DPI (dots per inch) for the specified image.
+ * @method WebTwain#SetDPI
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} xResolution The horizontal resolution.
+ * @param {number} yResolution The vertical resolution.
+ * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true).
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
+ */
+ SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
+
+ /**
+ * Sets file name and file format information used in File Transfer Mode.
+ * @method WebTwain#SetFileXferInfo
+ * @param {string} fileName the name of the file to be used in transfer.
+ * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image.
+ * @return {boolean}
+ */
+ SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean;
+
+ /**
+ * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images.
+ * @method WebTwain#SetHTTPFormField
+ * @param {string} FieldName specifies the name of a text field in web form.
+ * @param {string} FieldValue specifies the value of a text field in web form.
+ * @return {boolean}
+ */
+ SetHTTPFormField(FieldName: string, FieldValue: string): boolean;
+
/**
* Sets a header for the current HTTP Post request.
* @method WebTwain#SetHTTPHeader
* @param {string} key the key of the header.
* @param {string} value the value of the header.
- * @return {bool}
+ * @return {boolean}
*/
SetHTTPHeader(key: string, value: string): boolean;
+
+ /**
+ * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source.
+ * @method WebTwain#SetImageLayout
+ * @param {number} left specifies the floating point number for the left side of the image layout rectangle.
+ * @param {number} top specifies the floating point number for the top side of the image layout rectangle.
+ * @param {number} right specifies the floating point number for the right side of the image layout rectangle.
+ * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle.
+ * @return {boolean}
+ */
+ SetImageLayout(left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Change the width of an image in buffer.
+ * @method WebTwain#SetImageWidth
+ * @param {number} sImageIndex specifies which image you'd like to change.
+ * @param {number} iNewWidth specifies how wide you'd like to change the image.
+ * @return {boolean}
+ */
+ SetImageWidth(sImageIndex: number, iNewWidth: number): boolean;
+
+ /**
+ * Set the language for the authorization dialogs.
+ * @method WebTwain#SetLanguage
+ * @param {EnumDWT_Language} language specify the language
+ * @return {boolean}
+ */
+ SetLanguage(language: EnumDWT_Language): boolean;
+
+ /**
+ * Sets the time-out used to open a specified Data Source.
+ * @method WebTwain#SetOpenSourceTimeout
+ * @param {number} iMilliseconds specifies the number of milliseconds.
+ * @return {boolean}
+ */
+ SetOpenSourceTimeout(iMilliseconds: number): boolean;
+
+ /**
+ * Draws a rectangle on the viewer which represents the selected area.
+ * @method WebTwain#SetSelectedImageArea
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left The X axis of the left border.
+ * @param {number} top The Y axis of the top border.
+ * @param {number} right The X axis of the right border.
+ * @param {number} bottom The Y axis of the bottom border.
+ * @return {boolean}
+ */
+ SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * You can use the method to select images programatically which is ususally done by mouse clicking.
+ * @method WebTwain#SetSelectedImageIndex
+ * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images.
+ * @param {number} newVal specifies the index of an image that you want to select.
+ * @return {void}
+ */
+ SetSelectedImageIndex(selectedIndex: number, newVal: number): void;
+
+ /**
+ * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64.
+ * @method WebTwain#SetTiffCustomTag
+ * @param {number} tag specifies the tag identifier. The value should be between 600 and 700.
+ * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it.
+ * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text.
+ * @return {boolean}
+ */
+ SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean;
+
+ /**
+ * Configures how segmented upload is done.
+ * @method WebTwain#SetUploadSegment
+ * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked.
+ * @param {number} moduleSize specifies the size of each segment (in KB).
+ * @return {boolean}
+ */
+ SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean;
+
+ /**
+ * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN.
+ * @method WebTwain#SetViewMode
+ * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN.
+ * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN..
+ * @return {void}
+ */
+ SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void;
+
+ /**
+ * Show save file dialog or show open file dialog.
+ * @method WebTwain#ShowFileDialog
+ * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog.
+ * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically.
+ * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based.
+ * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended.
+ * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms.
+ * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file.
+ * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file.
+ * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless.
+ * @return {boolean}
+ */
+ ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean;
+
+ /**
+ * Shows the GUI of Image Editor.
+ * @method WebTwain#ShowImageEditor
+ * @return {boolean}
+ */
+ ShowImageEditor(): boolean;
+
+ /**
+ * [Deprecated.] Shows the GUI of Image Editor with custom settings.
+ * @method WebTwain#ShowImageEditorEx
+ * @param {number} x specifies the new position of the left top corner of the window.
+ * @param {number} y specifies the new position of the left top corner of the window.
+ * @param {number} cx specifies the width of the window.
+ * @param {number} cy specifies the height of the window.
+ * @param {number} nCmdShow specifices how the window should be shown.
+ * @return {boolean}
+ */
+ ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean;
+
+ /*ingored
+ SourceNameItems
+ */
+
+ /**
+ * Switchs two images of specified indices in buffer.
+ * @method WebTwain#SwitchImage
+ * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean;
+
+ /**
+ * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires.
+ * @method WebTwain#UnregisterEvent
+ * @param {string} name the name of the event.
+ * @param {object} evt specified the function to be unbound.
+ * @return {boolean}
+ */
+ UnregisterEvent(name: string, evt: object): boolean;
+
+ /*ignored
+ checkErrorString
+ first
+ getInstance
+ last
+ next
+ on
+ onEvent
+ previous
+
+ ...other internal ones
+ */
}
diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts
index 116f17c3fa..abcc6be5b9 100644
--- a/types/graphql/error/GraphQLError.d.ts
+++ b/types/graphql/error/GraphQLError.d.ts
@@ -56,6 +56,11 @@ export class GraphQLError extends Error {
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
+
+ /**
+ * Extension fields to add to the formatted error.
+ */
+ extensions?: { [key: string]: any } | undefined;
constructor(
message: string,
@@ -64,5 +69,6 @@ export class GraphQLError extends Error {
positions?: number[],
path?: Array,
originalError?: Error,
+ extensions?: { [key: string]: any },
);
}
diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts
index c0ab376ae5..3dc26955e6 100644
--- a/types/jest/index.d.ts
+++ b/types/jest/index.d.ts
@@ -11,6 +11,7 @@
// Jamie Mason
// Douglas Duteil
// Ahn
+// Josh Goldberg
// Bradley Ayers
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -202,6 +203,10 @@ declare namespace jest {
type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any;
+ interface FunctionLike {
+ readonly name: string;
+ }
+
/**
* Creates a test closure
*/
@@ -223,7 +228,8 @@ declare namespace jest {
}
interface Describe {
- (name: string, fn: EmptyFunction): void;
+ // tslint:disable-next-line ban-types
+ (name: number | string | Function | FunctionLike, fn: EmptyFunction): void;
only: Describe;
skip: Describe;
}
diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts
index cc73b0b054..786dccb641 100644
--- a/types/jest/jest-tests.ts
+++ b/types/jest/jest-tests.ts
@@ -10,6 +10,10 @@ declare const $: any;
// Tests based on the Jest website
jest.unmock('../sum');
+class TestClass { }
+
+describe(TestClass, () => { });
+
describe('sum', () => {
it('adds 1 + 2 to equal 3', () => {
const sum: (a: number, b: number) => number = require('../sum');
diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts
index 6e2b7be6c7..2b6d264b3e 100644
--- a/types/joi/index.d.ts
+++ b/types/joi/index.d.ts
@@ -165,6 +165,11 @@ export interface IPOptions {
cidr?: string
}
+export interface StringRegexOptions {
+ name?: string;
+ invert?: boolean;
+}
+
export interface JoiObject {
isJoi: boolean;
}
@@ -552,9 +557,13 @@ export interface StringSchema extends AnySchema {
/**
* Defines a regular expression rule.
* @param pattern - a regular expression object the string value must match against.
- * @param name - optional name for patterns (useful with multiple patterns). Defaults to 'required'.
+ * @param options - optional, can be:
+ * Name for patterns (useful with multiple patterns). Defaults to 'required'.
+ * An optional configuration object with the following supported properties:
+ * name - optional pattern name.
+ * invert - optional boolean flag. Defaults to false behavior. If specified as true, the provided pattern will be disallowed instead of required.
*/
- regex(pattern: RegExp, name?: string): this;
+ regex(pattern: RegExp, options?: string | StringRegexOptions): this;
/**
* Replace characters matching the given pattern with the specified replacement string where:
diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts
index 3ee7c45b66..1ab3316eb8 100644
--- a/types/joi/joi-tests.ts
+++ b/types/joi/joi-tests.ts
@@ -135,6 +135,13 @@ refOpts = { contextPrefix: str };
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
+let stringRegexOpts: Joi.StringRegexOptions = null;
+
+stringRegexOpts = { name: str };
+stringRegexOpts = { invert: bool };
+
+// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
+
let validErr: Joi.ValidationError = null;
let validErrItem: Joi.ValidationErrorItem;
let validErrFunc: Joi.ValidationErrorFunction;
@@ -764,6 +771,7 @@ strSchema = strSchema.length(ref);
strSchema = strSchema.length(ref, str);
strSchema = strSchema.regex(exp);
strSchema = strSchema.regex(exp, str);
+strSchema = strSchema.regex(exp, stringRegexOpts);
strSchema = strSchema.replace(exp, str);
strSchema = strSchema.replace(str, str);
strSchema = strSchema.alphanum();
diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts
index 9c793a2c19..c13cd7f26f 100644
--- a/types/jquery.fancytree/index.d.ts
+++ b/types/jquery.fancytree/index.d.ts
@@ -236,7 +236,7 @@ declare namespace Fancytree {
/** Outer element of single nodes */
span: HTMLElement;
/** Outer element of single nodes for table extension */
- tr: HTMLElement;
+ tr: HTMLTableRowElement;
//#endregion
//#region Methods
diff --git a/types/mysql/index.d.ts b/types/mysql/index.d.ts
index 1e827a7d37..555fc703bf 100644
--- a/types/mysql/index.d.ts
+++ b/types/mysql/index.d.ts
@@ -3,6 +3,7 @@
// Definitions by: William Johnston
// Kacper Polak
// Krittanan Pingclasai
+// James Munro
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -240,6 +241,11 @@ export interface QueryOptions {
*/
sql: string;
+ /**
+ * Values for template query
+ */
+ values?: any;
+
/**
* Every operation takes an optional inactivity timeout option. This allows you to specify appropriate timeouts for
* operations. It is important to note that these timeouts are not part of the MySQL protocol, and rather timeout
diff --git a/types/mysql/mysql-tests.ts b/types/mysql/mysql-tests.ts
index a3ddb27248..480e7e0275 100644
--- a/types/mysql/mysql-tests.ts
+++ b/types/mysql/mysql-tests.ts
@@ -423,6 +423,9 @@ connection.query({
}
});
+connection.query({sql: '...', values: ['test']}, (err: Error, results: any) => {
+});
+
connection = mysql.createConnection("mysql://localhost/test?flags=-FOUND_ROWS");
connection = mysql.createConnection({debug: true});
connection = mysql.createConnection({debug: ['ComQueryPacket', 'RowDataPacket']});
diff --git a/types/node/index.d.ts b/types/node/index.d.ts
index b2e310cffa..0994982b41 100644
--- a/types/node/index.d.ts
+++ b/types/node/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Node.js 9.4.x
+// Type definitions for Node.js 9.6.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript
// DefinitelyTyped
@@ -19,6 +19,7 @@
// Alberto Schiabel
// Klaus Meinhardt
// Huw
+// Nicolas Even
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -1768,6 +1769,7 @@ declare module "https" {
export class Agent extends http.Agent {
constructor(options?: AgentOptions);
+ options: AgentOptions;
}
export class Server extends tls.Server {
@@ -5575,18 +5577,18 @@ declare module "util" {
export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
export function promisify(fn: CustomPromisify): TCustom;
- export function promisify(fn: (callback: (err: Error, result: TResult) => void) => void): () => Promise;
- export function promisify(fn: (callback: (err: Error) => void) => void): () => Promise;
- export function promisify(fn: (arg1: T1, callback: (err: Error, result: TResult) => void) => void): (arg1: T1) => Promise;
- export function promisify(fn: (arg1: T1, callback: (err: Error) => void) => void): (arg1: T1) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
+ export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise;
+ export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise;
+ export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise;
+ export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
export function promisify(fn: Function): Function;
export namespace promisify {
const custom: symbol;
@@ -6080,6 +6082,23 @@ declare module "async_hooks" {
*/
export function createHook(options: HookCallbacks): AsyncHook;
+ export interface AsyncResourceOptions {
+ /**
+ * The ID of the execution context that created this async event.
+ * Default: `executionAsyncId()`
+ */
+ triggerAsyncId?: number;
+
+ /**
+ * Disables automatic `emitDestroy` when the object is garbage collected.
+ * This usually does not need to be set (even if `emitDestroy` is called
+ * manually), unless the resource's `asyncId` is retrieved and the
+ * sensitive API's `emitDestroy` is called with it.
+ * Default: `false`
+ */
+ requireManualDestroy?: boolean;
+ }
+
/**
* The class AsyncResource was designed to be extended by the embedder's async resources.
* Using this users can easily trigger the lifetime events of their own resources.
@@ -6089,21 +6108,38 @@ declare module "async_hooks" {
* AsyncResource() is meant to be extended. Instantiating a
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* async_hook.executionAsyncId() is used.
- * @param type the name of this async resource type
- * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
+ * @param type The type of async event.
+ * @param triggerAsyncId The ID of the execution context that created
+ * this async event (default: `executionAsyncId()`), or an
+ * AsyncResourceOptions object (since 9.3)
*/
- constructor(type: string, triggerAsyncId?: number)
+ constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
/**
* Call AsyncHooks before callbacks.
+ * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
*/
emitBefore(): void;
/**
- * Call AsyncHooks after callbacks
+ * Call AsyncHooks after callbacks.
+ * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
*/
emitAfter(): void;
+ /**
+ * Call the provided function with the provided arguments in the
+ * execution context of the async resource. This will establish the
+ * context, trigger the AsyncHooks before callbacks, call the function,
+ * trigger the AsyncHooks after callbacks, and then restore the original
+ * execution context.
+ * @param fn The function to call in the execution context of this
+ * async resource.
+ * @param thisArg The receiver to be used for the function call.
+ * @param args Optional arguments to pass to the function.
+ */
+ runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
+
/**
* Call AsyncHooks destroy callbacks.
*/
diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts
index 1eb6539b09..08dbb68b8a 100644
--- a/types/node/node-tests.ts
+++ b/types/node/node-tests.ts
@@ -1497,6 +1497,8 @@ namespace https_tests {
https.request('http://www.example.com/xyz');
+ https.globalAgent.options.ca = [];
+
{
const server = new https.Server();
@@ -3333,13 +3335,23 @@ namespace async_hooks_tests {
const tId: number = this.triggerAsyncId();
}
run() {
- this.emitBefore();
- this.emitAfter();
+ this.runInAsyncScope(() => {});
+ this.runInAsyncScope(Array.prototype.find, [], () => true);
}
destroy() {
this.emitDestroy();
}
}
+
+ // check AsyncResource constructor options.
+ new async_hooks.AsyncResource('');
+ new async_hooks.AsyncResource('', 0);
+ new async_hooks.AsyncResource('', {});
+ new async_hooks.AsyncResource('', { triggerAsyncId: 0 });
+ new async_hooks.AsyncResource('', {
+ triggerAsyncId: 0,
+ requireManualDestroy: true
+ });
}
////////////////////////////////////////////////////
diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts
index 09cbd8bb43..16e54d002d 100644
--- a/types/node/v4/index.d.ts
+++ b/types/node/v4/index.d.ts
@@ -1081,7 +1081,9 @@ declare module "https" {
secureProtocol?: string;
}
- export interface Agent extends http.Agent { }
+ export interface Agent extends http.Agent {
+ options?: AgentOptions;
+ }
export interface AgentOptions extends http.AgentOptions {
pfx?: any;
diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts
index e60b578ccf..2b3be03f8d 100644
--- a/types/node/v4/node-tests.ts
+++ b/types/node/v4/node-tests.ts
@@ -561,6 +561,8 @@ namespace https_tests {
});
https.request('http://www.example.com/xyz');
+
+ https.globalAgent.options.ca = [];
}
////////////////////////////////////////////////////
diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts
index 152507c3a8..3ca66a2df5 100644
--- a/types/node/v6/index.d.ts
+++ b/types/node/v6/index.d.ts
@@ -1468,7 +1468,9 @@ declare module "https" {
secureProtocol?: string;
}
- export interface Agent extends http.Agent { }
+ export interface Agent extends http.Agent {
+ options?: AgentOptions;
+ }
export interface AgentOptions extends http.AgentOptions {
pfx?: any;
diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts
index cd363c708c..6cfb45692b 100644
--- a/types/node/v6/node-tests.ts
+++ b/types/node/v6/node-tests.ts
@@ -1015,6 +1015,8 @@ namespace https_tests {
});
https.request('http://www.example.com/xyz');
+
+ https.globalAgent.options.ca = [];
}
////////////////////////////////////////////////////
diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts
index bdcb47d2e1..748f932d80 100644
--- a/types/node/v7/index.d.ts
+++ b/types/node/v7/index.d.ts
@@ -1528,7 +1528,9 @@ declare module "https" {
secureProtocol?: string;
}
- export interface Agent extends http.Agent { }
+ export interface Agent extends http.Agent {
+ options?: AgentOptions;
+ }
export interface AgentOptions extends http.AgentOptions {
pfx?: any;
diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts
index 0240dcc120..eb25e01f10 100644
--- a/types/node/v7/node-tests.ts
+++ b/types/node/v7/node-tests.ts
@@ -1093,6 +1093,8 @@ namespace https_tests {
});
https.request('http://www.example.com/xyz');
+
+ https.globalAgent.options.ca = [];
}
////////////////////////////////////////////////////
diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts
index f28c0959a4..1697093de7 100644
--- a/types/node/v8/index.d.ts
+++ b/types/node/v8/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Node.js 8.9.x
+// Type definitions for Node.js 8.10.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript
// DefinitelyTyped
@@ -18,6 +18,7 @@
// Hannes Magnusson
// Alberto Schiabel
// Huw
+// Nicolas Even
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -1757,6 +1758,7 @@ declare module "https" {
export class Agent extends http.Agent {
constructor(options?: AgentOptions);
+ options: AgentOptions;
}
export class Server extends tls.Server {
@@ -5545,18 +5547,18 @@ declare module "util" {
export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
export function promisify(fn: CustomPromisify): TCustom;
- export function promisify(fn: (callback: (err: Error, result: TResult) => void) => void): () => Promise;
- export function promisify(fn: (callback: (err: Error) => void) => void): () => Promise;
- export function promisify(fn: (arg1: T1, callback: (err: Error, result: TResult) => void) => void): (arg1: T1) => Promise;
- export function promisify(fn: (arg1: T1, callback: (err: Error) => void) => void): (arg1: T1) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
- export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
+ export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise;
+ export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise;
+ export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise;
+ export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
+ export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise;
export function promisify(fn: Function): Function;
export namespace promisify {
const custom: symbol;
@@ -6052,6 +6054,23 @@ declare module "async_hooks" {
*/
export function createHook(options: HookCallbacks): AsyncHook;
+ export interface AsyncResourceOptions {
+ /**
+ * The ID of the execution context that created this async event.
+ * Default: `executionAsyncId()`
+ */
+ triggerAsyncId?: number;
+
+ /**
+ * Disables automatic `emitDestroy` when the object is garbage collected.
+ * This usually does not need to be set (even if `emitDestroy` is called
+ * manually), unless the resource's `asyncId` is retrieved and the
+ * sensitive API's `emitDestroy` is called with it.
+ * Default: `false`
+ */
+ requireManualDestroy?: boolean;
+ }
+
/**
* The class AsyncResource was designed to be extended by the embedder's async resources.
* Using this users can easily trigger the lifetime events of their own resources.
@@ -6061,10 +6080,12 @@ declare module "async_hooks" {
* AsyncResource() is meant to be extended. Instantiating a
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* async_hook.executionAsyncId() is used.
- * @param type the name of this async resource type
- * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
+ * @param type The type of async event.
+ * @param triggerAsyncId The ID of the execution context that created
+ * this async event (default: `executionAsyncId()`), or an
+ * AsyncResourceOptions object (since 8.10)
*/
- constructor(type: string, triggerAsyncId?: number)
+ constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
/**
* Call AsyncHooks before callbacks.
diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts
index 74d4c5c222..b63d494fbd 100644
--- a/types/node/v8/node-tests.ts
+++ b/types/node/v8/node-tests.ts
@@ -1471,6 +1471,8 @@ namespace https_tests {
https.request('http://www.example.com/xyz');
+ https.globalAgent.options.ca = [];
+
{
const server = new https.Server();
@@ -3304,6 +3306,16 @@ namespace async_hooks_tests {
this.emitDestroy();
}
}
+
+ // check AsyncResource constructor options.
+ new async_hooks.AsyncResource('');
+ new async_hooks.AsyncResource('', 0);
+ new async_hooks.AsyncResource('', {});
+ new async_hooks.AsyncResource('', { triggerAsyncId: 0 });
+ new async_hooks.AsyncResource('', {
+ triggerAsyncId: 0,
+ requireManualDestroy: true
+ });
}
////////////////////////////////////////////////////
diff --git a/types/react-native-collapsible/Accordion.d.ts b/types/react-native-collapsible/Accordion.d.ts
index 2a2fc04a9f..d4f3ae0dab 100644
--- a/types/react-native-collapsible/Accordion.d.ts
+++ b/types/react-native-collapsible/Accordion.d.ts
@@ -5,7 +5,7 @@ export interface AccordionProps {
/**
* An array of sections passed to the render methods
*/
- sections: string[];
+ sections: any[];
/**
* A function that should return a renderable representing the header
diff --git a/types/react-native-collapsible/index.d.ts b/types/react-native-collapsible/index.d.ts
index bdfc7cde09..bc107f140a 100644
--- a/types/react-native-collapsible/index.d.ts
+++ b/types/react-native-collapsible/index.d.ts
@@ -1,6 +1,7 @@
// Type definitions for react-native-collapsible 0.8
// Project: https://github.com/oblador/react-native-collapsible
// Definitions by: Kyle Roach
+// Umidbek Karimov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
diff --git a/types/react-native-collapsible/react-native-collapsible-tests.tsx b/types/react-native-collapsible/react-native-collapsible-tests.tsx
index 1107084f3d..65dd0015b8 100644
--- a/types/react-native-collapsible/react-native-collapsible-tests.tsx
+++ b/types/react-native-collapsible/react-native-collapsible-tests.tsx
@@ -36,3 +36,27 @@ class AccordianTest extends React.Component {
);
}
}
+
+class AccordionComplexTest extends React.Component {
+ _renderHeader() {
+ return (
+
+ );
+ }
+
+ _renderContent() {
+ return (
+
+ );
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
diff --git a/types/react-native-collapsible/tsconfig.json b/types/react-native-collapsible/tsconfig.json
index c9cb0c9278..7b0c98aa63 100644
--- a/types/react-native-collapsible/tsconfig.json
+++ b/types/react-native-collapsible/tsconfig.json
@@ -2,6 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
+ "dom",
"es6"
],
"noImplicitAny": true,
@@ -22,4 +23,4 @@
"Accordion.d.ts",
"react-native-collapsible-tests.tsx"
]
-}
\ No newline at end of file
+}
diff --git a/types/react-stripe-elements/index.d.ts b/types/react-stripe-elements/index.d.ts
index 56f0f3c33a..0ef90dc839 100644
--- a/types/react-stripe-elements/index.d.ts
+++ b/types/react-stripe-elements/index.d.ts
@@ -47,7 +47,7 @@ export namespace ReactStripeElements {
className?: string;
- elementRef?(): void;
+ elementRef?(ref: any): void;
onChange?(event: ElementChangeResponse): void;
diff --git a/types/react-virtualized/dist/es/Grid.d.ts b/types/react-virtualized/dist/es/Grid.d.ts
index 630e64df69..1cc1623a04 100644
--- a/types/react-virtualized/dist/es/Grid.d.ts
+++ b/types/react-virtualized/dist/es/Grid.d.ts
@@ -129,7 +129,7 @@ export type GridCellRangeProps = {
scrollTop: number,
deferredMeasurementCache: CellMeasurerCache,
horizontalOffsetAdjustment: number,
- parent: Grid | List | Table,
+ parent: typeof Grid | typeof List | typeof Table,
styleCache: Map,
verticalOffsetAdjustment: number,
visibleColumnIndices: VisibleCellRange,
diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx
index d912c1f28f..f11fa644f5 100644
--- a/types/react-virtualized/react-virtualized-tests.tsx
+++ b/types/react-virtualized/react-virtualized-tests.tsx
@@ -114,7 +114,7 @@ export class AutoSizerExample extends PureComponent {
}
}
import { } from 'react'
-import { CellMeasurer, CellMeasurerCache } from 'react-virtualized'
+import { CellMeasurer, CellMeasurerCache, ListRowProps } from 'react-virtualized'
export class DynamicHeightList extends PureComponent {
@@ -148,7 +148,7 @@ export class DynamicHeightList extends PureComponent {
)
}
- _rowRenderer({ index, isScrolling, key, parent, style }) {
+ _rowRenderer({ index, isScrolling, key, parent, style }: ListRowProps) {
const { getClassName, list } = this.props
const datum = list.get(index % list.size)
@@ -1835,3 +1835,114 @@ export class WindowScrollerExample extends PureComponent<{}, any> {
this.context.setScrollingCustomElement(event.target.checked)
}
}
+
+import { GridCellProps, GridCellRangeProps } from 'react-virtualized'
+
+export class GridCellRangeRendererExample extends PureComponent<{}, any> {
+
+ constructor(props) {
+ super(props)
+
+ this.state = {
+ columnWidth: 75,
+ columnCount: 50,
+ height: 300,
+ rowHeight: 40,
+ rowCount: 100
+ }
+
+ this._cellRangeRenderer = this._cellRangeRenderer.bind(this)
+ }
+
+ render() {
+ const {
+ columnCount,
+ columnWidth,
+ height,
+ rowHeight,
+ rowCount
+ } = this.state
+
+ return (
+ (
+
+ I'm a table cell
+
+ )}
+ columnCount={columnCount}
+ columnWidth={columnWidth}
+ height={height}
+ rowCount={rowCount}
+ rowHeight={rowHeight}
+ width={columnWidth}
+ />
+ )
+ }
+
+ _cellRangeRenderer({
+ cellCache, // Temporary cell cache used while scrolling
+ cellRenderer, // Cell renderer prop supplied to Grid
+ columnSizeAndPositionManager, // @see CellSizeAndPositionManager,
+ columnStartIndex, // Index of first column (inclusive) to render
+ columnStopIndex, // Index of last column (inclusive) to render
+ horizontalOffsetAdjustment, // Horizontal pixel offset (required for scaling)
+ isScrolling, // The Grid is currently being scrolled
+ rowSizeAndPositionManager, // @see CellSizeAndPositionManager,
+ rowStartIndex, // Index of first column (inclusive) to render
+ rowStopIndex, // Index of last column (inclusive) to render
+ scrollLeft, // Current horizontal scroll offset of Grid
+ scrollTop, // Current vertical scroll offset of Grid
+ styleCache, // Temporary style (size & position) cache used while scrolling
+ verticalOffsetAdjustment, // Vertical pixel offset (required for scaling)
+ parent,
+ visibleColumnIndices,
+ visibleRowIndices,
+ }: GridCellRangeProps): React.ReactNode[] {
+ const renderedCells: React.ReactNode[] = []
+ const style: React.CSSProperties = {}
+
+ for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
+ // This contains :offset (top) and :size (height) information for the cell
+ const rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex)
+
+ for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
+ // This contains :offset (left) and :size (width) information for the cell
+ const columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex)
+
+ // Be sure to adjust cell position in case the total set of cells is too large to be supported by the browser natively.
+ // In this case, Grid will shift cells as a user scrolls to increase cell density.
+ const left = columnDatum.offset + horizontalOffsetAdjustment
+ const top = rowDatum.offset + verticalOffsetAdjustment
+
+ // The rest of the information you need to render the cell are contained in the data.
+ // Be sure to provide unique :key attributes.
+ const key = `${rowIndex}-${columnIndex}`
+ const height = rowDatum.size
+ const width = columnDatum.size
+ const isVisible =
+ columnIndex >= visibleColumnIndices.start &&
+ columnIndex <= visibleColumnIndices.stop &&
+ rowIndex >= visibleRowIndices.start &&
+ rowIndex <= visibleRowIndices.stop
+
+ // Now render your cell and additional UI as you see fit.
+ // Add all rendered children to the :renderedCells Array.
+ const gridCellProps: GridCellProps = {
+ columnIndex,
+ isScrolling,
+ isVisible,
+ key,
+ parent,
+ rowIndex,
+ style,
+ }
+
+ renderedCells.push(cellRenderer(gridCellProps))
+ }
+ }
+
+ return renderedCells
+ }
+}
diff --git a/types/screeps/index.d.ts b/types/screeps/index.d.ts
index 17155770d5..77d472f447 100644
--- a/types/screeps/index.d.ts
+++ b/types/screeps/index.d.ts
@@ -53,6 +53,7 @@ declare const FIND_MY_CONSTRUCTION_SITES: 114;
declare const FIND_HOSTILE_CONSTRUCTION_SITES: 115;
declare const FIND_MINERALS: 116;
declare const FIND_NUKES: 117;
+declare const FIND_TOMBSTONES: 118;
declare const TOP: 1;
declare const TOP_RIGHT: 2;
@@ -246,7 +247,7 @@ declare const RESOURCE_CATALYZED_KEANIUM_ALKALIDE: "XKHO2";
declare const RESOURCE_CATALYZED_LEMERGIUM_ACID: "XLH2O";
declare const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE: "XLHO2";
declare const RESOURCE_CATALYZED_ZYNTHIUM_ACID: "XZH2O";
-declare const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: "ZXHO2";
+declare const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: "XZHO2";
declare const RESOURCE_CATALYZED_GHODIUM_ACID: "XGH2O";
declare const RESOURCE_CATALYZED_GHODIUM_ALKALIDE: "XGHO2";
declare const RESOURCES_ALL: ResourceConstant[];
@@ -627,11 +628,14 @@ declare const LOOK_FLAGS: "flag";
declare const LOOK_CONSTRUCTION_SITES: "constructionSite";
declare const LOOK_NUKES: "nuke";
declare const LOOK_TERRAIN: "terrain";
+declare const LOOK_TOMBSTONES: 'tombstone';
declare const ORDER_SELL: "sell";
declare const ORDER_BUY: "buy";
declare const SYSTEM_USERNAME: string;
+
+declare const TOMBSTONE_DECAY_PER_PART: 5;
/**
* A site of a structure which is currently under construction.
*/
@@ -1190,6 +1194,31 @@ interface CPU {
* @memberof CPU
*/
setShardLimits(limits: CPUShardLimits): OK | ERR_BUSY | ERR_INVALID_ARGS;
+
+ /**
+ * Use this method to get heap statistics for your virtual machine.
+ *
+ * This method will be undefined if you are not using IVM.
+ *
+ * The return value is almost identical to the Node.js function v8.getHeapStatistics().
+ * This function returns one additional property: externally_allocated_size which is the total amount of currently
+ * allocated memory which is not included in the v8 heap but counts against this isolate's memory limit.
+ * ArrayBuffer instances over a certain size are externally allocated and will be counted here.
+ */
+ getHeapStatistics?(): HeapStatistics;
+}
+
+interface HeapStatistics {
+ total_heap_size: number;
+ total_heap_size_executable: number;
+ total_physical_size: number;
+ total_available_size: number;
+ used_heap_size: number;
+ heap_size_limit: number;
+ malloced_memory: number;
+ peak_malloced_memory: number;
+ does_zap_garbage: 0 | 1;
+ externally_allocated_size: number;
}
/**
@@ -1250,6 +1279,7 @@ interface AllLookAtTypes {
source: Source;
structure: Structure;
terrain: Terrain;
+ tombstone: Tombstone;
}
type LookAtTypes = Partial;
@@ -1280,7 +1310,7 @@ type LookForAtAreaResultWithPos = Array>;
interface FindTypes {
- [key: number]: RoomPosition | Creep | Source | Resource | Structure | Flag | ConstructionSite | Mineral | Nuke;
+ [key: number]: RoomPosition | Creep | Source | Resource | Structure | Flag | ConstructionSite | Mineral | Nuke | Tombstone;
1: RoomPosition; // FIND_EXIT_TOP
3: RoomPosition; // FIND_EXIT_RIGHT
5: RoomPosition; // FIND_EXIT_BOTTOM
@@ -1303,6 +1333,7 @@ interface FindTypes {
115: ConstructionSite; // FIND_HOSTILE_CONSTRUCTION_SITES
116: Mineral; // FIND_MINERALS
117: Nuke; // FIND_NUKES
+ 118: Tombstone; // FIND_TOMBSTONES
}
interface FindPathOpts {
@@ -1531,7 +1562,8 @@ type FindConstant =
FIND_MY_CONSTRUCTION_SITES |
FIND_HOSTILE_CONSTRUCTION_SITES |
FIND_MINERALS |
- FIND_NUKES;
+ FIND_NUKES |
+ FIND_TOMBSTONES;
type FIND_EXIT_TOP = 1;
type FIND_EXIT_RIGHT = 3;
@@ -1556,6 +1588,7 @@ type FIND_MY_CONSTRUCTION_SITES = 114;
type FIND_HOSTILE_CONSTRUCTION_SITES = 115;
type FIND_MINERALS = 116;
type FIND_NUKES = 117;
+type FIND_TOMBSTONES = 118;
type FilterOptions = string | FilterFunction | { filter: FilterFunction };
@@ -1594,7 +1627,8 @@ type LookConstant =
LOOK_FLAGS |
LOOK_CONSTRUCTION_SITES |
LOOK_NUKES |
- LOOK_TERRAIN;
+ LOOK_TERRAIN |
+ LOOK_TOMBSTONES;
type LOOK_CONSTRUCTION_SITES = "constructionSite";
type LOOK_CREEPS = "creep";
@@ -1606,6 +1640,7 @@ type LOOK_RESOURCES = "resource";
type LOOK_SOURCES = "source";
type LOOK_STRUCTURES = "structure";
type LOOK_TERRAIN = "terrain";
+type LOOK_TOMBSTONES = "tombstone";
// Direction Constants
@@ -1844,9 +1879,11 @@ type RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2";
type RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O";
type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2";
type RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O";
-type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "ZXHO2";
+type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2";
type RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O";
type RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2";
+
+type TOMBSTONE_DECAY_PER_PART = 5;
/**
* The options that can be accepted by `findRoute()` and friends.
*/
@@ -3078,11 +3115,8 @@ interface StructureSpawn extends OwnedStructure {
name: string;
/**
* If the spawn is in process of spawning a new creep, this object will contain the new creep’s information, or null otherwise.
- * @param name The name of a new creep.
- * @param needTime Time needed in total to complete the spawning.
- * @param remainingTime Remaining time to go.
*/
- spawning: { name: string, needTime: number, remainingTime: number };
+ spawning: Spawning | null;
/**
* Check if a creep can be created.
@@ -3180,11 +3214,56 @@ interface StructureSpawn extends OwnedStructure {
}
interface StructureSpawnConstructor extends _Constructor, _ConstructorById {
+ Spawning: SpawningConstructor;
}
declare const StructureSpawn: StructureSpawnConstructor;
declare const Spawn: StructureSpawnConstructor; // legacy alias
// declare type Spawn = StructureSpawn;
+
+interface Spawning {
+ readonly prototype: Spawning;
+
+ /**
+ * An array with the spawn directions
+ * @see http://docs.screeps.com/api/#StructureSpawn.Spawning.setDirections
+ */
+ directions: DirectionConstant[];
+
+ /**
+ * The name of the creep
+ */
+ name: string;
+
+ /**
+ * Time needed in total to complete the spawning.
+ */
+ needTime: number;
+
+ /**
+ * Remaining time to go.
+ */
+ remainingTime: number;
+
+ /**
+ * A link to the spawn
+ */
+ spawn: StructureSpawn;
+
+ /**
+ * Cancel spawning immediately. Energy spent on spawning is not returned.
+ */
+ cancel(): ScreepsReturnCode & (OK | ERR_NOT_OWNER);
+
+ /**
+ * Set desired directions where the creep should move when spawned.
+ * @param directions An array with the spawn directions
+ */
+ setDirections(directions: DirectionConstant[]): ScreepsReturnCode & (OK | ERR_NOT_OWNER | ERR_INVALID_ARGS);
+}
+
+interface SpawningConstructor extends _Constructor, _ConstructorById {
+}
/**
* Parent object for structure classes
*/
@@ -3642,7 +3721,7 @@ interface StructureLab extends OwnedStructure {
/**
* The type of minerals containing in the lab. Labs can contain only one mineral type at the same time.
*/
- mineralType: MineralConstant;
+ mineralType: _ResourceConstantSansEnergy | undefined;
/**
* The total amount of minerals the lab can contain.
*/
@@ -3819,3 +3898,17 @@ type AnyStructure =
StructurePortal |
StructureRoad |
StructureWall;
+interface Tombstone extends RoomObject {
+ /** The tick that the creep died. */
+ deathTime: number;
+ store: StoreDefinition;
+ /** How many ticks until this tombstone decays */
+ ticksToDecay: number;
+ /** The creep that died to create this tombstone */
+ creep: Creep;
+}
+
+interface TombstoneConstructor extends _Constructor, _ConstructorById {
+}
+
+declare const Tombstone: TombstoneConstructor;
diff --git a/types/screeps/screeps-tests.ts b/types/screeps/screeps-tests.ts
index bbe542b568..17a78de496 100644
--- a/types/screeps/screeps-tests.ts
+++ b/types/screeps/screeps-tests.ts
@@ -43,6 +43,21 @@ interface CreepMemory {
{
for (const i in Game.spawns) {
Game.spawns[i].createCreep(body);
+
+ // Test StructureSpawn.Spawning
+ let creep: Spawning | null = Game.spawns[i].spawning;
+ if (creep) {
+ const name: string = creep.name;
+ const needTime: number = creep.needTime;
+ const remainingTime: number = creep.remainingTime;
+ const creepSpawn: StructureSpawn = creep.spawn;
+
+ const cancelStatus: OK | ERR_NOT_OWNER = creep.cancel();
+ const setDirectionStatus: OK | ERR_NOT_OWNER | ERR_INVALID_ARGS = creep.setDirections([TOP, BOTTOM, LEFT, RIGHT]);
+ }
+
+ creep = new StructureSpawn.Spawning("");
+ creep = StructureSpawn.Spawning("");
}
}
@@ -275,11 +290,12 @@ interface CreepMemory {
{
const pfCreep = Game.creeps.John;
- const goals = pfCreep.room.find(FIND_SOURCES).map((source) => {
- // We can't actually walk on sources-- set `range` to 1
- // so we path next to it.
- return { pos: source.pos, range: 1 };
- });
+ const goals = pfCreep.room.find(FIND_SOURCES)
+ .map((source) => {
+ // We can't actually walk on sources-- set `range` to 1
+ // so we path next to it.
+ return { pos: source.pos, range: 1 };
+ });
const ret = PathFinder.search(
pfCreep.pos, goals,
@@ -299,22 +315,24 @@ interface CreepMemory {
}
const costs = new PathFinder.CostMatrix();
- curRoom.find(FIND_STRUCTURES).forEach((struct) => {
- if (struct.structureType === STRUCTURE_ROAD) {
- // Favor roads over plain tiles
- costs.set(struct.pos.x, struct.pos.y, 1);
- } else if (struct.structureType !== STRUCTURE_CONTAINER &&
- (struct.structureType !== STRUCTURE_RAMPART ||
- !(struct as OwnedStructure).my)) {
- // Can't walk through non-walkable buildings
- costs.set(struct.pos.x, struct.pos.y, 0xff);
- }
- });
+ curRoom.find(FIND_STRUCTURES)
+ .forEach((struct) => {
+ if (struct.structureType === STRUCTURE_ROAD) {
+ // Favor roads over plain tiles
+ costs.set(struct.pos.x, struct.pos.y, 1);
+ } else if (struct.structureType !== STRUCTURE_CONTAINER &&
+ (struct.structureType !== STRUCTURE_RAMPART ||
+ !(struct as OwnedStructure).my)) {
+ // Can't walk through non-walkable buildings
+ costs.set(struct.pos.x, struct.pos.y, 0xff);
+ }
+ });
// Avoid creeps in the room
- curRoom.find(FIND_CREEPS).forEach((thisCreep) => {
- costs.set(thisCreep.pos.x, thisCreep.pos.y, 0xff);
- });
+ curRoom.find(FIND_CREEPS)
+ .forEach((thisCreep) => {
+ costs.set(thisCreep.pos.x, thisCreep.pos.y, 0xff);
+ });
return costs;
},
@@ -504,7 +522,8 @@ interface CreepMemory {
const from = Game.rooms.myRoom.find(FIND_STRUCTURES, (s) => (s.structureType === STRUCTURE_CONTAINER || s.structureType === STRUCTURE_STORAGE) && s.store.energy > 0)[0];
const to = from.pos.findClosestByPath(FIND_MY_STRUCTURES, {filter: (s) => (s.structureType === STRUCTURE_SPAWN || s.structureType === STRUCTURE_EXTENSION) && s.energy < s.energyCapacity});
- Game.rooms.myRoom.find(FIND_MY_STRUCTURES, (s) => s.structureType === STRUCTURE_RAMPART).forEach((r) => r.notifyWhenAttacked(false));
+ Game.rooms.myRoom.find(FIND_MY_STRUCTURES, (s) => s.structureType === STRUCTURE_RAMPART)
+ .forEach((r) => r.notifyWhenAttacked(false));
}
{
@@ -515,3 +534,18 @@ interface CreepMemory {
BOOSTS[creep.body[0].type];
}
+
+{
+ const tombstone = room.find(FIND_TOMBSTONES)[0];
+
+ tombstone.creep.my;
+
+ tombstone.store.energy;
+}
+
+{
+ if (Game.cpu.hasOwnProperty('getHeapStatistics')) {
+ const heap = Game.cpu.getHeapStatistics!();
+ heap.total_heap_size;
+ }
+}
diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts
index 67614ff6bc..263135e060 100644
--- a/types/sinon-chrome/index.d.ts
+++ b/types/sinon-chrome/index.d.ts
@@ -2,6 +2,7 @@
// Project: https://github.com/vitalets/sinon-chrome
// Definitions by: Tim Perry
// CRIMX
+// kobanyan
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -37,6 +38,8 @@ declare namespace SinonChrome {
*/
export function reset(): void;
+ export function registerPlugin(plugin: {}): void;
+
export var csi: Sinon.SinonSpy;
export var loadTimes: Sinon.SinonSpy;
}
@@ -353,6 +356,27 @@ declare namespace SinonChrome.permissions {
export var request: SinonChromeStub;
}
+declare namespace SinonChrome.plugins {
+ export interface Translations {
+ [key: string]: {
+ message: string;
+ description?: string;
+ placeholders?: {
+ [key: string]: {
+ content: string;
+ example?: string;
+ };
+ };
+ };
+ }
+ export class I18nPlugin {
+ constructor(translations?: Translations);
+ }
+ export class CookiePlugin {
+ constructor(state?: Array);
+ }
+}
+
declare namespace SinonChrome.power {
export var releaseKeepAwake: SinonChromeStub;
export var requestKeepAwake: SinonChromeStub;
diff --git a/types/sinon-chrome/sinon-chrome-tests.ts b/types/sinon-chrome/sinon-chrome-tests.ts
index 58639b8a65..7ae8a3f862 100644
--- a/types/sinon-chrome/sinon-chrome-tests.ts
+++ b/types/sinon-chrome/sinon-chrome-tests.ts
@@ -32,3 +32,50 @@ var id: string = chromeStub.runtime.id;
chromeStub.proxy.settings.set({value: { }, scope: 'regular'});
chromeStub.proxy.settings.onChange.trigger();
+
+chromeStub.registerPlugin(new chromeStub.plugins.I18nPlugin({
+ one: {
+ message: 'Hi!'
+ },
+ two: {
+ message: 'Hi $first_name$ $last_name$!',
+ placeholders: {
+ first_name: {
+ content: '$1'
+ },
+ last_name: {
+ content: '$2'
+ }
+ }
+ }
+}));
+
+chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin());
+
+chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin(
+ [
+ {
+ domain: '.domain.com',
+ expirationDate: 1511612273,
+ hostOnly: false,
+ httpOnly: false,
+ name: 'COOKIE_NAME',
+ path: '/data',
+ secure: false,
+ session: false,
+ storeId: '0',
+ value: 'COOKIE_VALUE'
+ },
+ {
+ domain: 'other-domain.com',
+ hostOnly: false,
+ httpOnly: false,
+ name: 'other-cookie',
+ path: '/',
+ secure: false,
+ session: true,
+ storeId: '0',
+ value: '123'
+ }
+ ]
+));
diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts
index a3397cedaa..489b771752 100644
--- a/types/snapsvg/index.d.ts
+++ b/types/snapsvg/index.d.ts
@@ -136,16 +136,19 @@ declare namespace Snap {
export interface Element {
add(el:Snap.Element):Snap.Element;
+ add(el:Snap.Set):Snap.Element;
addClass(value:string):Snap.Element;
after(el:Snap.Element):Snap.Element;
align(el: Snap.Element, way: string):Snap.Element;
animate(animation:any):Snap.Element;
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
append(el:Snap.Element):Snap.Element;
+ append(el:Snap.Set):Snap.Element;
appendTo(el:Snap.Element):Snap.Element;
asPX(attr:string,value?:string):number; //TODO: check what is really returned
- attr(param:string):string;
- attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
+ attr(param: "viewBox"): BBox;
+ attr(param: string): string;
+ attr(params:{[attr:string]:string|number|boolean|BBox|any}):Snap.Element;
before(el:Snap.Element):Snap.Element;
children(): Snap.Element[];
clone():Snap.Element;
@@ -284,12 +287,14 @@ declare namespace Snap {
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
text(x:number,y:number,text:string|number):Snap.Element;
text(x:number,y:number,text:Array):Snap.Element;
+ symbol(vbx:number,vby:number,vbw:number,vbh:number):Snap.Element;
}
export interface Set {
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Element;
animate(...params:Array<{attrs:any,duration:number,easing:(num:number)=>number,callback?:()=>void}>):Snap.Element;
- attr(params: {[attr:string]:string|number|boolean|any}): Snap.Element;
+ attr(params: {[attr:string]:string|number|boolean|BBox|any}): Snap.Element;
+ attr(param: "viewBox"): BBox;
attr(param: string): string;
bind(attr: string, callback: Function): Snap.Set;
bind(attr:string,element:Snap.Element):Snap.Set;
diff --git a/types/snapsvg/test/2.ts b/types/snapsvg/test/2.ts
index 0ab83291bd..5afcf36460 100644
--- a/types/snapsvg/test/2.ts
+++ b/types/snapsvg/test/2.ts
@@ -125,6 +125,19 @@ function tester6() {
console.log(!path.isPointInsideBBox(b3, 50, 50));
}
+function tester7() {
+ var paper = Snap(600, 800);
+
+ Snap.load("http://snapsvg.io/assets/images/logo.svg", (fragment: Snap.Fragment) => {
+ // viewBox retrieveal
+ let fragmentViewBox = fragment.select("svg").attr("viewBox");
+ let symbol = paper.symbol(fragmentViewBox.x, fragmentViewBox.y, fragmentViewBox.width, fragmentViewBox.height);
+
+ symbol.add(fragment.selectAll("svg *"));
+ symbol.toDefs();
+ });
+}
+
//$(function () {
// tester1();
//});
@@ -134,3 +147,4 @@ function tester6() {
//tester4();
//tester5();
//tester6();
+//tester7();
diff --git a/types/three/index.d.ts b/types/three/index.d.ts
index e553853293..50450fd793 100644
--- a/types/three/index.d.ts
+++ b/types/three/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for three.js 0.89
+// Type definitions for three.js 0.91
// Project: https://threejs.org
// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv , Apurva Ojas
// Definitions: https://github.com//DefinitelyTyped
diff --git a/types/three/test/math/test_unit_math.ts b/types/three/test/math/test_unit_math.ts
index 4a8e0a8c14..d49a60632c 100644
--- a/types/three/test/math/test_unit_math.ts
+++ b/types/three/test/math/test_unit_math.ts
@@ -91,57 +91,62 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "center", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
+ var center = new THREE.Vector2();
- ok( a.getCenter().equals( zero2 ), "Passed!" );
+ ok( a.getCenter(center).equals( zero2 ), "Passed!" );
a = new THREE.Box2( zero2, one2 );
var midpoint = one2.clone().multiplyScalar( 0.5 );
- ok( a.getCenter().equals( midpoint ), "Passed!" );
+ ok( a.getCenter(center).equals( midpoint ), "Passed!" );
});
test( "size", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
+ var size = new THREE.Vector2();
- ok( a.getSize().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( zero2 ), "Passed!" );
a = new THREE.Box2( zero2.clone(), one2.clone() );
- ok( a.getSize().equals( one2 ), "Passed!" );
+ ok( a.getSize(size).equals( one2 ), "Passed!" );
});
test( "expandByPoint", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
+ var size = new THREE.Vector2();
a.expandByPoint( zero2 );
- ok( a.getSize().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( zero2 ), "Passed!" );
a.expandByPoint( one2 );
- ok( a.getSize().equals( one2 ), "Passed!" );
+ ok( a.getSize(size).equals( one2 ), "Passed!" );
a.expandByPoint( one2.clone().negate() );
- ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" );
});
test( "expandByVector", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
+ var size = new THREE.Vector2();
a.expandByVector( zero2 );
- ok( a.getSize().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( zero2 ), "Passed!" );
a.expandByVector( one2 );
- ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" );
});
test( "expandByScalar", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
+ var size = new THREE.Vector2();
a.expandByScalar( 0 );
- ok( a.getSize().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( zero2 ), "Passed!" );
a.expandByScalar( 1 );
- ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero2 ), "Passed!" );
+ ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" );
});
test( "containsPoint", function() {
@@ -185,16 +190,17 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "clampPoint", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
var b = new THREE.Box2( one2.clone().negate(), one2.clone() );
+ var target = new THREE.Vector2();
- ok( a.clampPoint( new THREE.Vector2( 0, 0 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
- ok( a.clampPoint( new THREE.Vector2( 1, 1 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
- ok( a.clampPoint( new THREE.Vector2( -1, -1 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector2( 0, 0 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector2( 1, 1 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector2( -1, -1 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector2( 2, 2 ) ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector2( 1, 1 ) ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector2( 0, 0 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector2( -1, -1 ) ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector2( -2, -2 ) ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector2( 2, 2 ), target ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector2( 1, 1 ), target ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector2( 0, 0 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector2( -1, -1 ), target ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector2( -2, -2 ), target ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" );
});
test( "distanceToPoint", function() {
@@ -332,57 +338,62 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "center", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
+ var center = new THREE.Vector3();
- ok( a.getCenter().equals( zero3 ), "Passed!" );
+ ok( a.getCenter(center).equals( zero3 ), "Passed!" );
a = new THREE.Box3( zero3.clone(), one3.clone() );
var midpoint = one3.clone().multiplyScalar( 0.5 );
- ok( a.getCenter().equals( midpoint ), "Passed!" );
+ ok( a.getCenter(center).equals( midpoint ), "Passed!" );
});
test( "size", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
+ var size = new THREE.Vector3();
- ok( a.getSize().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( zero3 ), "Passed!" );
a = new THREE.Box3( zero3.clone(), one3.clone() );
- ok( a.getSize().equals( one3 ), "Passed!" );
+ ok( a.getSize(size).equals( one3 ), "Passed!" );
});
test( "expandByPoint", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
+ var size = new THREE.Vector3();
a.expandByPoint( zero3 );
- ok( a.getSize().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( zero3 ), "Passed!" );
a.expandByPoint( one3 );
- ok( a.getSize().equals( one3 ), "Passed!" );
+ ok( a.getSize(size).equals( one3 ), "Passed!" );
a.expandByPoint( one3.clone().negate() );
- ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" );
});
test( "expandByVector", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
+ var size = new THREE.Vector3();
a.expandByVector( zero3 );
- ok( a.getSize().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( zero3 ), "Passed!" );
a.expandByVector( one3 );
- ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" );
});
test( "expandByScalar", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
+ var size = new THREE.Vector3();
a.expandByScalar( 0 );
- ok( a.getSize().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( zero3 ), "Passed!" );
a.expandByScalar( 1 );
- ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
- ok( a.getCenter().equals( zero3 ), "Passed!" );
+ ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" );
+ ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" );
});
test( "containsPoint", function() {
@@ -426,16 +437,17 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "clampPoint", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
var b = new THREE.Box3( one3.clone().negate(), one3.clone() );
+ var target = new THREE.Vector3();
- ok( a.clampPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
- ok( a.clampPoint( new THREE.Vector3( 1, 1, 1 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
- ok( a.clampPoint( new THREE.Vector3( -1, -1, -1 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector3( 1, 1, 1 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector3( -1, -1, -1 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector3( 2, 2, 2 ) ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector3( 1, 1, 1 ) ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector3( -1, -1, -1 ) ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
- ok( b.clampPoint( new THREE.Vector3( -2, -2, -2 ) ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector3( 2, 2, 2 ), target ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector3( 1, 1, 1 ), target ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector3( -1, -1, -1 ), target ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
+ ok( b.clampPoint( new THREE.Vector3( -2, -2, -2 ), target ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
});
test( "distanceToPoint", function() {
@@ -491,10 +503,11 @@ declare function equal(a: T, b: T, desc?: string): void;
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
var b = new THREE.Box3( zero3.clone(), one3.clone() );
var c = new THREE.Box3( one3.clone().negate(), one3.clone() );
+ var target = new THREE.Sphere();
- ok( a.getBoundingSphere().equals( new THREE.Sphere( zero3, 0 ) ), "Passed!" );
- ok( b.getBoundingSphere().equals( new THREE.Sphere( one3.clone().multiplyScalar( 0.5 ), Math.sqrt( 3 ) * 0.5 ) ), "Passed!" );
- ok( c.getBoundingSphere().equals( new THREE.Sphere( zero3, Math.sqrt( 12 ) * 0.5 ) ), "Passed!" );
+ ok( a.getBoundingSphere( target ).equals( new THREE.Sphere( zero3, 0 ) ), "Passed!" );
+ ok( b.getBoundingSphere( target ).equals( new THREE.Sphere( one3.clone().multiplyScalar( 0.5 ), Math.sqrt( 3 ) * 0.5 ) ), "Passed!" );
+ ok( c.getBoundingSphere( target ).equals( new THREE.Sphere( zero3, Math.sqrt( 12 ) * 0.5 ) ), "Passed!" );
});
test( "intersect", function() {
@@ -1080,34 +1093,36 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "at", function() {
var a = new THREE.Line3( one3.clone(), new THREE.Vector3( 1, 1, 2 ) );
+ var target = new THREE.Vector3();
- ok( a.at( -1 ).distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" );
- ok( a.at( 0 ).distanceTo( one3.clone() ) < 0.0001, "Passed!" );
- ok( a.at( 1 ).distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" );
- ok( a.at( 2 ).distanceTo( new THREE.Vector3( 1, 1, 3 ) ) < 0.0001, "Passed!" );
+ ok( a.at( -1, target ).distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" );
+ ok( a.at( 0, target ).distanceTo( one3.clone() ) < 0.0001, "Passed!" );
+ ok( a.at( 1, target ).distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" );
+ ok( a.at( 2, target ).distanceTo( new THREE.Vector3( 1, 1, 3 ) ) < 0.0001, "Passed!" );
});
test( "closestPointToPoint/closestPointToPointParameter", function() {
var a = new THREE.Line3( one3.clone(), new THREE.Vector3( 1, 1, 2 ) );
+ var target = new THREE.Vector3();
// nearby the ray
ok( a.closestPointToPointParameter( zero3.clone(), true ) == 0, "Passed!" );
- var b1 = a.closestPointToPoint( zero3.clone(), true );
+ var b1 = a.closestPointToPoint( zero3.clone(), true, target );
ok( b1.distanceTo( new THREE.Vector3( 1, 1, 1 ) ) < 0.0001, "Passed!" );
// nearby the ray
ok( a.closestPointToPointParameter( zero3.clone(), false ) == -1, "Passed!" );
- var b2 = a.closestPointToPoint( zero3.clone(), false );
+ var b2 = a.closestPointToPoint( zero3.clone(), false, target );
ok( b2.distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" );
// nearby the ray
ok( a.closestPointToPointParameter( new THREE.Vector3( 1, 1, 5 ), true ) == 1, "Passed!" );
- var b = a.closestPointToPoint( new THREE.Vector3( 1, 1, 5 ), true );
+ var b = a.closestPointToPoint( new THREE.Vector3( 1, 1, 5 ), true, target );
ok( b.distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" );
// exactly on the ray
ok( a.closestPointToPointParameter( one3.clone(), true ) == 0, "Passed!" );
- var c = a.closestPointToPoint( one3.clone(), true );
+ var c = a.closestPointToPoint( one3.clone(), true, target );
ok( c.distanceTo( one3.clone() ) < 0.0001, "Passed!" );
});
@@ -1752,7 +1767,7 @@ declare function equal(a: T, b: T, desc?: string): void;
var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), -2 );
a.normalize();
- ok( a.distanceToPoint( a.projectPoint( zero3.clone() ) ) === 0, "Passed!" );
+ ok( a.distanceToPoint( a.projectPoint( zero3.clone(), new THREE.Vector3() ) ) === 0, "Passed!" );
ok( a.distanceToPoint( new THREE.Vector3( 4, 0, 0 ) ) === 3, "Passed!" );
});
@@ -1771,54 +1786,57 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "isInterestionLine/intersectLine", function() {
var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+ var target = new THREE.Vector3();
var l1 = new THREE.Line3( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) );
ok( a.intersectsLine( l1 ), "Passed!" );
- ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.intersectLine( l1, target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -3 );
ok( a.intersectsLine( l1 ), "Passed!" );
- ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" );
+ ok( a.intersectLine( l1, target ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -11 );
ok( ! a.intersectsLine( l1 ), "Passed!" );
- ok( a.intersectLine( l1 ) === undefined, "Passed!" );
+ ok( a.intersectLine( l1, target ) === undefined, "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 11 );
ok( ! a.intersectsLine( l1 ), "Passed!" );
- ok( a.intersectLine( l1 ) === undefined, "Passed!" );
+ ok( a.intersectLine( l1, target ) === undefined, "Passed!" );
});
test( "projectPoint", function() {
var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+ var target = new THREE.Vector3();
- ok( a.projectPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( zero3 ), "Passed!" );
- ok( a.projectPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( zero3 ), "Passed!" );
+ ok( a.projectPoint( new THREE.Vector3( 10, 0, 0 ), target ).equals( zero3 ), "Passed!" );
+ ok( a.projectPoint( new THREE.Vector3( -10, 0, 0 ), target ).equals( zero3 ), "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 );
- ok( a.projectPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
- ok( a.projectPoint( new THREE.Vector3( 0, 1, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+ ok( a.projectPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+ ok( a.projectPoint( new THREE.Vector3( 0, 1, 0 ), target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
});
test( "orthoPoint", function() {
var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
+ var target = new THREE.Vector3();
- ok( a.orthoPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
- ok( a.orthoPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( new THREE.Vector3( -10, 0, 0 ) ), "Passed!" );
+ ok( a.orthoPoint( new THREE.Vector3( 10, 0, 0 ), target ).equals( new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
+ ok( a.orthoPoint( new THREE.Vector3( -10, 0, 0 ), target ).equals( new THREE.Vector3( -10, 0, 0 ) ), "Passed!" );
});
test( "coplanarPoint", function() {
var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
- ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" );
+ ok( a.distanceToPoint( a.coplanarPoint( new THREE.Vector3() ) ) === 0, "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 );
- ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" );
+ ok( a.distanceToPoint( a.coplanarPoint( new THREE.Vector3() ) ) === 0, "Passed!" );
});
test( "applyMatrix4/translate", function() {
@@ -2080,10 +2098,11 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "at", function() {
var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) );
+ var target = new THREE.Vector3();
- ok( a.at( 0 ).equals( one3 ), "Passed!" );
- ok( a.at( -1 ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );
- ok( a.at( 1 ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
+ ok( a.at( 0, target ).equals( one3 ), "Passed!" );
+ ok( a.at( -1, target ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );
+ ok( a.at( 1, target ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
});
test( "recast/clone", function() {
@@ -2106,17 +2125,18 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "closestPointToPoint", function() {
var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) );
+ var target = new THREE.Vector3();
// behind the ray
- var b = a.closestPointToPoint( zero3 );
+ var b = a.closestPointToPoint( zero3, target );
ok( b.equals( one3 ), "Passed!" );
// front of the ray
- var c = a.closestPointToPoint( new THREE.Vector3( 0, 0, 50 ) );
+ var c = a.closestPointToPoint( new THREE.Vector3( 0, 0, 50 ), target );
ok( c.equals( new THREE.Vector3( 1, 1, 50 ) ), "Passed!" );
// exactly on the ray
- var d = a.closestPointToPoint( one3 );
+ var d = a.closestPointToPoint( one3, target );
ok( d.equals( one3 ), "Passed!" );
});
@@ -2159,34 +2179,35 @@ declare function equal(a: T, b: T, desc?: string): void;
var a0 = new THREE.Ray( zero3.clone(), new THREE.Vector3( 0, 0, -1 ) );
// ray a1 origin located at ( 1, 1, 1 ) and points left in negative-x direction
var a1 = new THREE.Ray( one3.clone(), new THREE.Vector3( -1, 0, 0 ) );
+ var target = new THREE.Vector3();
// sphere (radius of 2) located behind ray a0, should result in null
var b = new THREE.Sphere( new THREE.Vector3( 0, 0, 3 ), 2 );
- ok( a0.intersectSphere( b ) === null, "Passed!" );
+ ok( a0.intersectSphere( b, target ) === null, "Passed!" );
// sphere (radius of 2) located in front of, but too far right of ray a0, should result in null
var b = new THREE.Sphere( new THREE.Vector3( 3, 0, -1 ), 2 );
- ok( a0.intersectSphere( b ) === null, "Passed!" );
+ ok( a0.intersectSphere( b, target ) === null, "Passed!" );
// sphere (radius of 2) located below ray a1, should result in null
var b = new THREE.Sphere( new THREE.Vector3( 1, -2, 1 ), 2 );
- ok( a1.intersectSphere( b ) === null, "Passed!" );
+ ok( a1.intersectSphere( b, target ) === null, "Passed!" );
// sphere (radius of 1) located to the left of ray a1, should result in intersection at 0, 1, 1
var b = new THREE.Sphere( new THREE.Vector3( -1, 1, 1 ), 1 );
- ok( a1.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 1, 1 ) ) < TOL, "Passed!" );
+ ok( a1.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 1, 1 ) ) < TOL, "Passed!" );
// sphere (radius of 1) located in front of ray a0, should result in intersection at 0, 0, -1
var b = new THREE.Sphere( new THREE.Vector3( 0, 0, -2 ), 1 );
- ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
+ ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
// sphere (radius of 2) located in front & right of ray a0, should result in intersection at 0, 0, -1, or left-most edge of sphere
var b = new THREE.Sphere( new THREE.Vector3( 2, 0, -1 ), 2 );
- ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
+ ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
// same situation as above, but move the sphere a fraction more to the right, and ray a0 should now just miss
var b = new THREE.Sphere( new THREE.Vector3( 2.01, 0, -1 ), 2 );
- ok( a0.intersectSphere( b ) === null, "Passed!" );
+ ok( a0.intersectSphere( b, target ) === null, "Passed!" );
// following tests are for situations where the ray origin is inside the sphere
@@ -2194,19 +2215,19 @@ declare function equal(a: T, b: T, desc?: string): void;
// is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -1
// thus keeping the intersection point always in front of the ray.
var b = new THREE.Sphere( zero3.clone(), 1 );
- ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
+ ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" );
// sphere (radius of 4) center located behind ray a0 origin / sphere surrounds the ray origin, so the first intersect point 0, 0, 5,
// is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -3
// thus keeping the intersection point always in front of the ray.
var b = new THREE.Sphere( new THREE.Vector3( 0, 0, 1 ), 4 );
- ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -3 ) ) < TOL, "Passed!" );
+ ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -3 ) ) < TOL, "Passed!" );
// sphere (radius of 4) center located in front of ray a0 origin / sphere surrounds the ray origin, so the first intersect point 0, 0, 3,
// is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -5
// thus keeping the intersection point always in front of the ray.
var b = new THREE.Sphere( new THREE.Vector3( 0, 0, -1 ), 4 );
- ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -5 ) ) < TOL, "Passed!" );
+ ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -5 ) ) < TOL, "Passed!" );
});
@@ -2236,26 +2257,27 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "intersectPlane", function() {
var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) );
+ var target = new THREE.Vector3();
// parallel plane behind
var b = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, -1 ) );
- ok( a.intersectPlane( b ) === null, "Passed!" );
+ ok( a.intersectPlane( b, target ) === null, "Passed!" );
// parallel plane coincident with origin
var c = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, 0 ) );
- ok( a.intersectPlane( c ) === null, "Passed!" );
+ ok( a.intersectPlane( c, target ) === null, "Passed!" );
// parallel plane infront
var d = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, 1 ) );
- ok( a.intersectPlane( d ).equals( a.origin ), "Passed!" );
+ ok( a.intersectPlane( d, target ).equals( a.origin ), "Passed!" );
// perpendical ray that overlaps exactly
var e = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), one3 );
- ok( a.intersectPlane( e ).equals( a.origin ), "Passed!" );
+ ok( a.intersectPlane( e, target ).equals( a.origin ), "Passed!" );
// perpendical ray that doesn't overlap
var f = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), zero3 );
- ok( a.intersectPlane( f ) === null, "Passed!" );
+ ok( a.intersectPlane( f, target ) === null, "Passed!" );
});
@@ -2324,36 +2346,37 @@ declare function equal(a: T, b: T, desc?: string): void;
var TOL = 0.0001;
var box = new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 1, 1, 1 ) );
+ var target = new THREE.Vector3();
var a = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( 1, 0, 0) );
//ray should intersect box at -1,0,0
ok( a.intersectsBox(box) === true, "Passed!" );
- ok( a.intersectBox(box).distanceTo( new THREE.Vector3( -1, 0, 0 ) ) < TOL, "Passed!" );
+ ok( a.intersectBox(box, target).distanceTo( new THREE.Vector3( -1, 0, 0 ) ) < TOL, "Passed!" );
var b = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( -1, 0, 0) );
//ray is point away from box, it should not intersect
ok( b.intersectsBox(box) === false, "Passed!" );
- ok( b.intersectBox(box) === null, "Passed!" );
+ ok( b.intersectBox(box, target) === null, "Passed!" );
var c = new THREE.Ray( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0) );
// ray is inside box, should return exit point
ok( c.intersectsBox(box) === true, "Passed!" );
- ok( c.intersectBox(box).distanceTo( new THREE.Vector3( 1, 0, 0 ) ) < TOL, "Passed!" );
+ ok( c.intersectBox(box, target).distanceTo( new THREE.Vector3( 1, 0, 0 ) ) < TOL, "Passed!" );
var d = new THREE.Ray( new THREE.Vector3( 0, 2, 1 ), new THREE.Vector3( 0, -1, -1).normalize() );
//tilted ray should intersect box at 0,1,0
ok( d.intersectsBox(box) === true, "Passed!" );
- ok( d.intersectBox(box).distanceTo( new THREE.Vector3( 0, 1, 0 ) ) < TOL, "Passed!" );
+ ok( d.intersectBox(box, target).distanceTo( new THREE.Vector3( 0, 1, 0 ) ) < TOL, "Passed!" );
var e = new THREE.Ray( new THREE.Vector3( 1, -2, 1 ), new THREE.Vector3( 0, 1, 0).normalize() );
//handle case where ray is coplanar with one of the boxes side - box in front of ray
ok( e.intersectsBox(box) === true, "Passed!" );
- ok( e.intersectBox(box).distanceTo( new THREE.Vector3( 1, -1, 1 ) ) < TOL, "Passed!" );
+ ok( e.intersectBox(box, target).distanceTo( new THREE.Vector3( 1, -1, 1 ) ) < TOL, "Passed!" );
var f = new THREE.Ray( new THREE.Vector3( 1, -2, 0 ), new THREE.Vector3( 0, -1, 0).normalize() );
//handle case where ray is coplanar with one of the boxes side - box behind ray
ok( f.intersectsBox(box) === false, "Passed!" );
- ok( f.intersectBox(box) == null, "Passed!" );
+ ok( f.intersectBox(box, target) == null, "Passed!" );
});
@@ -2425,18 +2448,20 @@ declare function equal(a: T, b: T, desc?: string): void;
test( "clampPoint", function() {
var a = new THREE.Sphere( one3.clone(), 1 );
+ var target = new THREE.Vector3();
- ok( a.clampPoint( new THREE.Vector3( 1, 1, 3 ) ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
- ok( a.clampPoint( new THREE.Vector3( 1, 1, -3 ) ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector3( 1, 1, 3 ), target ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" );
+ ok( a.clampPoint( new THREE.Vector3( 1, 1, -3 ), target ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );
});
test( "getBoundingBox", function() {
var a = new THREE.Sphere( one3.clone(), 1 );
+ var target = new THREE.Box3();
- ok( a.getBoundingBox().equals( new THREE.Box3( zero3, two3 ) ), "Passed!" );
+ ok( a.getBoundingBox( target ).equals( new THREE.Box3( zero3, two3 ) ), "Passed!" );
a.set( zero3, 0 )
- ok( a.getBoundingBox().equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" );
+ ok( a.getBoundingBox( target ).equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" );
});
test( "applyMatrix4", function() {
@@ -2444,7 +2469,7 @@ declare function equal(a: T, b: T, desc?: string): void;
var m = new THREE.Matrix4().makeTranslation( 1, -2, 1 );
- ok( a.clone().applyMatrix4( m ).getBoundingBox().equals( a.getBoundingBox().applyMatrix4( m ) ), "Passed!" );
+ ok( a.clone().applyMatrix4( m ).getBoundingBox( new THREE.Box3() ).equals( a.getBoundingBox( new THREE.Box3() ).applyMatrix4( m ) ), "Passed!" );
});
test( "translate", function() {
@@ -2505,88 +2530,92 @@ declare function equal(a: T, b: T, desc?: string): void;
});
- test( "area", function() {
+ test( "getArea", function() {
var a = new THREE.Triangle();
- ok( a.area() == 0, "Passed!" );
+ ok( a.getArea() == 0, "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
- ok( a.area() == 0.5, "Passed!" );
+ ok( a.getArea() == 0.5, "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
- ok( a.area() == 2, "Passed!" );
+ ok( a.getArea() == 2, "Passed!" );
// colinear triangle.
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 3, 0, 0 ) );
- ok( a.area() == 0, "Passed!" );
+ ok( a.getArea() == 0, "Passed!" );
});
- test( "midpoint", function() {
+ test( "getMidpoint", function() {
var a = new THREE.Triangle();
+ var target = new THREE.Vector3();
- ok( a.midpoint().equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.getMidpoint( target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
- ok( a.midpoint().equals( new THREE.Vector3( 1/3, 1/3, 0 ) ), "Passed!" );
+ ok( a.getMidpoint( target ).equals( new THREE.Vector3( 1/3, 1/3, 0 ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
- ok( a.midpoint().equals( new THREE.Vector3( 2/3, 0, 2/3 ) ), "Passed!" );
+ ok( a.getMidpoint( target ).equals( new THREE.Vector3( 2/3, 0, 2/3 ) ), "Passed!" );
});
- test( "normal", function() {
+ test( "getNormal", function() {
var a = new THREE.Triangle();
+ var target = new THREE.Vector3();
- ok( a.normal().equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
+ ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
- ok( a.normal().equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
+ ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
- ok( a.normal().equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+ ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
});
- test( "plane", function() {
+ test( "getPlane", function() {
var a = new THREE.Triangle();
+ var target = new THREE.Vector3();
// artificial normal is created in this case.
- ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" );
- ok( a.plane().normal.equals( a.normal() ), "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" );
+ ok( a.getPlane( target ).normal.equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
- ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" );
- ok( a.plane().normal.equals( a.normal() ), "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" );
+ ok( a.getPlane( target ).normal.equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
- ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" );
- ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" );
- ok( a.plane().normal.clone().normalize().equals( a.normal() ), "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" );
+ ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" );
+ ok( a.getPlane( target ).normal.clone().normalize().equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" );
});
- test( "barycoordFromPoint", function() {
+ test( "getBarycoord", function() {
var a = new THREE.Triangle();
+ var target = new THREE.Vector3();
var bad = new THREE.Vector3( -2, -1, -1 );
- ok( a.barycoordFromPoint( a.a ).equals( bad ), "Passed!" );
- ok( a.barycoordFromPoint( a.b ).equals( bad ), "Passed!" );
- ok( a.barycoordFromPoint( a.c ).equals( bad ), "Passed!" );
+ ok( a.getBarycoord( a.a, target ).equals( bad ), "Passed!" );
+ ok( a.getBarycoord( a.b, target ).equals( bad ), "Passed!" );
+ ok( a.getBarycoord( a.c, target ).equals( bad ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
- ok( a.barycoordFromPoint( a.a ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.b ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.c ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.midpoint() ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" );
+ ok( a.getBarycoord( a.a, target ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
+ ok( a.getBarycoord( a.b, target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+ ok( a.getBarycoord( a.c, target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
+ ok( a.getBarycoord( a.getMidpoint( new THREE.Vector3() ), target ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
- ok( a.barycoordFromPoint( a.a ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.b ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.c ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
- ok( a.barycoordFromPoint( a.midpoint() ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" );
+ ok( a.getBarycoord( a.a, target ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );
+ ok( a.getBarycoord( a.b, target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );
+ ok( a.getBarycoord( a.c, target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" );
+ ok( a.getBarycoord( a.getMidpoint( new THREE.Vector3() ), target ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" );
});
test( "containsPoint", function() {
@@ -2600,14 +2629,14 @@ declare function equal(a: T, b: T, desc?: string): void;
ok( a.containsPoint( a.a ), "Passed!" );
ok( a.containsPoint( a.b ), "Passed!" );
ok( a.containsPoint( a.c ), "Passed!" );
- ok( a.containsPoint( a.midpoint() ), "Passed!" );
+ ok( a.containsPoint( a.getMidpoint( new THREE.Vector3() ) ), "Passed!" );
ok( ! a.containsPoint( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) );
ok( a.containsPoint( a.a ), "Passed!" );
ok( a.containsPoint( a.b ), "Passed!" );
ok( a.containsPoint( a.c ), "Passed!" );
- ok( a.containsPoint( a.midpoint() ), "Passed!" );
+ ok( a.containsPoint( a.getMidpoint( new THREE.Vector3() ) ), "Passed!" );
ok( ! a.containsPoint( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" );
});
diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts
index 31c8cbebe0..e7e421b93d 100644
--- a/types/three/three-core.d.ts
+++ b/types/three/three-core.d.ts
@@ -448,7 +448,7 @@ export class Camera extends Object3D {
*/
projectionMatrix: Matrix4;
- getWorldDirection(optionalTarget?: Vector3): Vector3;
+ getWorldDirection(target: Vector3): Vector3;
}
@@ -687,7 +687,6 @@ export class BufferAttribute {
copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute;
copyArray(array: ArrayLike): BufferAttribute;
copyColorsArray(colors: {r: number, g: number, b: number}[]): BufferAttribute;
- copyIndicesArray(indices: {a: number, b: number, c: number}[]): BufferAttribute;
copyVector2sArray(vectors: {x: number, y: number}[]): BufferAttribute;
copyVector3sArray(vectors: {x: number, y: number, z: number}[]): BufferAttribute;
copyVector4sArray(vectors: {x: number, y: number, z: number, w: number}[]): BufferAttribute;
@@ -868,7 +867,7 @@ export class BufferGeometry extends EventDispatcher {
scale(x: number, y: number, z: number): BufferGeometry;
lookAt(v: Vector3): void;
- center(): Vector3;
+ center(): BufferGeometry;
setFromObject(object: Object3D): BufferGeometry;
setFromPoints(points: Vector3[]): BufferGeometry;
@@ -1343,7 +1342,7 @@ export class Geometry extends EventDispatcher {
fromBufferGeometry(geometry: BufferGeometry): Geometry;
- center(): Vector3;
+ center(): Geometry;
normalize(): Geometry;
@@ -1368,8 +1367,6 @@ export class Geometry extends EventDispatcher {
*/
computeMorphNormals(): void;
- computeLineDistances(): void;
-
/**
* Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute.
*/
@@ -1782,11 +1779,10 @@ export class Object3D extends EventDispatcher {
getObjectByProperty( name: string, value: string ): Object3D;
- getWorldPosition(optionalTarget?: Vector3): Vector3;
- getWorldQuaternion(optionalTarget?: Quaternion): Quaternion;
- getWorldRotation(optionalTarget?: Euler): Euler;
- getWorldScale(optionalTarget?: Vector3): Vector3;
- getWorldDirection(optionalTarget?: Vector3): Vector3;
+ getWorldPosition(target: Vector3): Vector3;
+ getWorldQuaternion(target: Quaternion): Quaternion;
+ getWorldScale(target: Vector3): Vector3;
+ getWorldDirection(target: Vector3): Vector3;
raycast(raycaster: Raycaster, intersects: any): void;
@@ -3088,8 +3084,8 @@ export class Box2 {
copy(box: this): this;
makeEmpty(): Box2;
isEmpty(): boolean;
- getCenter(optionalTarget?: Vector2): Vector2;
- getSize(optionalTarget?: Vector2): Vector2;
+ getCenter(target: Vector2): Vector2;
+ getSize(target: Vector2): Vector2;
expandByPoint(point: Vector2): Box2;
expandByVector(vector: Vector2): Box2;
expandByScalar(scalar: number): Box2;
@@ -3097,7 +3093,7 @@ export class Box2 {
containsBox(box: Box2): boolean;
getParameter(point: Vector2): Vector2;
intersectsBox(box: Box2): boolean;
- clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2;
+ clampPoint(point: Vector2, target: Vector2): Vector2;
distanceToPoint(point: Vector2): number;
intersect(box: Box2): Box2;
union(box: Box2): Box2;
@@ -3128,8 +3124,8 @@ export class Box3 {
copy(box: this): this;
makeEmpty(): Box3;
isEmpty(): boolean;
- getCenter(optionalTarget?: Vector3): Vector3;
- getSize(optionalTarget?: Vector3): Vector3;
+ getCenter(target: Vector3): Vector3;
+ getSize(target: Vector3): Vector3;
expandByPoint(point: Vector3): Box3;
expandByVector(vector: Vector3): Box3;
expandByScalar(scalar: number): Box3;
@@ -3140,9 +3136,9 @@ export class Box3 {
intersectsBox(box: Box3): boolean;
intersectsSphere(sphere: Sphere): boolean;
intersectsPlane(plane: Plane): boolean;
- clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
+ clampPoint(point: Vector3, target: Vector3): Vector3;
distanceToPoint(point: Vector3): number;
- getBoundingSphere(optionalTarget?: Sphere): Sphere;
+ getBoundingSphere(target: Sphere): Sphere;
intersect(box: Box3): Box3;
union(box: Box3): Box3;
applyMatrix4(matrix: Matrix4): Box3;
@@ -3499,13 +3495,13 @@ export class Line3 {
set(start?: Vector3, end?: Vector3): Line3;
clone(): this;
copy(line: this): this;
- getCenter(optionalTarget?: Vector3): Vector3;
- delta(optionalTarget?: Vector3): Vector3;
+ getCenter(target: Vector3): Vector3;
+ delta(target: Vector3): Vector3;
distanceSq(): number;
distance(): number;
- at(t: number, optionalTarget?: Vector3): Vector3;
+ at(t: number, target: Vector3): Vector3;
closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number;
- closestPointToPoint(point: Vector3, clampToLine?: boolean, optionalTarget?: Vector3): Vector3;
+ closestPointToPoint(point: Vector3, clampToLine: boolean, target: Vector3): Vector3;
applyMatrix4(matrix: Matrix4): Line3;
equals(line: Line3): boolean;
}
@@ -3943,12 +3939,12 @@ export class Plane {
negate(): Plane;
distanceToPoint(point: Vector3): number;
distanceToSphere(sphere: Sphere): number;
- projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
- orthoPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
- intersectLine(line: Line3, optionalTarget?: Vector3): Vector3;
+ projectPoint(point: Vector3, target: Vector3): Vector3;
+ orthoPoint(point: Vector3, target: Vector3): Vector3;
+ intersectLine(line: Line3, target: Vector3): Vector3;
intersectsLine(line: Line3): boolean;
intersectsBox(box: Box3): boolean;
- coplanarPoint(optionalTarget?: boolean): Vector3;
+ coplanarPoint(target: Vector3): Vector3;
applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane;
translate(offset: Vector3): Plane;
equals(plane: Plane): boolean;
@@ -4106,21 +4102,21 @@ export class Ray {
set(origin: Vector3, direction: Vector3): Ray;
clone(): this;
copy(ray: this): this;
- at(t: number, optionalTarget?: Vector3): Vector3;
+ at(t: number, target: Vector3): Vector3;
lookAt(v: Vector3): Vector3;
recast(t: number): Ray;
- closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
+ closestPointToPoint(point: Vector3, target: Vector3): Vector3;
distanceToPoint(point: Vector3): number;
distanceSqToPoint(point: Vector3): number;
distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number;
- intersectSphere(sphere: Sphere, optionalTarget?: Vector3): Vector3;
+ intersectSphere(sphere: Sphere, target: Vector3): Vector3;
intersectsSphere(sphere: Sphere): boolean;
distanceToPlane(plane: Plane): number;
- intersectPlane(plane: Plane, optionalTarget?: Vector3): Vector3;
+ intersectPlane(plane: Plane, target: Vector3): Vector3;
intersectsPlane(plane: Plane): boolean;
- intersectBox(box: Box3, optionalTarget?: Vector3): Vector3;
+ intersectBox(box: Box3, target: Vector3): Vector3;
intersectsBox(box: Box3): boolean;
- intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3;
+ intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, target: Vector3): Vector3;
applyMatrix4(matrix4: Matrix4): Ray;
equals(ray: Ray): boolean;
@@ -4156,8 +4152,8 @@ export class Sphere {
intersectsSphere(sphere: Sphere): boolean;
intersectsBox(box: Box3): boolean;
intersectsPlane(plane: Plane): boolean;
- clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
- getBoundingBox(optionalTarget?: Box3): Box3;
+ clampPoint(point: Vector3, target: Vector3): Vector3;
+ getBoundingBox(target: Box3): Box3;
applyMatrix4(matrix: Matrix4): Sphere;
translate(offset: Vector3): Sphere;
equals(sphere: Sphere): boolean;
@@ -4180,17 +4176,17 @@ export class Triangle {
setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): Triangle;
clone(): this;
copy(triangle: this): this;
- area(): number;
- midpoint(optionalTarget?: Vector3): Vector3;
- normal(optionalTarget?: Vector3): Vector3;
- plane(optionalTarget?: Vector3): Plane;
- barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
+ getArea(): number;
+ getMidpoint(target: Vector3): Vector3;
+ getNormal(target: Vector3): Vector3;
+ getPlane(target: Vector3): Plane;
+ getBarycoord(point: Vector3, target: Vector3): Vector3;
containsPoint(point: Vector3): boolean;
- closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
+ closestPointToPoint(point: Vector3, target: Vector3): Vector3;
equals(triangle: Triangle): boolean;
- static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3;
- static barycoordFromPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3, optionalTarget: Vector3): Vector3;
+ static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
+ static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean;
}
@@ -5285,7 +5281,6 @@ export class WebGLRenderer implements Renderer {
};
render: {
calls: number;
- vertices: number;
faces: number;
points: number;
};
@@ -5399,13 +5394,6 @@ export class WebGLRenderer implements Renderer {
*/
render(scene: Scene, camera: Camera, renderTarget?: RenderTarget, forceClear?: boolean): void;
- /**
- * Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering.
- * If cullFace is false, culling will be disabled.
- * @param cullFace "back", "front", "front_and_back", or false.
- * @param frontFace "ccw" or "cw
- */
- setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void;
/**
* @deprecated
*/
@@ -5648,12 +5636,15 @@ export let ShaderChunk: {
lightmap_fragment: string;
lightmap_pars_fragment: string;
lights_lambert_vertex: string;
- lights_pars: string;
+ lights_pars_begin: string;
+ lights_pars_map: string;
lights_phong_fragment: string;
lights_phong_pars_fragment: string;
lights_physical_fragment: string;
lights_physical_pars_fragment: string;
- lights_template: string;
+ lights_fragment_begin: string;
+ lights_fragment_maps: string;
+ lights_fragment_end: string;
logdepthbuf_fragment: string;
logdepthbuf_pars_fragment: string;
logdepthbuf_pars_vertex: string;
@@ -5677,7 +5668,8 @@ export let ShaderChunk: {
morphtarget_vertex: string;
normal_flip: string;
normal_frag: string;
- normal_fragment: string;
+ normal_fragment_begin: string;
+ normal_fragment_maps: string;
normal_vert: string;
normalmap_pars_fragment: string;
packing: string;
@@ -6034,8 +6026,6 @@ export class WebGLShadowMap {
autoUpdate: boolean;
needsUpdate: boolean;
type: ShadowMapType;
- renderReverseSided: boolean;
- renderSingleSided: boolean;
render(scene: Scene, camera: Camera): void;
diff --git a/types/uglifyjs-webpack-plugin/index.d.ts b/types/uglifyjs-webpack-plugin/index.d.ts
new file mode 100644
index 0000000000..fbbb42f3a8
--- /dev/null
+++ b/types/uglifyjs-webpack-plugin/index.d.ts
@@ -0,0 +1,48 @@
+// Type definitions for uglifyjs-webpack-plugin 1.1
+// Project: https://github.com/webpack-contrib/uglifyjs-webpack-plugin
+// Definitions by: Rene Vajkay
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.3
+
+import { Plugin } from 'webpack';
+
+export = UglifyJsPlugin;
+
+declare class UglifyJsPlugin extends Plugin {
+ constructor(options?: UglifyJsPlugin.UglifyJsPluginOptions);
+}
+
+declare namespace UglifyJsPlugin {
+ interface UglifyJsPluginOptions {
+ test?: RegExp | RegExp[];
+ include?: RegExp | RegExp[];
+ exclude?: RegExp | RegExp[];
+ cache?: boolean | string;
+ parallel?: boolean | number;
+ sourceMap?: boolean;
+ uglifyOptions?: UglifyJsOptions;
+ extractComments?: boolean | RegExp | ((node: object, comment: string) => boolean) | ExtractCommentsOptions;
+ warningsFilter?: (source: string) => boolean;
+ }
+
+ interface UglifyJsOptions {
+ ie8?: boolean;
+ ecma?: number;
+ parse?: object;
+ mangle?: boolean | object;
+ output?: object;
+ compress?: boolean | object;
+ warnings?: boolean;
+ toplevel?: boolean;
+ nameCache?: object;
+ keep_classnames?: boolean;
+ keep_fnames?: boolean;
+ safari10?: boolean;
+ }
+
+ interface ExtractCommentsOptions {
+ condition?: RegExp | ((node: object, comment: string) => boolean);
+ filename?: string | ((originalFileName: string) => string);
+ banner?: boolean | string | ((fileName: string) => string);
+ }
+}
diff --git a/types/uglifyjs-webpack-plugin/tsconfig.json b/types/uglifyjs-webpack-plugin/tsconfig.json
new file mode 100644
index 0000000000..793c9d3ca0
--- /dev/null
+++ b/types/uglifyjs-webpack-plugin/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "uglifyjs-webpack-plugin-tests.ts"
+ ]
+}
diff --git a/types/uglifyjs-webpack-plugin/tslint.json b/types/uglifyjs-webpack-plugin/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/uglifyjs-webpack-plugin/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts b/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts
new file mode 100644
index 0000000000..593d31a345
--- /dev/null
+++ b/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts
@@ -0,0 +1,18 @@
+import * as webpack from "webpack";
+import * as UglifyjsWebpackPlugin from "uglifyjs-webpack-plugin";
+
+const compiler = webpack({
+ plugins: [
+ new UglifyjsWebpackPlugin(),
+ ],
+});
+
+const compilerOptions = webpack({
+ plugins: [
+ new UglifyjsWebpackPlugin({
+ cache: false,
+ parallel: true,
+ sourceMap: true,
+ }),
+ ],
+});
diff --git a/types/urijs/index.d.ts b/types/urijs/index.d.ts
index 61f1887948..4e046ec27f 100644
--- a/types/urijs/index.d.ts
+++ b/types/urijs/index.d.ts
@@ -13,6 +13,7 @@ declare namespace uri {
absoluteTo(path: URI): URI;
addFragment(fragment: string): URI;
addQuery(qry: string): URI;
+ addQuery(qry: string, value:any): URI;
addQuery(qry: Object): URI;
addSearch(qry: string): URI;
addSearch(key: string, value:any): URI;
diff --git a/types/urijs/urijs-tests.ts b/types/urijs/urijs-tests.ts
index 231879b94d..f14ba140d3 100644
--- a/types/urijs/urijs-tests.ts
+++ b/types/urijs/urijs-tests.ts
@@ -32,6 +32,12 @@ URI('').setQuery('foo', 'bar');
URI('').setQuery({ foo: 'bar' });
URI('').setSearch('foo', 'bar');
URI('').setSearch({ foo: 'bar' });
+URI('http://example.org/foo/hello.html').addQuery('foo');
+URI('http://example.org/foo/hello.html').addQuery('foo', 'bar');
+URI('http://example.org/foo/hello.html').addQuery({ foo: 'bar' });
+URI('http://example.org/foo/hello.html').addSearch('foo');
+URI('http://example.org/foo/hello.html').addSearch('foo', 'bar');
+URI('http://example.org/foo/hello.html').addSearch({ foo: 'bar' });
var uri: uri.URI = $('a').uri();
diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts
index 8020be7957..235760d47b 100644
--- a/types/webdriverio/index.d.ts
+++ b/types/webdriverio/index.d.ts
@@ -464,8 +464,8 @@ declare namespace WebdriverIO {
run(): Promise;
}
- class ErrorHandler {
- constructor(type: string, msg: string | number);
+ class ErrorHandler extends Error {
+ constructor(type: string, msg: string | number, details?: string);
}
function multiremote(options: MultiRemoteOptions): Client;
diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts
index 2277ec2867..c6f4ae6c12 100644
--- a/types/webpack/index.d.ts
+++ b/types/webpack/index.d.ts
@@ -551,7 +551,7 @@ declare namespace webpack {
/** Give chunks created a name (chunks with equal name are merged) */
name?: boolean | string | ((...args: any[]) => any);
/** Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks) */
- cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | CacheGroupsOptions;
+ cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | { [key: string]: CacheGroupsOptions };
}
interface RuntimeChunkOptions {
/** The name or name factory for the runtime chunks. */
diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts
index 8fe0ab1e4d..f6295d99da 100644
--- a/types/webpack/webpack-tests.ts
+++ b/types/webpack/webpack-tests.ts
@@ -582,6 +582,22 @@ configuration = {
}
};
+configuration = {
+ mode: "production",
+ optimization: {
+ splitChunks: {
+ cacheGroups: {
+ vendor: {
+ chunks: "initial",
+ test: "node_modules",
+ name: "vendor",
+ enforce: true
+ }
+ }
+ }
+ },
+};
+
plugin = new webpack.SplitChunksPlugin({ chunks: "async", minChunks: 2 });
class SingleEntryDependency extends webpack.compilation.Dependency {}