void text_field::draw_cur(int color, image *screen) { screen->bar(xstart()+cur*wm->font()->width()+1, yend()-2, xstart()+(cur+1)*wm->font()->width(), yend()-1,color); }
void text_field::draw(int active, image *screen) { if (active) { screen->rectangle(xstart(),y,xend(),yend(),wm->bright_color()); draw_cur(wm->bright_color(),screen); } else { screen->rectangle(xstart(),y,xend(),yend(),wm->dark_color()); draw_cur(wm->dark_color(),screen); } }
bool ImageBuf::write (ImageOutput *out, ProgressCallback progress_callback, void *progress_callback_data) const { stride_t as = AutoStride; bool ok = true; if (m_localpixels) { // In-core pixel buffer for the whole image ok = out->write_image (m_spec.format, m_localpixels, as, as, as, progress_callback, progress_callback_data); } else if (deep()) { // Deep image record ok = out->write_deep_image (m_deepdata); } else { // Backed by ImageCache std::vector<char> tmp (m_spec.image_bytes()); get_pixels (xbegin(), xend(), ybegin(), yend(), zbegin(), zend(), m_spec.format, &tmp[0]); ok = out->write_image (m_spec.format, &tmp[0], as, as, as, progress_callback, progress_callback_data); // FIXME -- not good for huge images. Instead, we should read // little bits at a time (scanline or tile blocks). } if (! ok) error ("%s", out->geterror ()); return ok; }
bool ImageBuf::write (ImageOutput *out, ProgressCallback progress_callback, void *progress_callback_data) const { stride_t as = AutoStride; bool ok = true; if (m_localpixels) { ok = out->write_image (m_spec.format, &m_pixels[0], as, as, as, progress_callback, progress_callback_data); } else { std::vector<char> tmp (m_spec.image_bytes()); copy_pixels (xbegin(), xend(), ybegin(), yend(), m_spec.format, &tmp[0]); ok = out->write_image (m_spec.format, &tmp[0], as, as, as, progress_callback, progress_callback_data); // FIXME -- not good for huge images. Instead, we should read // little bits at a time (scanline or tile blocks). } if (! ok) m_err = out->geterror (); return ok; }
void text_field::draw_first(image *screen) { wm->font()->put_string(screen,x,y+3,prompt); screen->bar(xstart(),y,xend(),yend(),wm->dark_color()); wm->font()->put_string(screen,xstart()+1,y+3,data); }
void text_field::area(int &x1, int &y1, int &x2, int &y2) { x1=x; y1=y; x2=xend(); y2=yend(); }