diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2004-08-31 00:27:40 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2004-08-31 00:27:40 +0000 |
| commit | 57193e52c0ea34a6af53289b72b232e226466bc1 (patch) | |
| tree | 01532958535af427ce9d473f2b1b739ab501d5ea /src/fl_draw_image_mac.cxx | |
| parent | 62e1ae69768156c1f4db4a7193f74af944ab34f6 (diff) | |
Quartz for FLTK 1.1:
- added pixmap drawing (no masking yet)
- added bitmap drawing
- added line styles (complete)
todo:
- missing refresh (double test, fluid, others)
- missing pixmap mask
- color_chooser has alignment issues
- images scale instead of beeing scissored
- fonts
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3798 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw_image_mac.cxx')
| -rw-r--r-- | src/fl_draw_image_mac.cxx | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx index 5e656b5f3..08820ffd6 100644 --- a/src/fl_draw_image_mac.cxx +++ b/src/fl_draw_image_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_draw_image_mac.cxx,v 1.1.2.7 2004/08/25 00:20:27 matthiaswm Exp $" +// "$Id: fl_draw_image_mac.cxx,v 1.1.2.8 2004/08/31 00:27:40 matthiaswm Exp $" // // MacOS image drawing code for the Fast Light Tool Kit (FLTK). // @@ -58,6 +58,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, { if (!linedelta) linedelta = W*delta; +#ifdef __APPLE_QD__ // theoretically, if the current GPort permits, we could write // directly into it, avoiding the temporary GWorld. For now I // will go the safe way... . @@ -167,7 +168,51 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, } } } - +#elif defined(__APPLE_QUARTZ__) + // following the very save (and very slow) way to write the image into the give port + CGContextSetShouldAntialias(fl_gc, false); + if ( cb ) + { + uchar *tmpBuf = new uchar[ W*4 ]; + for ( int i=0; i<H; i++ ) + { + uchar *src = tmpBuf; + cb( userdata, 0, i, W, tmpBuf ); + for ( int j=0; j<W; j++ ) + { + if ( mono ) + { fl_color( src[0], src[0], src[0] ); src++; } + else + { fl_color( src[0], src[1], src[2] ); src+=4; } + CGContextMoveToPoint(fl_gc, X+j, Y+i); + CGContextAddLineToPoint(fl_gc, X+j, Y+i); + CGContextStrokePath(fl_gc); + } + } + delete[] tmpBuf; + } + else + { + for ( int i=0; i<H; i++ ) + { + const uchar *src = buf+i*linedelta; + for ( int j=0; j<W; j++ ) + { + if ( mono ) + fl_color( src[0], src[0], src[0] ); + else + fl_color( src[0], src[1], src[2] ); + CGContextMoveToPoint(fl_gc, X+j, Y+i); + CGContextAddLineToPoint(fl_gc, X+j, Y+i); + CGContextStrokePath(fl_gc); + src += delta; + } + } + } + CGContextSetShouldAntialias(fl_gc, true); +#else +# error : you must defined __APPLE_QD__ or __APPLE_QUARTZ__ +#endif // \todo Mac : the above function does not support subregions yet #ifdef later_we_do_this // \todo Mac : the following code is taken from fl_draw_image_win32 and needs to be modified for Mac Carbon @@ -279,5 +324,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { } // -// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.7 2004/08/25 00:20:27 matthiaswm Exp $". +// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.8 2004/08/31 00:27:40 matthiaswm Exp $". // |
