init
This commit is contained in:
commit
42ef2f9674
468 files changed
+645161
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Returns an object created by key-value entries for properties and methods
|
||||
* @param entries An iterable object that contains key-value entries for properties and methods.
|
||||
*/
|
||||
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k: string]: T; };
|
||||
|
||||
/**
|
||||
* Returns an object created by key-value entries for properties and methods
|
||||
* @param entries An iterable object that contains key-value entries for properties and methods.
|
||||
*/
|
||||
fromEntries(entries: Iterable<readonly any[]>): any;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
import { Resource } from './core';
|
||||
import { NativeIcon } from './menu/iconMenuItem';
|
||||
export interface ImageSize {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
/** A type that represents an icon that can be used in menu items. */
|
||||
export type MenuIcon = NativeIcon | string | Image | Uint8Array | ArrayBuffer | number[];
|
||||
/** An RGBA Image in row-major order from top to bottom. */
|
||||
export declare class Image extends Resource {
|
||||
/**
|
||||
* Creates an Image from a resource ID. For internal use only.
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
constructor(rid: number);
|
||||
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
||||
static new(rgba: number[] | Uint8Array | ArrayBuffer, width: number, height: number): Promise<Image>;
|
||||
/**
|
||||
* Creates a new image using the provided bytes by inferring the file format.
|
||||
* If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].
|
||||
*
|
||||
* Only `ico` and `png` are supported (based on activated feature flag).
|
||||
*
|
||||
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
||||
* To enable it, change your Cargo.toml file:
|
||||
* ```toml
|
||||
* [dependencies]
|
||||
* tauri = { version = "...", features = ["...", "image-png"] }
|
||||
* ```
|
||||
*/
|
||||
static fromBytes(bytes: number[] | Uint8Array | ArrayBuffer): Promise<Image>;
|
||||
/**
|
||||
* Creates a new image using the provided path.
|
||||
*
|
||||
* Only `ico` and `png` are supported (based on activated feature flag).
|
||||
*
|
||||
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
||||
* To enable it, change your Cargo.toml file:
|
||||
* ```toml
|
||||
* [dependencies]
|
||||
* tauri = { version = "...", features = ["...", "image-png"] }
|
||||
* ```
|
||||
*/
|
||||
static fromPath(path: string): Promise<Image>;
|
||||
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
||||
rgba(): Promise<Uint8Array>;
|
||||
/** Returns the size of this image. */
|
||||
size(): Promise<ImageSize>;
|
||||
}
|
||||
/**
|
||||
* Transforms image from various types into a type acceptable by Rust.
|
||||
*
|
||||
* See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information.
|
||||
* Note the API signature is not stable and might change.
|
||||
*/
|
||||
export declare function transformImage<T>(image: string | Image | Uint8Array | ArrayBuffer | number[] | null): T;
|
||||
Reference in new issue
Block a user