Preparing search index...

    Represents an image in memory.

    export class PixmapPanel extends PanelPlugin {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.UiPixmapExample';
    d.name = 'Pixmap Example';
    d.defaultDockState = DockState.Detached;
    d.defaultSize = new Size(350, 300);
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    createWidget(parent: Widget): Widget {
    const root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    root.layout = layout;

    const title = new Label(root);
    title.text = 'Pixmap Demo';
    title.fontRole = FontRole.TitleBold;
    layout.addWidget(title);

    // Pixmap holds a pixel image for UI display
    const pixmap = new Pixmap(new Editor.Path('icon.png'));
    pixmap.resize(64, 64);

    const info = new Label(root);
    info.text = 'Pixmap size: ' + pixmap.width + 'x' + pixmap.height;
    layout.addWidget(info);

    // Display the pixmap in an ImageView
    const imageView = new ImageView(root);
    imageView.pixmap = pixmap;
    imageView.scaledContents = true;
    imageView.setFixedWidth(64);
    imageView.setFixedHeight(64);
    layout.addWidget(imageView);

    return root;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    aspectRatioMode: AspectRatioMode

    Controls how the aspect ratio is preserved during resize operations.

    height: number

    Height of the pixmap in pixels.

    transformationMode: TransformationMode

    Controls the transformation quality mode used when scaling the pixmap.

    width: number

    Width of the pixmap in pixels.

    Methods

    • Crops the pixmap to the specified rectangle.

      Parameters

      Returns void

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Loads an image from the given file path.

      Parameters

      Returns void

    • Resizes the pixmap to the specified width and height.

      Parameters

      • width: number
      • height: number

      Returns void

    • Saves the pixmap to the given file path, with optional quality setting.

      Parameters

      • filename: Path
      • Optionalquality: number

      Returns void