DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L1961 Version: 2.0-current sample program: #include <fltk/draw.h> #include <fltk/Image.h> #include <fltk/run.h> #include <fltk/Window.h> #include <cassert> class TestWidget : public fltk::Widget { fltk::Image theImage; public: TestWidget ( int const & xpos , int const & ypos , int const & wide , int const & high , char const * const label=0 ) : Widget(xpos, ypos, wide, high, label) , theImage(fltk::RGB32, 0, 0) { } virtual void draw() { if (theImage.h() != h() || theImage.w() != w()) { theImage.setsize(w(), h()); size_t const bufbytes(4 * h() * w()); uchar * const buffer(new uchar[bufbytes]); std::fill(buffer, buffer + bufbytes, 0xff); { fltk::GSave gsave; theImage.make_current(); //fltk::setcolor(fltk::YELLOW); fltk::setcolor(fltk::CYAN); fltk::fillrect(0, 0, w(), h()); fltk::setcolor(fltk::BLACK); fltk::drawtext ("Hello" , fltk::Rectangle(w(), h()), fltk::ALIGN_WRAP); fltk::drawline(0, 0, w(), h()); uchar * const ptr(readimage (buffer, fltk::RGBA, fltk::Rectangle(w(), h())) ); assert(ptr == buffer); } fltk::drawimage(buffer, fltk::RGBA, fltk::Rectangle(w(), h())); delete [] buffer; } //theImage.draw(fltk::Rectangle(w(), h())); } }; int main ( int argc , char **argv ) { fltk::Window window(40, 40); window.clear_double_buffer(); window.begin(); TestWidget tw(5, 5, 30, 30); window.end(); window.show(argc,argv); return fltk::run(); } Link: http://www.fltk.org/str.php?L1961 Version: 2.0-current _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
