Skip to content

NullPointerException when background exceeds color range when writing PDF #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
processing-bot opened this issue Jul 6, 2023 · 0 comments

Comments

@processing-bot
Copy link
Collaborator

Created by: clankill3r

Processing 4.2
OSX 10.15.7

When using a background value highter then the color range when recording a pdf, a NullPointerException is thrown:

import processing.pdf.PGraphicsPDF;

void settings() {
  size(1024, 768);
}

public void setup() {
  beginRecord(PDF, "output/cover.pdf");
  colorMode(RGB, 1);
  background(255);
  endRecord();
}

It happens in PGraphicsJava2D on the last line shown here:

  // BACKGROUND


  int[] clearPixels;

  protected void clearPixels(int color) {
    // On a hi-res display, image may be larger than width/height
    int imageWidth = image.getWidth(null);

In some way, it might not be a bug but a mistake by the user for exceeding the range, but yet I feel like it might be a bug as well...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant