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.
IndexProgramming Questions & HelpSyntax Questions › drawing text to an image
Page Index Toggle Pages: 1
drawing text to an image (Read 376 times)
drawing text to an image
Aug 27th, 2008, 6:25pm
 

This falls into the category of something I am trying to do and not sure if it is possible.

I would like to, essentially, draw text to an "image" (eventually frame by frame using draw()) and then use another image (eventually derived from video) as a mask to show only part of the text.

It seems to me that the built-in text functions write to the screen and there is no way to use them to write to an instance of the image class, desirable if I plan on using the built-in image.mask method. I then looked at the NextText library which for all its greatness, also seems to write to the screen by default.

I am imaginging that two other possible approaches are using Java2D code to write to a Java Image class and see if this can be integrated into an Processing PImage (unlikely? Also not sure about extending with regular Java code) or using OpenGL's text functions. It does seem like an uphill battle because the methods of PImage seem to be fundamentally File based, in contrast to the Java Image paradigm model which allows the Image to be a destination of drawing operations.

Any help would be appreciated, thanks!
Re: drawing text to an image
Reply #1 - Aug 27th, 2008, 11:52pm
 
I can be wrong, but I believe that most drawing functions, like line() or text(), if they apply by default on display, can be used also as methods to the PGraphics class.
Page Index Toggle Pages: 1