I’m still trying to add correct printing code to Juce.
I’ve almost successfully understood it by now, but there is still something I don’t understand.
Why isn’t RepaintNow in Win32RepaintManager implemented (it is commented out???) ?
Where does the repaint take place ?
So far, from my previous patch I’ve made a LowLevelSoftwarePrinter class that cache text to be drawn in a list.
I’ve added WM_PRINTCLIENT message handler in Win32 and it merely does the handlePaintMessage stuff without clip region checking
Now, I don’t understand how to access/create/modify the Graphics object in the repaint code so I can create one that use my LowLevelSoftwarePrinter renderer.
You don’t want to use the RepaintManager for this - instead, create a Graphics object using the special constructor that takes a LowLevelGraphics object, so something like:
PrintingLowLevelGraphicsContext printContext;
Graphics g (&printContext);
g.drawSomeStuff...
Just one thing I thought of - if you want to paint a component and all its sub-components too, you’d need to call paintContents(), which is private. I might change that method to be public, and give it a more explanatory name for the next release.
Yea, actually drawing to a surface and such is simple, the difficult part I ran into is setting up the printer properties, calling the windows to select options, all such like that, if you find an easy method for dealing with those I would be interested.
OvermindDL1, I’ve send the code to you at 3lefties.com.
To print a component, add “getPeer()->printCurrentComponent()”.
This opens the default windows printer dialog, where you can select your printer and stuff (I highly recommend you don’t use more than 150dpi else you’re going to wait for years).
Your component is printed à la PrintScreen, except for text which is printed using Win32 primitives (hence isn’t 1:1 with juce rendering, but quite close)
Text is above everything.
Actually, could you send it to overminddl1 at gmail dot com. 3lefties is just my messenger login, it is not a real email and I cannot get anything from it.