[ wxwindows-Bugs-1695580 ] SetAxisOrientation PaintDC vs GCDC
SourceForge.net
noreply at sourceforge.net
Mon Apr 9 11:21:49 PDT 2007
Bugs item #1695580, was opened at 2007-04-06 13:19
Message generated for change (Comment added) made by chulbe2lsu
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1695580&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: PStevens (pmstevens)
Assigned to: Stefan Csomor (csomor)
Summary: SetAxisOrientation PaintDC vs GCDC
Initial Comment:
Phillip Stevens wrote:
> Hi wxPython-users,
>
> Attached is a small example of using SetAxisOrientation with GCDC,
> and then again with a regular PaintDC.
>
> In the case of using a regular PaintDC, the Y axis is flipped.
> In the case of using the GCDC's PaintDC, the Y axis does not seem to
> flip.
>
> The two cases can be seen by changing USEGCDC = False to True.
>
> Is this a bug,
Probably. Please enter a bug report about it.
----------------------------------------------------------------------
Comment By: cch (chulbe2lsu)
Date: 2007-04-09 18:21
Message:
Logged In: YES
user_id=1327179
Originator: NO
Here's another case I think related to this one. The image is flipped
vertically and the SetDeviceOrigin does not seem to start at the bottom
like on other platforms (e.g. GTK).
#include <wx/wx.h>
static unsigned char colormap[] = {
0, 0, 143, 0, 0, 159, 0, 0, 175, 0, 0, 191, 0, 0, 207, 0, 0, 223, 0,
0, 239,
0, 0, 255, 0, 16, 255, 0, 32, 255, 0, 48, 255, 0, 64, 255, 0, 80, 255,
0, 96, 255, 0, 112, 255, 0, 128, 255, 0, 143, 255, 0, 159, 255, 0,
175, 255,
0, 191, 255, 0, 207, 255, 0, 223, 255, 0, 239, 255, 0, 255, 255, 16,
255, 239,
32, 255, 223, 48, 255, 207, 64, 255, 191, 80, 255, 175, 96, 255, 159,
112, 255, 143, 128, 255, 128, 143, 255, 112, 159, 255, 96, 175, 255,
80,
191, 255, 64, 207, 255, 48, 223, 255, 32, 239, 255, 16, 255, 255, 0,
255, 239, 0, 255, 223, 0, 255, 207, 0, 255, 191, 0, 255, 175, 0, 255,
159, 0,
255, 143, 0, 255, 128, 0, 255, 112, 0, 255, 96, 0, 255, 80, 0, 255,
64, 0,
255, 48, 0, 255, 32, 0, 255, 16, 0, 255, 0, 0, 239, 0, 0, 223, 0, 0,
207, 0, 0, 191, 0, 0, 175, 0, 0, 159, 0, 0, 143, 0, 0, 128, 0, 0
};
class test_wxfile : public wxApp {
virtual bool OnInit();
};
class test_frame : public wxFrame {
public:
test_frame();
void OnPaint(wxPaintEvent &e);
private:
unsigned char rgb_data[3*100];
DECLARE_EVENT_TABLE()
};
IMPLEMENT_APP(test_wxfile);
BEGIN_EVENT_TABLE(test_frame, wxFrame)
EVT_PAINT (test_frame::OnPaint)
END_EVENT_TABLE()
bool
test_wxfile::OnInit()
{
test_frame *f = new test_frame();
SetTopWindow(f);
return true;
}
test_frame::test_frame() :
wxFrame(NULL,-1,"test_frame",wxPoint(-1,-1),wxSize(100,100))
{
double cscl = 64.0 / 100.0;
for (int k = 0; k < 100; k++ ) {
int idx = k*cscl;
rgb_data[3*k ] = colormap[3*idx];
rgb_data[3*k+1] = colormap[3*idx+1];
rgb_data[3*k+2] = colormap[3*idx+2];
}
this->Show(true);
}
void
test_frame::OnPaint(wxPaintEvent &e)
{
wxCoord w,h;
double xscl,yscl;
wxImage img = wxImage(10,10,rgb_data,true);
wxPaintDC *dc = new wxPaintDC(this);
dc->GetSize(&w,&h);
// Set bottom-up and set device origin
dc->SetAxisOrientation(true,true);
dc->SetDeviceOrigin(.25*w,.25*h);
// Scale the image
xscl = static_cast<double>(.5*w) / 11;
yscl = static_cast<double>(.5*h) / 11;
img = img.Scale(11*xscl,11*yscl);
wxBitmap bmp = wxBitmap(img);
dc->DrawBitmap(bmp,0,0,false);
delete dc;
}
----------------------------------------------------------------------
Comment By: Robin Dunn (robind)
Date: 2007-04-06 16:59
Message:
Logged In: YES
user_id=53955
Originator: NO
Not wxPython specific. Reassigning to Stefan.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1695580&group_id=9863
More information about the wx-dev
mailing list