Skip to content
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

NullPointerException when background exceeds color range when writing PDF #740

Closed
clankill3r opened this issue Jul 6, 2023 · 0 comments
Closed

Comments

@clankill3r
Copy link

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...

@benfry benfry changed the title pdf, NullPointerException when background exceeds it's color range NullPointerException when background exceeds color range when writing PDF Jul 16, 2023
@benfry benfry closed this as completed in fb20a17 Jul 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 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