mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
The 'Big Whine' patch:
Any use of a file from another package without a declared dependency will give a warning; Also added some more _LOCALE_123_ macros so we need less format_string calls git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@753 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+24
-11
@@ -35,7 +35,7 @@ DECLARE_POINTER_TYPE(PageLayout);
|
||||
*/
|
||||
class TextBufferDC : public wxMemoryDC {
|
||||
public:
|
||||
TextBufferDC(int width, int height);
|
||||
TextBufferDC(int width, int height, bool buffer_text);
|
||||
|
||||
virtual void DoDrawText(const String& str, int x, int y);
|
||||
virtual void DoDrawRotatedText(const String& str, int x, int y, double angle);
|
||||
@@ -62,24 +62,34 @@ class TextBufferDC : public wxMemoryDC {
|
||||
private:
|
||||
vector<TextDrawP> text;
|
||||
Bitmap buffer;
|
||||
bool buffer_text; ///< buffering text?
|
||||
};
|
||||
|
||||
TextBufferDC::TextBufferDC(int width, int height)
|
||||
TextBufferDC::TextBufferDC(int width, int height, bool buffer_text)
|
||||
: buffer(width, height, 32)
|
||||
, buffer_text(buffer_text)
|
||||
{
|
||||
SelectObject(buffer);
|
||||
// initialize to white
|
||||
clearDC(*this,*wxWHITE_BRUSH);
|
||||
}
|
||||
void TextBufferDC::DoDrawText(const String& str, int x, int y) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive7<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str) );
|
||||
if (buffer_text) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive7<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str) );
|
||||
} else {
|
||||
wxMemoryDC::DoDrawText(str,x,y);
|
||||
}
|
||||
}
|
||||
void TextBufferDC::DoDrawRotatedText(const String& str, int x, int y, double angle) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive8<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) );
|
||||
if (buffer_text) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive8<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) );
|
||||
} else {
|
||||
wxMemoryDC::DoDrawRotatedText(str,x,y,angle);
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(TextBufferDC::TextDrawP);
|
||||
@@ -219,13 +229,16 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) {
|
||||
// create buffers
|
||||
int w = stylesheet.card_width, h = stylesheet.card_height; // in pixels
|
||||
if (rotation == 90) swap(w,h);
|
||||
TextBufferDC bufferDC(w,h);
|
||||
RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w,h), 1.0, QUALITY_SUB_PIXEL);
|
||||
// Draw using text buffer
|
||||
//TextBufferDC bufferDC(w,h,true);
|
||||
//RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w,h), 1.0, QUALITY_SUB_PIXEL);
|
||||
TextBufferDC bufferDC(w*4,h*4,false);
|
||||
RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w*4,h*4), 4.0, QUALITY_AA);
|
||||
// render card to dc
|
||||
viewer.setCard(card);
|
||||
viewer.draw(rdc, *wxWHITE);
|
||||
// render buffer to device
|
||||
double px_per_mm = stylesheet.card_dpi / 25.4;
|
||||
double px_per_mm = 4 * stylesheet.card_dpi / 25.4;
|
||||
dc.SetUserScale(scale_x / px_per_mm, scale_y / px_per_mm);
|
||||
dc.SetDeviceOrigin(scale_x * pos.x, scale_y * pos.y);
|
||||
bufferDC.drawToDevice(dc, 0, 0); // adjust for scaling
|
||||
|
||||
Reference in New Issue
Block a user