|
15 | 15 | * * |
16 | 16 | ***************************************************************************/ |
17 | 17 |
|
| 18 | +#include <wx-3.0/wx/graphics.h> |
| 19 | + |
18 | 20 | #include "includefirst.hpp" |
19 | 21 |
|
20 | 22 | #ifdef HAVE_LIBWXWIDGETS |
@@ -192,26 +194,41 @@ unsigned long GDLWXStream::GetWindowDepth() { |
192 | 194 | return wxDisplayDepth(); |
193 | 195 | } |
194 | 196 |
|
| 197 | +// GD removed use of (wrong) plplot erase function |
195 | 198 | void GDLWXStream::Clear() { |
196 | | - PLINT red,green,blue; |
197 | | - DByte r,g,b; |
198 | | - PLINT red0,green0,blue0; |
199 | | - |
200 | | - GraphicsDevice::GetCT()->Get(0,r,g,b);red=r;green=g;blue=b; |
201 | | - |
202 | | - red0=GraphicsDevice::GetDevice()->BackgroundR(); |
203 | | - green0=GraphicsDevice::GetDevice()->BackgroundG(); |
204 | | - blue0=GraphicsDevice::GetDevice()->BackgroundB(); |
205 | | - plstream::scolbg(red0,green0,blue0); //overwrites col[0] |
206 | | - ::c_plbop(); |
207 | | - ::c_plclear(); |
208 | | - plstream::scolbg(red,green,blue); //resets col[0] |
| 199 | + DByte r = (GraphicsDevice::GetDevice()->BackgroundR()); |
| 200 | + DByte g = (GraphicsDevice::GetDevice()->BackgroundG()); |
| 201 | + DByte b = (GraphicsDevice::GetDevice()->BackgroundB()); |
| 202 | + streamDC->SetBackground(wxBrush(wxColour(r,g,b))); |
| 203 | + streamDC->Clear(); |
| 204 | + Update(); //see #1509 |
209 | 205 | } |
210 | 206 |
|
211 | | -//FALSE: REPLACE With Clear(DLong chan) as in X //TBD |
212 | | -void GDLWXStream::Clear(DLong bColor) { |
213 | | - Clear(); |
| 207 | +void GDLWXStream::Clear(DLong chan) { |
| 208 | + DByte r = (GraphicsDevice::GetDevice()->BackgroundR()); |
| 209 | + DByte g = (GraphicsDevice::GetDevice()->BackgroundG()); |
| 210 | + DByte b = (GraphicsDevice::GetDevice()->BackgroundB()); |
| 211 | + wxBitmap bmp=streamDC->GetAsBitmap(); |
| 212 | + wxImage image=bmp.ConvertToImage(); |
| 213 | + unsigned char* pixels=image.GetData(); |
| 214 | + SizeT size=image.GetHeight()*image.GetWidth(); |
| 215 | + DByte* colorComponent=&r; |
| 216 | + switch(chan){ |
| 217 | + case 0: //R |
| 218 | + colorComponent=&r; |
| 219 | + break; |
| 220 | + case 1: |
| 221 | + colorComponent=&g; |
| 222 | + break; |
| 223 | + case 2: |
| 224 | + colorComponent=&b; |
| 225 | + break; |
| 226 | + } |
| 227 | + for (auto i=0; i<size; ++i) pixels[3*i+chan]=*colorComponent; |
| 228 | + streamDC->DrawBitmap(wxBitmap(image,3),0,0); |
| 229 | + Update(); //see #1509 |
214 | 230 | } |
| 231 | + |
215 | 232 | #include <wx/rawbmp.h> |
216 | 233 | bool GDLWXStream::PaintImage(unsigned char *idata, PLINT nx, PLINT ny, DLong *pos, |
217 | 234 | DLong trueColorOrder, DLong chan) { |
|
0 commit comments