Mercurial > dwindows
changeset 1523:026c0b4d6ee9
Initial implmentation of DW_DRAW_NOAA on Mac... only works on pixmaps right now.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 31 Dec 2011 17:04:51 +0000 |
parents | c98b2ce2d5b2 |
children | 010e1d916ee7 |
files | dw.h mac/dw.m readme |
diffstat | 3 files changed, 22 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/dw.h Fri Dec 30 21:30:24 2011 +0000 +++ b/dw.h Sat Dec 31 17:04:51 2011 +0000 @@ -1402,11 +1402,11 @@ #define DW_HTML_STOP 5 #define DW_HTML_PRINT 6 -/* Drawing flags... used for Arc currently */ +/* Drawing flags */ #define DW_DRAW_DEFAULT 0 #define DW_DRAW_FILL 1 #define DW_DRAW_FULL (1 << 1) - +#define DW_DRAW_NOAA (1 << 2) /* Macro for casting resource IDs to HICN */ #define DW_RESOURCE(a) (a < 65536 ? (HICN)a : (HICN)0)
--- a/mac/dw.m Fri Dec 30 21:30:24 2011 +0000 +++ b/mac/dw.m Sat Dec 31 17:04:51 2011 +0000 @@ -5267,6 +5267,18 @@ } } +/* Internal function to create an image graphics context... + * with or without antialiasing enabled. + */ +id _create_gc(id image, bool antialiased) +{ + CGContextRef context = (CGContextRef)[[NSGraphicsContext graphicsContextWithBitmapImageRep:image] graphicsPort]; + NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES]; + [gc setShouldAntialias:antialiased]; + CGContextSetAllowsAntialiasing(context, antialiased); + return gc; +} + /* Draw a polygon on a window (preferably a render window). * Parameters: * handle: Handle to the window. @@ -5286,9 +5298,9 @@ if(pixmap) { image = (id)pixmap->image; + id gc = _create_gc(image, flags & DW_DRAW_NOAA ? NO : YES); [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:[[NSGraphicsContext graphicsContextWithBitmapImageRep:image] graphicsPort] flipped:YES]]; + [NSGraphicsContext setCurrentContext:gc]; } else { @@ -5344,9 +5356,9 @@ if(pixmap) { image = (id)pixmap->image; + id gc = _create_gc(image, flags & DW_DRAW_NOAA ? NO : YES); [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:[[NSGraphicsContext graphicsContextWithBitmapImageRep:image] graphicsPort] flipped:YES]]; + [NSGraphicsContext setCurrentContext:gc]; } else { @@ -5404,9 +5416,9 @@ if(pixmap) { image = (id)pixmap->image; + id gc = _create_gc(image, flags & DW_DRAW_NOAA ? NO : YES); [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:[[NSGraphicsContext graphicsContextWithBitmapImageRep:image] graphicsPort] flipped:YES]]; + [NSGraphicsContext setCurrentContext:gc]; } else {
--- a/readme Fri Dec 30 21:30:24 2011 +0000 +++ b/readme Sat Dec 31 17:04:51 2011 +0000 @@ -50,6 +50,8 @@ Several types of widgets have this set by default now. Added faster and less buggy layout engine 2.0 for OS/2, Windows and Mac. Added auto-positioning on Mac; reimplemented auto-positioning on OS/2. +Added DW_DRAW_NOAA which can be passed to dw_draw_*() API functions + that accept the flags parameter to disable anti-aliasing. Fixed auto-sizing top-level windows on Windows; added on OS/2 and Mac. Fixed bubble help not being displayed on Windows. Fixed menu bar items remaining highlighted on Mac.