summaryrefslogtreecommitdiff
path: root/src/fl_read_image_mac.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-03 06:58:07 +0000
committerManolo Gouy <Manolo>2016-04-03 06:58:07 +0000
commit9a97fc37fd164225954714d2f68748a8a41a6d08 (patch)
tree1a55b63c727c0d1c218f677763d22b494e9aa84c /src/fl_read_image_mac.cxx
parentf1ffe2f1fee001ffb3c9327c6c09f5e5d9dc91de (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/fl_read_image_mac.cxx')
-rw-r--r--src/fl_read_image_mac.cxx70
1 files changed, 0 insertions, 70 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$".
-//