///
///
///
///
///
///
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://AppStreamCompose?version=1.0' {
// Module dependencies
import type Gio from 'gi://Gio?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
import type AppStream from 'gi://AppStream?version=1.0';
export namespace AppStreamCompose {
/**
* AppStreamCompose-1.0
*/
/**
* A drawing error.
*/
class CanvasError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* Generic failure.
*/
static FAILED: number;
/**
* Drawing operation failed.
*/
static DRAWING: number;
/**
* Issue with font or font selection.
*/
static FONT: number;
/**
* The requested action was not supported.
*/
static UNSUPPORTED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* A metadata composition error.
*/
class ComposeError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* Generic failure.
*/
static FAILED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* Designated state for an icon of a given size.
*/
/**
* Designated state for an icon of a given size.
*/
export namespace IconState {
export const $gtype: GObject.GType;
}
enum IconState {
/**
* Ignore icons of this size.
*/
IGNORED,
/**
* Create cache for the icon, and provide remote link as well.
*/
CACHED_REMOTE,
/**
* Set if the icon should be stored in an icon tarball and be cached locally.
*/
CACHED_ONLY,
/**
* Set if this icon should be stored remotely and fetched on demand.
*/
REMOTE_ONLY,
}
/**
* An image processing error.
*/
class ImageError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* Generic failure.
*/
static FAILED: number;
/**
* The graphic type is not supported.
*/
static UNSUPPORTED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* File format of an image.
*/
/**
* File format of an image.
*/
export namespace ImageFormat {
export const $gtype: GObject.GType;
}
enum ImageFormat {
/**
* Unknown image format.
*/
UNKNOWN,
/**
* PNG format
*/
PNG,
/**
* JPEG format
*/
JPEG,
/**
* GIF format
*/
GIF,
/**
* SVG format
*/
SVG,
/**
* Compressed SVG format
*/
SVGZ,
/**
* WebP format
*/
WEBP,
/**
* AVIF format
*/
AVIF,
/**
* XPM format
*/
XPM,
}
/**
* Builds a global component ID from a component-id
* and a (usually MD5) checksum generated from the component data.
*
* The global-id is used as a global, unique identifier for a component.
* (while the component-ID is local, e.g. for one source).
* Its primary usecase is to identify a media directory on the filesystem which is
* associated with this component.
* @param component_id an AppStream component ID.
* @param checksum a MD5 hashsum as string generated from the component's combined metadata.
*/
function build_component_global_id(component_id: string, checksum: string): string;
function canvas_error_quark(): GLib.Quark;
function compose_error_quark(): GLib.Quark;
/**
* Generate a filename from a web-URL that can be used to store the
* file on disk after download.
* @param url The URL to extract a filename from.
*/
function filename_from_url(url: string): string;
/**
* Register a new hint tag. If a previous tag with the given name
* already existed, the existing tag will not be replaced unless
* `overrideExisting` is set to %TRUE.
* Please be careful when overriding tags! Tag severities can not
* be lowered by overriding a tag.
* @param tag the tag-ID to add
* @param severity the tag severity as #AsIssueSeverity
* @param explanation the tag explanatory message
* @param overrideExisting whether an existing tag should be replaced
* @returns %TRUE if the tag was registered and did not exist previously.
*/
function globals_add_hint_tag(
tag: string,
severity: AppStream.IssueSeverity | null,
explanation: string,
overrideExisting: boolean,
): boolean;
/**
* Clear all global state and restore defaults.
*/
function globals_clear(): void;
/**
* Get path to the "ffprobe" binary we should use.
*/
function globals_get_ffprobe_binary(): string;
/**
* Retrieve all hint tags that we know.
* @returns A list of valid hint tags. Free with %g_strfreev
*/
function globals_get_hint_tags(): string[];
/**
* Get path to the "optipng" binary we should use.
*/
function globals_get_optipng_binary(): string;
/**
* Get temporary directory used by appstream-compose.
*/
function globals_get_tmp_dir(): string;
/**
* Get temporary directory used by appstream-compose
* and try to create it if it does not exist.
*/
function globals_get_tmp_dir_create(): string;
/**
* Get whether images should be optimized using optipng.
*/
function globals_get_use_optipng(): boolean;
/**
* Retrieve the explanation template of the given hint tag.
* @param tag
* @returns An explanation template, or %NULL if the tag was not found.
*/
function globals_hint_tag_explanation(tag: string): string;
/**
* Retrieve the severity of the given hint tag.
* @param tag
* @returns An #AsIssueSeverity or %AS_ISSUE_SEVERITY_UNKNOWN if the tag did not exist or has an unknown severity.
*/
function globals_hint_tag_severity(tag: string): AppStream.IssueSeverity;
/**
* Set path to the "ffprobe" binary we should use.
* @param path
*/
function globals_set_ffprobe_binary(path: string): void;
/**
* Set path to the "optipng" binary we should use.
* @param path
*/
function globals_set_optipng_binary(path: string): void;
/**
* Set temporary directory used by appstream-compose.
* @param path
*/
function globals_set_tmp_dir(path: string): void;
/**
* Set whether images should be optimized using optipng.
* @param enabled
*/
function globals_set_use_optipng(enabled: boolean): void;
/**
* Converts the text representation to an enumerated value.
* @param state_str the string.
* @returns a #AscIconState
*/
function icon_state_from_string(state_str: string): IconState;
/**
* Converts the enumerated value to an text representation.
* @param istate the #AscIconState.
* @returns string version of @istate
*/
function icon_state_to_string(istate: IconState | null): string;
function image_error_quark(): GLib.Quark;
/**
* Returns the image format type based on the given file's filename.
* @param fname the filename.
* @returns a #AscImageFormat or %ASC_IMAGE_FORMAT_UNKNOWN for unknown
*/
function image_format_from_filename(fname: string): ImageFormat;
/**
* Converts the text representation to an enumerated value.
* @param str the string.
* @returns a #AscImageFormat or %ASC_IMAGE_FORMAT_UNKNOWN for unknown
*/
function image_format_from_string(str: string): ImageFormat;
/**
* Converts the enumerated value to an text representation.
* @param format the %AscImageFormat.
* @returns string version of @format
*/
function image_format_to_string(format: ImageFormat | null): string;
/**
* Optimizes a PNG graphic for size with optipng, if its binary
* is available and this feature is enabled.
* @param fname Filename of the PNG image to optimize.
*/
function optimize_png(fname: string): boolean;
function pixbuf_blur(src: GdkPixbuf.Pixbuf, radius: number, iterations: number): void;
function pixbuf_sharpen(src: GdkPixbuf.Pixbuf, radius: number, amount: number): void;
interface CheckMetadataEarlyFn {
(cres: Result, unit: Unit): void;
}
export namespace ComposeFlags {
export const $gtype: GObject.GType;
}
enum ComposeFlags {
NONE,
USE_THREADS,
ALLOW_NET,
VALIDATE,
STORE_SCREENSHOTS,
ALLOW_SCREENCASTS,
PROCESS_FONTS,
PROCESS_TRANSLATIONS,
IGNORE_ICONS,
PROCESS_UNPAIRED_DESKTOP,
PROPAGATE_CUSTOM,
PROPAGATE_ARTIFACTS,
NO_FINAL_CHECK,
NO_PARTIAL_URLS,
}
/**
* The flags used for loading images.
*/
/**
* The flags used for loading images.
*/
export namespace ImageLoadFlags {
export const $gtype: GObject.GType;
}
enum ImageLoadFlags {
/**
* No special flags set
*/
NONE,
/**
* Sharpen the resulting image
*/
SHARPEN,
/**
* Allow loading of unsupported image types.
*/
ALLOW_UNSUPPORTED,
/**
* Always resize the source image to the perfect size
*/
ALWAYS_RESIZE,
}
/**
* The flags used for saving images.
*/
/**
* The flags used for saving images.
*/
export namespace ImageSaveFlags {
export const $gtype: GObject.GType;
}
enum ImageSaveFlags {
/**
* No special flags set
*/
NONE,
/**
* Optimize generated PNG for size
*/
OPTIMIZE,
/**
* Pad with alpha to 16:9 aspect
*/
PAD_16_9,
/**
* Sharpen the image to clarify detail
*/
SHARPEN,
/**
* Blur the image to clear detail
*/
BLUR,
}
namespace Canvas {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
class Canvas extends GObject.Object {
static $gtype: GObject.GType