mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f83850b60 | |||
| 968ad5f196 | |||
| fc95960734 |
@@ -40,7 +40,8 @@ const char* MSE_AUTHORS[] = {
|
|||||||
"Olivier Bocksberger (G-e-n-e-v-e-n-s-i-S)",
|
"Olivier Bocksberger (G-e-n-e-v-e-n-s-i-S)",
|
||||||
"Brendan Hagan (haganbmj)",
|
"Brendan Hagan (haganbmj)",
|
||||||
"Thomas Tkacz (TomTkacz)",
|
"Thomas Tkacz (TomTkacz)",
|
||||||
"CaiCai (247321453)"
|
"CaiCai (247321453)",
|
||||||
|
"Amy Markey (amyinspace)"
|
||||||
};
|
};
|
||||||
|
|
||||||
void AboutWindow::draw(DC& dc) {
|
void AboutWindow::draw(DC& dc) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
|||||||
SetIcon(load_resource_icon(_("app")));
|
SetIcon(load_resource_icon(_("app")));
|
||||||
|
|
||||||
// avoid flicker
|
// avoid flicker
|
||||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
SetBackgroundStyle(wxBG_STYLE_SYSTEM);
|
||||||
|
|
||||||
// initialize menu bar
|
// initialize menu bar
|
||||||
auto menuBar = new wxMenuBar();
|
auto menuBar = new wxMenuBar();
|
||||||
|
|||||||
@@ -78,11 +78,62 @@ MemoryDCP getTempDC(DC& dc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Combine the temporary DCs used in the drawing with the main dc
|
// Combine the temporary DCs used in the drawing with the main dc
|
||||||
void combineBuffers(DC& dc, DC* borders, DC* interior) {
|
void combineBuffers(DC& dc, DC* borders, DC* interior) {
|
||||||
wxSize s = dc.GetSize();
|
if (!borders && !interior) return;
|
||||||
if (borders) dc.Blit(0, 0, s.GetWidth(), s.GetHeight(), borders, 0, 0, wxOR);
|
|
||||||
if (interior) dc.Blit(0, 0, s.GetWidth(), s.GetHeight(), interior, 0, 0, wxAND_INVERT);
|
wxSize size = dc.GetSize();
|
||||||
}
|
int width = size.GetWidth();
|
||||||
|
int height = size.GetHeight();
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
if (borders) dc.Blit(0, 0, width, height, borders, 0, 0, wxOR);
|
||||||
|
if (interior) dc.Blit(0, 0, width, height, interior, 0, 0, wxAND_INVERT);
|
||||||
|
#else
|
||||||
|
// wxOR and wxAND_INVERT are currently only implemented on Windows, so we have to do them manually
|
||||||
|
size_t count = (size_t)width * (size_t)height * 3;
|
||||||
|
|
||||||
|
// Copy base DC into an image
|
||||||
|
Bitmap outBmp(width, height, 24);
|
||||||
|
wxMemoryDC outDC;
|
||||||
|
outDC.SelectObject(outBmp);
|
||||||
|
outDC.Blit(0, 0, width, height, &dc, 0, 0, wxCOPY);
|
||||||
|
outDC.SelectObject(wxNullBitmap);
|
||||||
|
Image outImg = outBmp.ConvertToImage();
|
||||||
|
Byte* outData = outImg.GetData();
|
||||||
|
|
||||||
|
// wxOR border
|
||||||
|
if (borders) {
|
||||||
|
Bitmap borderBmp(width, height, 24);
|
||||||
|
wxMemoryDC borderDC;
|
||||||
|
borderDC.SelectObject(borderBmp);
|
||||||
|
borderDC.Blit(0, 0, width, height, borders, 0, 0, wxCOPY);
|
||||||
|
borderDC.SelectObject(wxNullBitmap);
|
||||||
|
Image borderImg = borderBmp.ConvertToImage();
|
||||||
|
Byte* borderData = borderImg.GetData();
|
||||||
|
for (size_t i = 0; i < count; ++i) {
|
||||||
|
outData[i] = outData[i] | borderData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wxAND_INVERT interior
|
||||||
|
if (interior) {
|
||||||
|
Bitmap interiorBmp(width, height, 24);
|
||||||
|
wxMemoryDC interiorDC;
|
||||||
|
interiorDC.SelectObject(interiorBmp);
|
||||||
|
interiorDC.Blit(0, 0, width, height, interior, 0, 0, wxCOPY);
|
||||||
|
interiorDC.SelectObject(wxNullBitmap);
|
||||||
|
Image interiorImg = interiorBmp.ConvertToImage();
|
||||||
|
Byte* interiorData = interiorImg.GetData();
|
||||||
|
for (size_t i = 0; i < count; ++i) {
|
||||||
|
outData[i] = outData[i] & (Byte)~interiorData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap finalBmp(outImg);
|
||||||
|
dc.DrawBitmap(finalBmp, 0, 0, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SymbolViewer::draw(DC& dc) {
|
void SymbolViewer::draw(DC& dc) {
|
||||||
bool paintedSomething = false;
|
bool paintedSomething = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user