We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › PGraphics
Page Index Toggle Pages: 1
PGraphics (Read 3355 times)
PGraphics
Apr 19th, 2005, 4:06pm
 
I know from the alpha versions, some people (myself included) discovered, and made use of the BGrpahics object.

Now we have PGraphics, but which requires 3 arguments when creating width,height and "processing.core.PApplet".

However, the only option I could think of to add to the creation call for the third option would be "this" i.e. the parent applet.

Now unfortunately, that doesn't make it work the same as in Alpha versions. Is there a was to create a new PGraphics in the same was as BGraphics? Or is there a new object type that can fill the same role as the old BGraphics?
Re: PGraphics
Reply #1 - Apr 19th, 2005, 4:24pm
 
BGraphics b = new BGraphics(200, 200)
would be done with
PGraphics2 p = new PGraphics2(200, 200, null)

having to include the "2" in there is a temporary thing... i'll add this one to the faq.
Re: PGraphics
Reply #2 - Apr 24th, 2005, 4:14am
 
Code:
java.lang.NullPointerException
     at java.awt.image.BufferedImage.setRGB(Unknown Source)
     at processing.core.PGraphics2.updatePixels(PGraphics2.java:866)


That's what I get when I try to create a PGraphics2 with null as the PApplet (or "this").
Re: PGraphics
Reply #3 - Apr 24th, 2005, 5:01am
 
Calling loadPixels() on the new object seems to stop the error, but it's not drawing anything for me...
Re: PGraphics
Reply #4 - Apr 24th, 2005, 6:24am
 
could you provide a little more code (the minimum, really) that's needed in order to reproduce the error?
Re: PGraphics
Reply #5 - Apr 24th, 2005, 2:39pm
 
Sorry,

Code:
PGraphics2 img = new PGraphics2(220, 176, null);
img.loadPixels();
img.background(0xFF00FF00);
image(img, 0, 0);


I would expect that to draw a 220x176 green box at (0, 0), but it draws nothing.

Using set(0, 0, img); draws a black box at (0, 0), but the color isn't there.
Re: PGraphics
Reply #6 - Apr 24th, 2005, 3:41pm
 
got it, that looks like a bug.

i hadn't tested using new PGraphics objects very thoroughly before beta so i'll look into it and see what's up.
Re: PGraphics
Reply #7 - Jul 28th, 2005, 3:57am
 
k, now filed in the bugs list at:
http://dev.processing.org/bugs/show_bug.cgi?id=92
follow-ups can happen there.
Page Index Toggle Pages: 1