private async _renderBanner()

in client/src/services/image-rendering.ts [131:152]


  private async _renderBanner(context: CanvasRenderingContext2D, width: number, scale: number) {
    const bannerConfig = this.config.banner;
    // draw background
    context.fillStyle = bannerConfig.backgroundColor;
    context.fillRect(0, 0, width, bannerConfig.height * scale);
    // draw logo image
    const logoImage = await ImageRenderingService._loadImage(bannerConfig.logoURL);
    let y = bannerConfig.logoY * scale;
    const logoHeight = bannerConfig.logoHeight * scale;
    const logoScale = logoHeight / logoImage.naturalHeight;
    const logoWidth = logoImage.naturalWidth * logoScale;
    const logoX = width * 0.5 - logoWidth * 0.5;
    context.drawImage(logoImage, logoX, y, logoWidth, logoHeight);
    // draw attribution image
    y += logoHeight + bannerConfig.spacing * scale;
    const attributionImage = await ImageRenderingService._loadImage(bannerConfig.attributionURL);
    const attributionHeight = bannerConfig.attributionHeight * scale;
    const attributionScale = attributionHeight / attributionImage.naturalHeight;
    const attributionWidth = attributionImage.naturalWidth * attributionScale;
    const attributionX = width * 0.5 - attributionWidth * 0.5;
    context.drawImage(attributionImage, attributionX, y, attributionWidth, attributionHeight);
  }