> As a part of a painting program that I'm trying to make, I need to draw on a > buffer of pixels, not on the screen.Now as far as I've seen the drawing > primitives that FLTK offers, like fl_line(), fl_rectf(), etc. do not have an > overloaded version which allows you to redirect the drawing on an array of > RGB data or something, kinda like this: > fl_line(uchar *image_data, int W, int H, int D, ... other parameters) > where other parameters are parameters needed to tell the function what to > draw.
Have a look onto "offscreen" functions. http://fltk.org/documentation.php/doc-1.1/drawing.html#offscreen I used it so: Fl_Offscreen ofs = fl_create_offscreen(image_w,image_h); fl_begin_offscreen(ofs); fl_color(FL_WHITE); fl_rectf(0,0,image_w,image_h); fl_color(FL_BLACK); fl_rect(01,01,76,29); fl_font(FL_COURIER,12); sprintf(text, "LINGUA %02d", panel+1); fl_draw(text,01,01,76,19,FL_ALIGN_CENTER); if (panels_states[panel].connected) { if (panels_states[panel].caps.width == 0) { pILinguaControl->GetPanelCapabilities(panel+1, &panels_states[panel].caps); } sprintf(text, "v %d %d",(panels_states[panel].caps.version >> 16) & 255, panels_states[panel].caps.version & 0xFFFF); fl_draw(text,01,01,76,39,FL_ALIGN_CENTER); } fl_circle( 117, 10, 3); fl_circle( 117, 26, 3); int i = 0, j = 0; for (i = 0; i < 12; i++) if (buttons_mask & 1 << i) { coords[i].bmp2->draw(coords[i].x, coords[i].y); }else{ coords[i].bmp->draw(coords[i].x, coords[i].y); } uint32_t* buf = (uint32_t*)malloc(image_w * image_h * sizeof(ULONG)); fl_read_image((uchar*)buf, 0, 0, image_w, image_h, 127); uchar* dst = image_text[panel]; for (i = 0; i < image_h; i++) { for (j = 0; j < image_w; j++) { if ((buf[i*image_w + j] & 0xFFFFFF) != 0) *dst++ = 255; else *dst++ = 0; //printf("%c",*(dst-1) ? '*' : ' '); } //printf("\n"); } free(buf); fl_end_offscreen(); fl_delete_offscreen(ofs); _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

