mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-05 21:30:55 +00:00
Some fixups t the previous patch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23273 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cc63b7bec9
commit
d29799d998
2 changed files with 105 additions and 95 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2006-08-13 Christopher Armstrong <carmstrong@fastmail.com.au>
|
||||||
|
|
||||||
|
* Source/winlib/WIN32GState.m: Fixups to last patch
|
||||||
|
|
||||||
2006-08-10 Christopher Armstrong (carmstrong@fastmail.com.au)
|
2006-08-10 Christopher Armstrong (carmstrong@fastmail.com.au)
|
||||||
(patch committed by Greg Casamento)
|
(patch committed by Greg Casamento)
|
||||||
* Source/winlib/WIN32GState.m: Better 24bit image support, Slightly
|
* Source/winlib/WIN32GState.m: Better 24bit image support, Slightly
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: <author name="Fred Kiefer><email>FredKiefer@gmx.de</email></author>
|
Written by: Fred Kiefer <FredKiefer@gmx.de>
|
||||||
Additions by: Christopher Armstrong (carmstrong@fastmail.com.au)
|
Additions by: Christopher Armstrong <carmstrong@fastmail.com.au>
|
||||||
|
|
||||||
Date: March 2002
|
Date: March 2002
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Currently the use of alpha blending is switched off by default.
|
// Currently the use of alpha blending is switched off by default.
|
||||||
|
@ -216,10 +217,11 @@ RECT GSXWindowRectToMS(WIN32GState *s, NSRect r)
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
NSRect destRect;
|
NSRect destRect;
|
||||||
BOOL success;
|
BOOL success = NO;
|
||||||
|
|
||||||
NSDebugLLog(@"WIN32GState", @"compositeGState: fromRect: %@ toPoint: %@ op: %d",
|
NSDebugLLog(@"WIN32GState",
|
||||||
NSStringFromRect(sourceRect), NSStringFromPoint(destPoint), op);
|
@"compositeGState: fromRect: %@ toPoint: %@ op: %d",
|
||||||
|
NSStringFromRect(sourceRect), NSStringFromPoint(destPoint), op);
|
||||||
|
|
||||||
rectFrom = GSViewRectToWin(source, sourceRect);
|
rectFrom = GSViewRectToWin(source, sourceRect);
|
||||||
//rectFrom = GSXWindowRectToMS(sourceRect);
|
//rectFrom = GSXWindowRectToMS(sourceRect);
|
||||||
|
@ -262,7 +264,8 @@ RECT GSXWindowRectToMS(WIN32GState *s, NSRect r)
|
||||||
#ifdef USE_ALPHABLEND
|
#ifdef USE_ALPHABLEND
|
||||||
// Use (0..1) fraction to set a (0..255) alpha constant value
|
// Use (0..1) fraction to set a (0..255) alpha constant value
|
||||||
BYTE SourceConstantAlpha = (BYTE)(delta * 255);
|
BYTE SourceConstantAlpha = (BYTE)(delta * 255);
|
||||||
BLENDFUNCTION blendFunc = {AC_SRC_OVER, 0, SourceConstantAlpha, AC_SRC_ALPHA};
|
BLENDFUNCTION blendFunc
|
||||||
|
= {AC_SRC_OVER, 0, SourceConstantAlpha, AC_SRC_ALPHA};
|
||||||
success = AlphaBlend(hDC,
|
success = AlphaBlend(hDC,
|
||||||
x, y, (rectFrom.right - rectFrom.left), h,
|
x, y, (rectFrom.right - rectFrom.left), h,
|
||||||
sourceDC,
|
sourceDC,
|
||||||
|
@ -344,40 +347,40 @@ RECT GSXWindowRectToMS(WIN32GState *s, NSRect r)
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case NSCompositeClear:
|
case NSCompositeClear:
|
||||||
break;
|
break;
|
||||||
case NSCompositeHighlight:
|
case NSCompositeHighlight:
|
||||||
{
|
{
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
RECT rect = GSViewRectToWin(self, aRect);
|
RECT rect = GSViewRectToWin(self, aRect);
|
||||||
|
|
||||||
hDC = [self getHDC];
|
hDC = [self getHDC];
|
||||||
if (!hDC)
|
if (!hDC)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvertRect(hDC, &rect);
|
InvertRect(hDC, &rect);
|
||||||
[self releaseHDC: hDC];
|
[self releaseHDC: hDC];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NSCompositeCopy:
|
||||||
|
// FIXME
|
||||||
|
case NSCompositeSourceOver:
|
||||||
|
case NSCompositeSourceIn:
|
||||||
|
case NSCompositeSourceOut:
|
||||||
|
case NSCompositeSourceAtop:
|
||||||
|
case NSCompositeDestinationOver:
|
||||||
|
case NSCompositeDestinationIn:
|
||||||
|
case NSCompositeDestinationOut:
|
||||||
|
case NSCompositeDestinationAtop:
|
||||||
|
case NSCompositeXOR:
|
||||||
|
case NSCompositePlusDarker:
|
||||||
|
case NSCompositePlusLighter:
|
||||||
|
default:
|
||||||
|
[self DPSrectfill: NSMinX(aRect) : NSMinY(aRect)
|
||||||
|
: NSWidth(aRect) : NSHeight(aRect)];
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case NSCompositeCopy:
|
|
||||||
// FIXME
|
|
||||||
case NSCompositeSourceOver:
|
|
||||||
case NSCompositeSourceIn:
|
|
||||||
case NSCompositeSourceOut:
|
|
||||||
case NSCompositeSourceAtop:
|
|
||||||
case NSCompositeDestinationOver:
|
|
||||||
case NSCompositeDestinationIn:
|
|
||||||
case NSCompositeDestinationOut:
|
|
||||||
case NSCompositeDestinationAtop:
|
|
||||||
case NSCompositeXOR:
|
|
||||||
case NSCompositePlusDarker:
|
|
||||||
case NSCompositePlusLighter:
|
|
||||||
default:
|
|
||||||
[self DPSrectfill: NSMinX(aRect) : NSMinY(aRect)
|
|
||||||
: NSWidth(aRect) : NSHeight(aRect)];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,10 +400,12 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
||||||
int xres, yres;
|
int xres, yres;
|
||||||
UINT fuColorUse;
|
UINT fuColorUse;
|
||||||
|
|
||||||
if (isPlanar || !([colorSpaceName isEqualToString: NSDeviceRGBColorSpace] ||
|
if (isPlanar
|
||||||
[colorSpaceName isEqualToString: NSCalibratedRGBColorSpace]))
|
|| !([colorSpaceName isEqualToString: NSDeviceRGBColorSpace]
|
||||||
|
|| [colorSpaceName isEqualToString: NSCalibratedRGBColorSpace]))
|
||||||
{
|
{
|
||||||
NSLog(@"Bitmap type currently not supported %d %@", isPlanar, colorSpaceName);
|
NSLog(@"Bitmap type currently not supported %d %@",
|
||||||
|
isPlanar, colorSpaceName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,18 +862,16 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
||||||
- (void)DPSrectstroke: (float)x : (float)y : (float)w : (float)h
|
- (void)DPSrectstroke: (float)x : (float)y : (float)w : (float)h
|
||||||
{
|
{
|
||||||
NSRect rect = [ctm rectInMatrixSpace: NSMakeRect(x, y, w, h)];
|
NSRect rect = [ctm rectInMatrixSpace: NSMakeRect(x, y, w, h)];
|
||||||
NSBezierPath *oldPath = path;
|
|
||||||
|
|
||||||
// Samll adjustment so that the line is visible
|
/* // Samll adjustment so that the line is visible
|
||||||
if (rect.size.width > 0)
|
if (rect.size.width > 0)
|
||||||
rect.size.width--;
|
rect.size.width--;
|
||||||
if (rect.size.height > 0)
|
if (rect.size.height > 0)
|
||||||
rect.size.height--;
|
rect.size.height--;
|
||||||
rect.origin.y += 1;
|
rect.origin.y += 1; */
|
||||||
|
|
||||||
path = [NSBezierPath bezierPathWithRect: rect];
|
[path appendBezierPathWithRect: rect];
|
||||||
[self DPSstroke];
|
[self DPSstroke];
|
||||||
path = oldPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h
|
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h
|
||||||
|
@ -1011,7 +1014,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
||||||
// Temporary variables for gathering pen information
|
// Temporary variables for gathering pen information
|
||||||
float* thePattern = NULL;
|
float* thePattern = NULL;
|
||||||
DWORD* iPattern = NULL;
|
DWORD* iPattern = NULL;
|
||||||
int count = 0;
|
int patternCount = 0;
|
||||||
float phase = 0.0;
|
float phase = 0.0;
|
||||||
|
|
||||||
SetBkMode(hDC, TRANSPARENT);
|
SetBkMode(hDC, TRANSPARENT);
|
||||||
|
@ -1026,68 +1029,71 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
||||||
|
|
||||||
switch (joinStyle)
|
switch (joinStyle)
|
||||||
{
|
{
|
||||||
case NSBevelLineJoinStyle:
|
case NSBevelLineJoinStyle:
|
||||||
join = PS_JOIN_BEVEL;
|
join = PS_JOIN_BEVEL;
|
||||||
break;
|
break;
|
||||||
case NSMiterLineJoinStyle:
|
case NSMiterLineJoinStyle:
|
||||||
join = PS_JOIN_MITER;
|
join = PS_JOIN_MITER;
|
||||||
break;
|
break;
|
||||||
case NSRoundLineJoinStyle:
|
case NSRoundLineJoinStyle:
|
||||||
join = PS_JOIN_ROUND;
|
join = PS_JOIN_ROUND;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
join = PS_JOIN_MITER;
|
join = PS_JOIN_MITER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (lineCap)
|
switch (lineCap)
|
||||||
{
|
{
|
||||||
case NSButtLineCapStyle:
|
case NSButtLineCapStyle:
|
||||||
cap = PS_ENDCAP_FLAT;
|
cap = PS_ENDCAP_FLAT;
|
||||||
break;
|
break;
|
||||||
case NSSquareLineCapStyle:
|
case NSSquareLineCapStyle:
|
||||||
cap = PS_ENDCAP_SQUARE;
|
cap = PS_ENDCAP_SQUARE;
|
||||||
break;
|
break;
|
||||||
case NSRoundLineCapStyle:
|
case NSRoundLineCapStyle:
|
||||||
cap = PS_ENDCAP_ROUND;
|
cap = PS_ENDCAP_ROUND;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cap = PS_ENDCAP_SQUARE;
|
cap = PS_ENDCAP_SQUARE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the size of the pen line dash
|
// Get the size of the pen line dash
|
||||||
[path getLineDash:NULL count:&count phase:NULL];
|
[path getLineDash: NULL count: &patternCount phase: NULL];
|
||||||
|
|
||||||
if (count > 0)
|
if (patternCount > 0)
|
||||||
{
|
{
|
||||||
penStyle = PS_GEOMETRIC | PS_USERSTYLE;
|
penStyle = PS_GEOMETRIC | PS_USERSTYLE;
|
||||||
// The user has defined a dash pattern for stroking on
|
|
||||||
// the path. Note that we lose the floating point information
|
|
||||||
// here, as windows only supports DWORD elements, not float.
|
|
||||||
thePattern = objc_malloc(sizeof(float) * count);
|
|
||||||
[path getLineDash:thePattern count:&count phase:&phase];
|
|
||||||
|
|
||||||
iPattern = objc_malloc(sizeof(DWORD) * count);
|
// The user has defined a dash pattern for stroking on
|
||||||
int i = 0;
|
// the path. Note that we lose the floating point information
|
||||||
for (i = 0 ; i < count; i ++)
|
// here, as windows only supports DWORD elements, not float.
|
||||||
iPattern[i] = (DWORD)thePattern[i];
|
thePattern = objc_malloc(sizeof(float) * patternCount);
|
||||||
objc_free(thePattern);
|
[path getLineDash: thePattern count: &patternCcount phase: &phase];
|
||||||
thePattern = NULL;
|
|
||||||
}
|
iPattern = objc_malloc(sizeof(DWORD) * patternCount);
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0 ; i < patternCount; i ++)
|
||||||
|
iPattern[i] = (DWORD)thePattern[i];
|
||||||
|
objc_free(thePattern);
|
||||||
|
thePattern = NULL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
penStyle = PS_GEOMETRIC | PS_SOLID;
|
{
|
||||||
|
penStyle = PS_GEOMETRIC | PS_SOLID;
|
||||||
|
}
|
||||||
|
|
||||||
pen = ExtCreatePen(penStyle | join | cap,
|
pen = ExtCreatePen(penStyle | join | cap,
|
||||||
lineWidth,
|
lineWidth,
|
||||||
&br,
|
&br,
|
||||||
0, NULL);
|
patternCount, iPattern);
|
||||||
|
|
||||||
if (iPattern)
|
if (iPattern)
|
||||||
{
|
{
|
||||||
objc_free(iPattern);
|
objc_free(iPattern);
|
||||||
iPattern = NULL;
|
iPattern = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldPen = SelectObject(hDC, pen);
|
oldPen = SelectObject(hDC, pen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue