How to use the @nodegui/nodegui.QPixmap function in @nodegui/nodegui

To help you get started, weโ€™ve selected a few @nodegui/nodegui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github irustm / angular-nodegui / projects / angular-nodegui / src / lib / components / image.ts View on Github external
break;
      case 'src':
        if (!value) {
          return;
        }
        getLoadedPixmap(value as string)
        .then(pixmap => this.setPixmap(pixmap))
        .catch(console.warn);

        // TODO: not set current aspect size
        // const size = this.size();
        // this.scalePixmap(size.width, size.height);
        break;

      case 'buffer':
        const pixMap = new QPixmap();
        pixMap.loadFromData(value as Buffer);
        this.setPixmap(pixMap);
        break;

      case 'aspectRatioMode':
        this.setAspectRatioMode(value as AspectRatioMode);
        break;

      default:
        break;
    }
  }
github ng-qt / ng-qt / packages / common / widgets / image / image.widget.ts View on Github external
setSrc(url: string) {
    const pixMap = new QPixmap(url);

    //if (isUrl(url)) {
    // not implemented *facepalm*
    //  pixMap.native.loadFromData(url);
    //} else {
    //  pixMap.load(url);
    //}

    this.setPixmap(pixMap);
    const size = this.size();
    this.scalePixmap(size.width, size.height);
  }
github nodegui / react-nodegui / src / components / Image / RNImage.ts View on Github external
set buffer(imageBuffer: Buffer) {
      const pixMap = new QPixmap();
      pixMap.loadFromData(imageBuffer);
      widget.setPixmap(pixMap);
    },
    set aspectRatioMode(mode: AspectRatioMode) {
github irustm / angular-nodegui / projects / angular-nodegui / src / lib / components / image.ts View on Github external
async function getLoadedPixmap(imageUrlOrPath: string): Promise {
  const pixMap = new QPixmap();
  if (isValidUrl(imageUrlOrPath)) {
    const res = await phin(imageUrlOrPath);
    const imageBuffer = Buffer.from(res.body);
    pixMap.loadFromData(imageBuffer);
  } else {
    pixMap.load(imageUrlOrPath);
  }
  return pixMap;
}
github nodegui / react-nodegui / src / components / Image / RNImage.ts View on Github external
async function getLoadedPixmap(imageUrlOrPath: string): Promise {
  const pixMap = new QPixmap();
  if (isValidUrl(imageUrlOrPath)) {
    const res = await phin(imageUrlOrPath);
    const imageBuffer = Buffer.from(res.body);
    pixMap.loadFromData(imageBuffer);
  } else {
    pixMap.load(imageUrlOrPath);
  }
  return pixMap;
}