Search found 7 matches

by rybert2
Tue May 22, 2018 7:10 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

Hm, that's why I use wxDCOverlay - to avoid repainting whole screen on every mouse move. This is very strange. There is no reason to use wxMemoryDC without repainting it, wxClientDC causes flicker, wxBufferedDC doesn't work (I have a debugging check: assert "bmpSrc.IsOk() && bmpSrc.HasA...
by rybert2
Mon May 21, 2018 10:39 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

Another problem: when I use wxDCOverlay in this example it flickers: void qCanvas::onMotion(wxMouseEvent &event) { wxClientDC dc( this ); wxDCOverlay dcOver( over, &dc ); dcOver.Clear(); wxPoint pt = event.GetPosition(); wxSize sz = this->GetSize(); if( event.LeftIsDown() ) { wxMemoryDC mdc(...
by rybert2
Fri May 18, 2018 11:21 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

Ok, I have changed my code for something like this: void qCanvas::onMotion(wxMouseEvent &event) { wxClientDC dc( this ); dc.SetPen( wxPen( wxColor(0, 0, 0), 1, wxPENSTYLE_LONG_DASH ) ); wxDCOverlay dcOver( over, &dc ); dcOver.Clear(); if( event.LeftIsDown() ) { wxMemoryDC mdc( *buffer ); mdc...
by rybert2
Fri May 18, 2018 9:24 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

I have done some changes in my code and finally - it works, but not properly. Now I have problem with color. When I draw my bitmaps even with transparent brush the bg color is black. As a solution I made another bitmap (bgBmp), Clear() it with white color and draw on it - works, background is now wh...
by rybert2
Thu May 17, 2018 11:29 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

So i should use wxMemoryDC to draw into a wxBitmap and then redraw whole canvas trigering PaintEvent with Refresh()? Also I would like to make it possible to draw on multiple layers. Should I redraw e. g. some vector with bitmap every time I do any change? Would be problematic since I redraw on ever...
by rybert2
Thu May 17, 2018 10:24 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

Re: wxBufferedDC and Alpha Channel [SOLVED]

//canvas.h #include <wx/wx.h> #include <wx/dcbuffer.h> #include <wx/graphics.h> #include <wx/dcgraph.h> #include <wx/sysopt.h> class qCanvas : public wxPanel { private: wxBitmap* drawing; wxBitmap* drawBuffer; wxPoint initialPoint; void render( wxDC& dc ); public: qCanvas(wxFrame* parent); ~qCa...
by rybert2
Thu May 17, 2018 9:03 am
Forum: C++ Development
Topic: wxBufferedDC and Alpha Channel [SOLVED]
Replies: 15
Views: 654

wxBufferedDC and Alpha Channel [SOLVED]

Hello, I'm trying to write a simple graphics app and I have a problem with drawing to a wxBitmap with wxBufferedDC and alpha channel. Here's some code: //canvas.cpp #include "canvas.h" BEGIN_EVENT_TABLE(qCanvas, wxPanel) EVT_PAINT(qCanvas::onPaint) EVT_LEFT_DOWN(qCanvas::onLeftDown) EVT_LE...

Go to advanced search