96 wxMemoryDC &
Get_DC (
void) {
return( m_dc ); }
98 int Get_Background (
void)
const;
100 bool has_Alpha (
void)
const {
return( m_img_alpha != NULL ); }
102 void SetFont (
const wxFont &Font );
103 void SetPen (
const wxPen &Pen );
104 void SetBrush (
const wxBrush &Brush);
106 void DrawPoint (
int x,
int y);
107 void DrawLine (
int x1,
int y1,
int x2,
int y2);
108 void DrawRectangle (
int x1,
int y1,
int width,
int height);
109 void DrawRectangle (
const wxRect &r);
110 void DrawCircle (
int x,
int y,
int radius);
111 void DrawArc (
int xStart,
int yStart,
int xEnd,
int yEnd,
int xc,
int yc);
112 void DrawPolygon (
int n,
const wxPoint points[],
int xoffset = 0,
int yoffset = 0, wxPolygonFillMode fill_style = wxODDEVEN_RULE);
113 void DrawPolyPolygon (
int n,
const int count[],
const wxPoint points[],
int xoffset = 0,
int yoffset = 0, wxPolygonFillMode fill_style = wxODDEVEN_RULE);
114 void DrawBitmap (
const wxBitmap &bitmap,
int x,
int y,
bool useAlpha =
false);
116 void DrawText (
int Align,
int x,
int y ,
const wxString &Text);
117 void DrawText (
int Align,
int x,
int y,
double Angle,
const wxString &Text);
118 void DrawText (
int Align,
int x,
int y ,
const wxString &Text,
int Effect, wxColour Effect_Color,
int Effect_Size = 1);
119 void DrawText (
int Align,
int x,
int y,
double Angle,
const wxString &Text,
int Effect, wxColour Effect_Color,
int Effect_Size = 1);
122 const double &
Scale (
void)
const {
return( m_Scale ); }
126 const int &
DC_Width (
void)
const {
return( m_rDC.width ); }
127 const int &
DC_Height (
void)
const {
return( m_rDC.height ); }
129 const wxRect &
rDC (
void)
const {
return( m_rDC ); }
131 const double &
World2DC (
void)
const {
return( m_World2DC ); }
142 x = (x - m_rWorld.Get_XMin()) * m_World2DC;
144 return( bRound ? (
int)(x < 0. ? x - 0.5 : x + 0.5) : x );
149 y = (m_rWorld.Get_YMax() - y) * m_World2DC - 1;
151 return( bRound ? (
int)(y < 0. ? y - 0.5 : y + 0.5) : y );
154 const double &
DC2World (
void)
const {
return( m_DC2World ); }
158 return( m_rWorld.Get_XMin() + m_DC2World * x );
163 return( m_rWorld.Get_YMax() - m_DC2World * (y + 1) );
167 void Set_Font (wxFont &Font);
169 wxBitmap Get_Bitmap (
void);
170 bool Get_Bitmap (wxBitmap &Bitmap);
171 bool Get_Image (wxImage &Image );
176 bool Draw_Layer_Begin (
void);
177 bool Draw_Layer_End (
double Transparency = 0.);
182 bool Draw_Image_Begin (
double Transparency, Mode Mode = Mode::Transparent);
183 bool Draw_Image_End (
void);
185 void Draw_Image_Pixels (
int x1,
int y1,
int x2,
int y2,
int Color);
188 if( x >= 0 && x < m_img_nx )
190 _Draw_Image_Pixel(y * m_img_nx + x, Color);
197 BYTE *m_img_rgb { NULL }, *m_img_alpha { NULL };
199 int m_img_nx { 0 }, m_img_ny { 0 }, m_img_nPixels { 0 };
201 Mode m_img_mode { Mode::Opaque };
203 double m_World2DC { 1. }, m_DC2World { 1. }, m_Opacity { 1. }, m_Scale { 1. };
213 wxBitmap m_bmp, m_bmp_alpha, m_bmp_layer;
215 wxMemoryDC m_dc, m_dc_alpha;
219 void _Draw_Image_Pixel (
int i,
int Color)
221 if( i >= 0 && i < m_img_nPixels )
227 case Mode::Opaque:
default: {
228 if( m_img_alpha ) { m_img_alpha[i] = 0xFF; }
232 r = (BYTE)(r * rgb[0] / 255.);
233 g = (BYTE)(g * rgb[1] / 255.);
234 b = (BYTE)(b * rgb[2] / 255.);
236 if( m_img_alpha ) { m_img_alpha[i] = 0xFF; }
239 case Mode::Transparent: {
240 if( m_Opacity <= 0. ) {
return; }
243 r = (BYTE)(r * m_Opacity + (1. - m_Opacity) * rgb[0]);
244 g = (BYTE)(g * m_Opacity + (1. - m_Opacity) * rgb[1]);
245 b = (BYTE)(b * m_Opacity + (1. - m_Opacity) * rgb[2]);
248 if( m_img_alpha ) { m_img_alpha[i] = 0xFF; }
252 double Opacity = m_Opacity *
SG_GET_A(Color) / 255.;
254 if( Opacity <= 0. ) {
return; }
257 r = (BYTE)(r * Opacity + (1. - Opacity) * rgb[0]);
258 g = (BYTE)(g * Opacity + (1. - Opacity) * rgb[1]);
259 b = (BYTE)(b * Opacity + (1. - Opacity) * rgb[2]);
262 if( m_img_alpha && m_img_alpha[i] < 255 )
266 m_img_alpha[i] = 255;
268 else if( m_img_alpha[i] == 0 )
270 m_img_alpha[i] = (BYTE)(Opacity * 255.);
274 m_img_alpha[i] = m_img_alpha[i] + (BYTE)(255 * (1. - m_img_alpha[i] / 255.) * Opacity);