[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Windows Backend
From: |
Christopher Armstrong |
Subject: |
Re: Fwd: Windows Backend |
Date: |
Sun, 13 Aug 2006 16:31:31 +1000 |
It seems that I may have submitted the wrong patch. Some of the stuff
applied to gnustep-back does not work properly, namely the dashed line
functionality. And as claimed in the previous email, it does not do the
font outlines conversions for bezier paths (I may have to revise some of
this code before committing it).
Attached is another patch that should fix the problems that were
supposed to be addressed by my previous patch. It fixes a bug in
-DPSrectstroke:::: and an oversight in -setStyle:.
Cheers
Christopher Armstrong
---
Index: Source/winlib/WIN32GState.m
===================================================================
--- Source/winlib/WIN32GState.m (revision 23266)
+++ Source/winlib/WIN32GState.m (working copy)
@@ -216,7 +216,7 @@
int x;
int y;
NSRect destRect;
- BOOL success;
+ BOOL success = NO;
NSDebugLLog(@"WIN32GState", @"compositeGState: fromRect: %@ toPoint:
%@ op: %d",
NSStringFromRect(sourceRect), NSStringFromPoint(destPoint), op);
@@ -857,18 +857,17 @@
- (void)DPSrectstroke: (float)x : (float)y : (float)w : (float)h
{
NSRect rect = [ctm rectInMatrixSpace: NSMakeRect(x, y, w, h)];
- NSBezierPath *oldPath = path;
- // Samll adjustment so that the line is visible
+ /*// Small adjustment so that the line is visible
if (rect.size.width > 0)
rect.size.width--;
if (rect.size.height > 0)
rect.size.height--;
- rect.origin.y += 1;
+ rect.origin.y += 1;*/
- path = [NSBezierPath bezierPathWithRect: rect];
+ [path appendBezierPathWithRect:rect];
[self DPSstroke];
- path = oldPath;
+
}
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h
@@ -1011,7 +1010,7 @@
// Temporary variables for gathering pen information
float* thePattern = NULL;
DWORD* iPattern = NULL;
- int count = 0;
+ int patternCount = 0;
float phase = 0.0;
SetBkMode(hDC, TRANSPARENT);
@@ -1057,20 +1056,21 @@
}
// 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;
+
// 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];
+ thePattern = objc_malloc(sizeof(float) * patternCount);
+ [path getLineDash:thePattern count:&patternCount phase:&phase];
- iPattern = objc_malloc(sizeof(DWORD) * count);
+ iPattern = objc_malloc(sizeof(DWORD) * patternCount);
int i = 0;
- for (i = 0 ; i < count; i ++)
+ for (i = 0 ; i < patternCount; i ++)
iPattern[i] = (DWORD)thePattern[i];
objc_free(thePattern);
thePattern = NULL;
@@ -1081,7 +1081,7 @@
pen = ExtCreatePen(penStyle | join | cap,
lineWidth,
&br,
- 0, NULL);
+ patternCount, iPattern);
if (iPattern)
{
---
On Sun, 13 Aug 2006 15:25:58 +1000, "Christopher Armstrong"
<carmstrong@fastmail.com.au> said:
> Hi
>
> Great, someone's finally taken a look at this one. I was just about to
> resubmit it, but found that someone's added it already. I also forgot to
> mention, that it contains code that implements a useful NSBezierPath
> method that converts font outlines to a bezier path. Cam be used to clip
> a picture or patterned background to the outline of some text.
>
> May I ask what the "image resizing" issue is? I would like to do some
> more work on the Windows backend and help improve it a little bit. Just
> note that my time is usually limited due to university. Hopefully I can
> help in the area, particularly where GDI or the Win32 API is concerned.
> I also have a GDI+ patch lying around; I can submit that, but I need
> help on fixing up the autoconf stuff to autodetect it. It also requires
> a thin wrapper library that I wrote to support the C++ -> C -> ObjC
> stuff.
>
> Regards
> Christopher Armstrong
> --
> Christopher Armstrong
> carmstrong@fastmail.com.au
>
> --
> http://www.fastmail.fm - IMAP accessible web-mail
>
--
Christopher Armstrong
carmstrong@fastmail.com.au
--
http://www.fastmail.fm - I mean, what is it about a decent email service?