diff options
| author | Manolo Gouy <Manolo> | 2016-04-03 06:58:07 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-03 06:58:07 +0000 |
| commit | 9a97fc37fd164225954714d2f68748a8a41a6d08 (patch) | |
| tree | 1a55b63c727c0d1c218f677763d22b494e9aa84c /src | |
| parent | f1ffe2f1fee001ffb3c9327c6c09f5e5d9dc91de (diff) | |
Delete because content is now in Fl_XXX_Screen_Driver.cxx
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11517 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_read_image_mac.cxx | 70 | ||||
| -rw-r--r-- | src/fl_read_image_porting.cxx | 33 | ||||
| -rw-r--r-- | src/fl_read_image_win32.cxx | 120 |
3 files changed, 0 insertions, 223 deletions
diff --git a/src/fl_read_image_mac.cxx b/src/fl_read_image_mac.cxx deleted file mode 100644 index 36f2ad017..000000000 --- a/src/fl_read_image_mac.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// -// "$Id$" -// -// Mac OS image reading routines for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2016 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// http://www.fltk.org/COPYING.php -// -// Please report all bugs and problems on the following page: -// -// http://www.fltk.org/str.php -// - -// -// 'fl_read_image()' - Read an image from the current window or off-screen buffer. -// - -uchar * // O - Pixel buffer or NULL if failed -fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate - int x, // I - Left position - int y, // I - Top position - int w, // I - Width of area to read - int h, // I - Height of area to read - int alpha) { // I - Alpha value for image (0 for none) - uchar *base; - int rowBytes, delta; - if(fl_window == NULL) { // reading from an offscreen buffer - CGContextRef src = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); // get bitmap context - base = (uchar *)CGBitmapContextGetData(src); // get data - if(!base) return NULL; - int sw = CGBitmapContextGetWidth(src); - int sh = CGBitmapContextGetHeight(src); - rowBytes = CGBitmapContextGetBytesPerRow(src); - delta = CGBitmapContextGetBitsPerPixel(src)/8; - if( (sw - x < w) || (sh - y < h) ) return NULL; - } - else { // reading from current window - base = Fl_X::bitmap_from_window_rect(Fl_Window::current(),x,y,w,h,&delta); - if (!base) return NULL; - rowBytes = delta*w; - x = y = 0; - } - // Allocate the image data array as needed... - int d = alpha ? 4 : 3; - if (!p) p = new uchar[w * h * d]; - // Initialize the default colors/alpha in the whole image... - memset(p, alpha, w * h * d); - // Copy the image from the off-screen buffer to the memory buffer. - int idx, idy; // Current X & Y in image - uchar *pdst, *psrc; - for (idy = y, pdst = p; idy < h + y; idy ++) { - for (idx = 0, psrc = base + idy * rowBytes + x * delta; idx < w; idx ++, psrc += delta, pdst += d) { - pdst[0] = psrc[0]; // R - pdst[1] = psrc[1]; // G - pdst[2] = psrc[2]; // B - } - } - if(fl_window != NULL) delete[] base; - return p; -} - - -// -// End of "$Id$". -// diff --git a/src/fl_read_image_porting.cxx b/src/fl_read_image_porting.cxx deleted file mode 100644 index 2b5278ecb..000000000 --- a/src/fl_read_image_porting.cxx +++ /dev/null @@ -1,33 +0,0 @@ -// -// "$Id$" -// -// WIN32 image reading routines for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2010 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// http://www.fltk.org/COPYING.php -// -// Please report all bugs and problems on the following page: -// -// http://www.fltk.org/str.php -// - -#include <config.h> - -// -// 'fl_read_image()' - Read an image from the current window or off-screen buffer. -// - -//uchar *fl_read_image(uchar *p, int x, int y, int w, int h, int alpha) -//{ -// return 0; -//} - - -// -// End of "$Id$". -// diff --git a/src/fl_read_image_win32.cxx b/src/fl_read_image_win32.cxx deleted file mode 100644 index 63159813f..000000000 --- a/src/fl_read_image_win32.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// -// "$Id$" -// -// WIN32 image reading routines for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2016 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// http://www.fltk.org/COPYING.php -// -// Please report all bugs and problems on the following page: -// -// http://www.fltk.org/str.php -// - -static uchar * // O - Pixel buffer or NULL if failed -read_win_rectangle(uchar *p, // I - Pixel buffer or NULL to allocate - int X, // I - Left position - int Y, // I - Top position - int w, // I - Width of area to read - int h, // I - Height of area to read - int alpha) { // I - Alpha value for image (0 for none) - - int d; // Depth of image - - // Allocate the image data array as needed... - d = alpha ? 4 : 3; - - if (!p) p = new uchar[w * h * d]; - - // Initialize the default colors/alpha in the whole image... - memset(p, alpha, w * h * d); - - // Grab all of the pixels in the image... - - // Assure that we are not trying to read non-existing data. If it is so, the - // function should still work, but the out-of-bounds part of the image is - // untouched (initialized with the alpha value or 0 (black), resp.). - - int ww = w; // We need the original width for output data line size - - int shift_x = 0; // X target shift if X modified - int shift_y = 0; // Y target shift if X modified - - if (X < 0) { - shift_x = -X; - w += X; - X = 0; - } - if (Y < 0) { - shift_y = -Y; - h += Y; - Y = 0; - } - - if (h < 1 || w < 1) return p; // nothing to copy - - int line_size = ((3*w+3)/4) * 4; // each line is aligned on a DWORD (4 bytes) - uchar *dib = new uchar[line_size*h]; // create temporary buffer to read DIB - - // fill in bitmap info for GetDIBits - - BITMAPINFO bi; - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biWidth = w; - bi.bmiHeader.biHeight = -h; // negative => top-down DIB - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 24; // 24 bits RGB - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = 0; - bi.bmiHeader.biXPelsPerMeter = 0; - bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - bi.bmiHeader.biClrImportant = 0; - - // copy bitmap from original DC (Window, Fl_Offscreen, ...) - HDC gc = (HDC)fl_graphics_driver->gc(); - HDC hdc = CreateCompatibleDC(gc); - HBITMAP hbm = CreateCompatibleBitmap(gc,w,h); - - int save_dc = SaveDC(hdc); // save context for cleanup - SelectObject(hdc,hbm); // select bitmap - BitBlt(hdc,0,0,w,h,gc,X,Y,SRCCOPY); // copy image section to DDB - - // copy RGB image data to the allocated DIB - - GetDIBits(hdc, hbm, 0, h, dib, (BITMAPINFO *)&bi, DIB_RGB_COLORS); - - // finally copy the image data to the user buffer - - for (int j = 0; j<h; j++) { - const uchar *src = dib + j * line_size; // source line - uchar *tg = p + (j + shift_y) * d * ww + shift_x * d; // target line - for (int i = 0; i<w; i++) { - uchar b = *src++; - uchar g = *src++; - *tg++ = *src++; // R - *tg++ = g; // G - *tg++ = b; // B - if (alpha) - *tg++ = alpha; // alpha - } - } - - // free used GDI and other structures - - RestoreDC(hdc,save_dc); // reset DC - DeleteDC(hdc); - DeleteObject(hbm); - delete[] dib; // delete DIB temporary buffer - - return p; -} - -// -// End of "$Id$". -// |
