[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comments on Artlib backend
From: |
Fred Kiefer |
Subject: |
Re: Comments on Artlib backend |
Date: |
Tue, 27 Aug 2002 16:54:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 |
> Currently ARTGState keeps its path in user space (Which is already
>> stated in the code as being a problem). As far as I understand
>> this, it is done to allow for the dash to be adjusted, but this
>> is currently not used. So I dont see any reason for this and we
>> could use the GSGState path methods instead of specific methods
>> here.
>
>
> The main reason is to handle arcs properly. Arcs need to be
> constructed in user space and then translated, so a circle looks
> like an ellipse if user space is scaled differently along the
> axises. ARTGState handles this correctly; GSGState doesn't. Dashes
> and line widths need similar treatment, and ARTGState doesn't do
> this perfectly currently (due to lacking libart support). It does
> handle uniform x/y scaling correctly, though.
>
I missed this, when first implementing all the arc operations. So what
about this solution for GSGState: We implement the arc methods by
creating a new arc in user space and transforming it afterwards.
The code would look like the following and we would move your arct code
to NSBezierPath and just call it from GSGState the same way.
If this is fine for you I will implement it imediatly. The only problem
I see with it is that the current point will be included twice to the
path, but this should not cause real problems.
- (NSPoint) currentPoint
{
NSAffineTransform *ictm;
NSPoint user;
// This is rather slow, but it is not used very often
ictm = [ctm copyWithZone: GSObjCZone(self)];
[ictm invert];
user = [ictm transformPoint: [path currentPoint]];
RELEASE(ictm);
return user;
}
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1 :
(float)angle2
{
NSBezierPath *newPath;
NSPoint current;
CHECK_PATH;
newPath = [NSBezierPath bezierPath];
current = [self currentPoint];
[newPath lineToPoint: current];
[newPath appendBezierPathWithArcWithCenter: NSMakePoint(x, y)
radius: r
startAngle: angle1
endAngle: angle2
clockwise: NO];
[newPath transformUsingAffineTransform: ctm];
[path appendBezierPath: newPath];
}
- Comments on Artlib backend, Fred Kiefer, 2002/08/26
- Re: Comments on Artlib backend, Alexander Malmberg, 2002/08/27
- Re: Comments on Artlib backend, Alexander Malmberg, 2002/08/27
- Re: Comments on Artlib backend, BALATON Zoltan, 2002/08/28
- Re: Comments on Artlib backend, Alexander Malmberg, 2002/08/28
- Re: Comments on Artlib backend, Richard Frith-Macdonald, 2002/08/28
- Re: Comments on Artlib backend, Alexander Malmberg, 2002/08/28
- Re: Comments on Artlib backend, BALATON Zoltan, 2002/08/29