Hi all, I implemented the following method in ft2font.cpp, and although it works I don't know if it does the *right thing*.
char FT2Font::draw_rect_filled__doc__[] = "draw_rect_filled(x0, y0, x1, y1)\n" "\n" "Draw a filled rect to the image. It is your responsibility to set the\n" "dimensions of the image, eg, with set_bitmap_size\n" "\n" ; Py::Object FT2Font::draw_rect_filled(const Py::Tuple & args) { _VERBOSE("FT2Font::draw_rect_filled"); args.verify_length(4); long x0 = Py::Int(args[0]); long y0 = Py::Int(args[1]); long x1 = Py::Int(args[2]); long y1 = Py::Int(args[3]); FT_Int iwidth = (FT_Int)image.width; FT_Int iheight = (FT_Int)image.height; if ( x0<0 || y0<0 || x1<0 || y1<0 || x0>iwidth || x1>iwidth || y0>iheight || y1>iheight ) throw Py::ValueError("Rect coords outside image bounds"); for (long j=y0; j<y1; ++j) { for (long i=x0; i<x1+1; ++i) { image.buffer[i + j*iwidth] = 255; } } return Py::Object(); } Basically, I copied the existing draw_rect method and changed the code a bit. The above code draws a filled rectangle in the image buffer. I use it mathtext for drawing a line (for a fraction etc.). What I'm interested is the for loop: for (long j=y0; j<y1; ++j) { for (long i=x0; i<x1+1; ++i) { image.buffer[i + j*iwidth] = 255; } } I'm not sure that this is the right code - probably some pixel isn't getting drawn. Anyone has some ideas? Thanks, Edin ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel