mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 04:11:28 +00:00
Better stream context implementation (holds context)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14408 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ee56045879
commit
83b509bec5
7 changed files with 222 additions and 149 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2002-09-06 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Source/gsc/GSContext.m (-initWithContextInfo:): Fix
|
||||||
|
for GSStreamContext subclass.
|
||||||
|
* Source/GSStreamGState.m: New file.
|
||||||
|
* Source/GSStreamContext.m: Make a subclass of GSContext.
|
||||||
|
Call superclass implementation where appropriate.
|
||||||
|
|
||||||
|
* Source/GSStreamContext.m: Fix for 'show'ing parenthesis
|
||||||
|
characters (patch from Stefan Urbanek).
|
||||||
|
|
||||||
2002-09-01 Adam Fedor <fedor@gnu.org>
|
2002-09-01 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Version: 0.8.1
|
* Version: 0.8.1
|
||||||
|
|
|
@ -26,17 +26,13 @@
|
||||||
#define _GSStreamContext_h_INCLUDE
|
#define _GSStreamContext_h_INCLUDE
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <AppKit/NSGraphicsContext.h>
|
#include "gsc/GSContext.h"
|
||||||
|
|
||||||
@class GSGState;
|
@interface GSStreamContext : GSContext
|
||||||
|
|
||||||
@interface GSStreamContext : NSGraphicsContext
|
|
||||||
{
|
{
|
||||||
FILE *gstream;
|
FILE *gstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GSGState *) currentGState;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* _GSStreamContext_h_INCLUDE */
|
#endif /* _GSStreamContext_h_INCLUDE */
|
||||||
|
|
41
Headers/gsc/GSStreamGState.h
Normal file
41
Headers/gsc/GSStreamGState.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/* GSGStreamState - Implements graphic state drawing for PS stream
|
||||||
|
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Adam Fedor <fedor@gnu.org>
|
||||||
|
Date: Sep 2002
|
||||||
|
|
||||||
|
This file is part of the GNU Objective C User Interface Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GSStreamGState_h_INCLUDE
|
||||||
|
#define _GSStreamGState_h_INCLUDE
|
||||||
|
|
||||||
|
#include <gsc/GSGState.h>
|
||||||
|
|
||||||
|
@interface GSStreamGState : GSGState
|
||||||
|
{
|
||||||
|
@public
|
||||||
|
int clinecap, clinejoin;
|
||||||
|
float clinewidth, cmiterlimit;
|
||||||
|
float cstrokeadjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* _GSStreamGState_h_INCLUDE */
|
||||||
|
|
|
@ -41,6 +41,7 @@ gsc_OBJC_FILES = \
|
||||||
GSContext.m \
|
GSContext.m \
|
||||||
GSGState.m \
|
GSGState.m \
|
||||||
GSStreamContext.m \
|
GSStreamContext.m \
|
||||||
|
GSStreamGState.m \
|
||||||
externs.m
|
externs.m
|
||||||
|
|
||||||
gsc_C_FILES = gscolors.c
|
gsc_C_FILES = gscolors.c
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include "gsc/GSStreamContext.h"
|
#include "gsc/GSStreamContext.h"
|
||||||
#include "gsc/GSGState.h"
|
#include "gsc/GSGState.h"
|
||||||
|
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
#define GSI_ARRAY_TYPES GSUNION_OBJ
|
#define GSI_ARRAY_TYPES GSUNION_OBJ
|
||||||
|
|
||||||
#if GS_WITH_GC == 0
|
#if GS_WITH_GC == 0
|
||||||
|
@ -133,7 +135,8 @@ static unsigned int unique_index = 0;
|
||||||
|
|
||||||
contextType = [info objectForKey:
|
contextType = [info objectForKey:
|
||||||
NSGraphicsContextRepresentationFormatAttributeName];
|
NSGraphicsContextRepresentationFormatAttributeName];
|
||||||
if (contextType && [contextType isEqual: NSGraphicsContextPSFormat])
|
if ([self isMemberOfClass: [GSStreamContext class]] == NO
|
||||||
|
&& contextType && [contextType isEqual: NSGraphicsContextPSFormat])
|
||||||
{
|
{
|
||||||
/* Don't call self, since we aren't initialized */
|
/* Don't call self, since we aren't initialized */
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* -*- C++ -*-
|
/* -*- C++ -*-
|
||||||
GSStreamContext - Drawing context using the XR Library.
|
GSStreamContext - Drawing context to a stream.
|
||||||
|
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1995, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
Written by: Adam Fedor <fedor@gnu.org>
|
||||||
Date: Nov 1995
|
Date: Nov 1995
|
||||||
|
|
||||||
This file is part of the GNU Objective C User Interface Library.
|
This file is part of the GNU Objective C User Interface Library.
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gsc/GSContext.h"
|
#include "gsc/GSContext.h"
|
||||||
#include "gsc/GSStreamContext.h"
|
#include "gsc/GSStreamContext.h"
|
||||||
|
#include "gsc/GSStreamGState.h"
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
|
|
||||||
- initWithContextInfo: (NSDictionary *)info
|
- initWithContextInfo: (NSDictionary *)info
|
||||||
{
|
{
|
||||||
|
[super initWithContextInfo: info];
|
||||||
if (info && [info objectForKey: @"NSOutputFile"])
|
if (info && [info objectForKey: @"NSOutputFile"])
|
||||||
{
|
{
|
||||||
NSString *path = [info objectForKey: @"NSOutputFile"];
|
NSString *path = [info objectForKey: @"NSOutputFile"];
|
||||||
|
@ -71,7 +73,10 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
[super initWithContextInfo: info];
|
/* Create a default gstate */
|
||||||
|
gstate = [[GSStreamGState allocWithZone: [self zone]]
|
||||||
|
initWithDrawContext: self];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,78 +85,42 @@
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GSGState *) currentGState
|
|
||||||
{
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GSStreamContext (Ops)
|
@implementation GSStreamContext (Ops)
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Color operations */
|
/* Color operations */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPScurrentalpha: (float*)a
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentgray: (float*)gray
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPSsetalpha: (float)a
|
- (void) DPSsetalpha: (float)a
|
||||||
{
|
{
|
||||||
|
[super DPSsetalpha: a];
|
||||||
fprintf(gstream, "%g setalpha\n", a);
|
fprintf(gstream, "%g setalpha\n", a);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k
|
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k
|
||||||
{
|
{
|
||||||
|
[super DPSsetcmykcolor: c : m : y : k];
|
||||||
fprintf(gstream, "%g %g %g %g setcmykcolor\n", c, m, y, k);
|
fprintf(gstream, "%g %g %g %g setcmykcolor\n", c, m, y, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetgray: (float)gray
|
- (void) DPSsetgray: (float)gray
|
||||||
{
|
{
|
||||||
|
[super DPSsetgray: gray];
|
||||||
fprintf(gstream, "%g setgray\n", gray);
|
fprintf(gstream, "%g setgray\n", gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b
|
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b
|
||||||
{
|
{
|
||||||
|
[super DPSsethsbcolor: h : s : b];
|
||||||
fprintf(gstream, "%g %g %g sethsbcolor\n", h, s, b);
|
fprintf(gstream, "%g %g %g sethsbcolor\n", h, s, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b
|
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b
|
||||||
{
|
{
|
||||||
|
[super DPSsetrgbcolor: r : g : b];
|
||||||
fprintf(gstream, "%g %g %g setrgbcolor\n", r, g, b);
|
fprintf(gstream, "%g %g %g setrgbcolor\n", r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) GSSetFillColorspace: (NSDictionary *)dict
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetStrokeColorspace: (NSDictionary *)dict
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetFillColor: (float *)values
|
- (void) GSSetFillColor: (float *)values
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
|
@ -168,39 +137,52 @@
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPSashow: (float)x : (float)y : (const char*)s
|
- (void) DPSashow: (float)x : (float)y : (const char*)s
|
||||||
{
|
{
|
||||||
fprintf(gstream, "%g %g (%s) ashow\n", x, y, s);
|
fprintf(gstream, "%g %g (", x, y);
|
||||||
|
[self output:s];
|
||||||
|
fprintf(gstream, ") ashow\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s
|
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s
|
||||||
{
|
{
|
||||||
fprintf(gstream, "%g %g %d %g %g (%s) awidthshow\n", cx, cy, c, ax, ay, s);
|
fprintf(gstream, "%g %g %d %g %g (",cx, cy, c, ax, ay);
|
||||||
|
[self output:s];
|
||||||
|
fprintf(gstream, ") awidthshow\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPScharpath: (const char*)s : (int)b
|
- (void) DPScharpath: (const char*)s : (int)b
|
||||||
{
|
{
|
||||||
fprintf(gstream, "(%s) %d charpath\n", s, b);
|
fprintf(gstream, "(");
|
||||||
|
[self output:s];
|
||||||
|
fprintf(gstream, ") %d charpath\n", b);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSshow: (const char*)s
|
- (void) DPSshow: (const char*)s
|
||||||
{
|
{
|
||||||
fprintf(gstream, "(%s) show\n", s);
|
fprintf(gstream, "(");
|
||||||
|
[self output:s];
|
||||||
|
fprintf(gstream, ") show\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
|
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
|
||||||
{
|
{
|
||||||
fprintf(gstream, "%g %g %d (%s) widthshow\n", x, y, c, s);
|
fprintf(gstream, "%g %g %d (", x, y, c);
|
||||||
|
[self output:s];
|
||||||
|
fprintf(gstream, ") widthshow\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
|
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
|
||||||
{
|
{
|
||||||
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size
|
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size
|
||||||
{
|
{
|
||||||
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size
|
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size
|
||||||
{
|
{
|
||||||
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,33 +204,6 @@
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSAffineTransform *) GSGetTextCTM
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSPoint) GSGetTextPosition
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
return NSMakePoint(0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetTextCTM: (NSAffineTransform *)ctm
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetTextPosition: (NSPoint)loc
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSShowText: (const char *)string : (size_t)length
|
- (void) GSShowText: (const char *)string : (size_t)length
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
|
@ -263,38 +218,38 @@
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Gstate Handling */
|
/* Gstate Handling */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPScurrentgstate: (int)gst
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPSgrestore
|
- (void) DPSgrestore
|
||||||
{
|
{
|
||||||
|
[super DPSgrestore];
|
||||||
fprintf(gstream, "grestore\n");
|
fprintf(gstream, "grestore\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSgsave
|
- (void) DPSgsave
|
||||||
{
|
{
|
||||||
|
[super DPSgsave];
|
||||||
fprintf(gstream, "gsave\n");
|
fprintf(gstream, "gsave\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSgstate
|
- (void) DPSgstate
|
||||||
{
|
{
|
||||||
|
[super DPSgsave];
|
||||||
|
fprintf(gstream, "gstaten");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSinitgraphics
|
- (void) DPSinitgraphics
|
||||||
{
|
{
|
||||||
|
[super DPSinitgraphics];
|
||||||
fprintf(gstream, "initgraphics\n");
|
fprintf(gstream, "initgraphics\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetgstate: (int)gst
|
- (void) DPSsetgstate: (int)gst
|
||||||
{
|
{
|
||||||
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (int) GSDefineGState
|
- (int) GSDefineGState
|
||||||
{
|
{
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
[self notImplemented: _cmd];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,55 +263,9 @@
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) GSCreateGState: (int)gst
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetGState: (int)gst
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Gstate operations */
|
/* Gstate operations */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPScurrentflat: (float*)flatness
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentlinecap: (int*)linecap
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentlinejoin: (int*)linejoin
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentlinewidth: (float*)width
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentmiterlimit: (float*)limit
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentpoint: (float*)x : (float*)y
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPScurrentstrokeadjust: (int*)b
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset
|
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -368,36 +277,43 @@
|
||||||
|
|
||||||
- (void) DPSsetflat: (float)flatness
|
- (void) DPSsetflat: (float)flatness
|
||||||
{
|
{
|
||||||
|
[super DPSsetflat: flatness];
|
||||||
fprintf(gstream, "%g setflat\n", flatness);
|
fprintf(gstream, "%g setflat\n", flatness);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsethalftonephase: (float)x : (float)y
|
- (void) DPSsethalftonephase: (float)x : (float)y
|
||||||
{
|
{
|
||||||
|
[super DPSsethalftonephase: x : y];
|
||||||
fprintf(gstream, "%g %g sethalftonephase\n", x, y);
|
fprintf(gstream, "%g %g sethalftonephase\n", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetlinecap: (int)linecap
|
- (void) DPSsetlinecap: (int)linecap
|
||||||
{
|
{
|
||||||
|
[super DPSsetlinecap: linecap];
|
||||||
fprintf(gstream, "%d setlinecap\n", linecap);
|
fprintf(gstream, "%d setlinecap\n", linecap);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetlinejoin: (int)linejoin
|
- (void) DPSsetlinejoin: (int)linejoin
|
||||||
{
|
{
|
||||||
|
[super DPSsetlinejoin: linejoin];
|
||||||
fprintf(gstream, "%d setlinejoin\n", linejoin);
|
fprintf(gstream, "%d setlinejoin\n", linejoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetlinewidth: (float)width
|
- (void) DPSsetlinewidth: (float)width
|
||||||
{
|
{
|
||||||
|
[super DPSsetlinewidth: width];
|
||||||
fprintf(gstream, "%g setlinewidth\n", width);
|
fprintf(gstream, "%g setlinewidth\n", width);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetmiterlimit: (float)limit
|
- (void) DPSsetmiterlimit: (float)limit
|
||||||
{
|
{
|
||||||
|
[super DPSsetmiterlimit: limit];
|
||||||
fprintf(gstream, "%g setmiterlimit\n", limit);
|
fprintf(gstream, "%g setmiterlimit\n", limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetstrokeadjust: (int)b
|
- (void) DPSsetstrokeadjust: (int)b
|
||||||
{
|
{
|
||||||
|
[super DPSsetstrokeadjust: b];
|
||||||
fprintf(gstream, "%d setstrokeadjust\n", b);
|
fprintf(gstream, "%d setstrokeadjust\n", b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,37 +323,35 @@
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPSconcat: (const float*)m
|
- (void) DPSconcat: (const float*)m
|
||||||
{
|
{
|
||||||
|
[super DPSconcat: m];
|
||||||
fprintf(gstream, "[%g %g %g %g %g %g] concat\n",
|
fprintf(gstream, "[%g %g %g %g %g %g] concat\n",
|
||||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSinitmatrix
|
- (void) DPSinitmatrix
|
||||||
{
|
{
|
||||||
|
[super DPSinitmatrix];
|
||||||
fprintf(gstream, "initmatrix\n");
|
fprintf(gstream, "initmatrix\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSrotate: (float)angle
|
- (void) DPSrotate: (float)angle
|
||||||
{
|
{
|
||||||
|
[super DPSrotate: angle];
|
||||||
fprintf(gstream, "%g rotate\n", angle);
|
fprintf(gstream, "%g rotate\n", angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSscale: (float)x : (float)y
|
- (void) DPSscale: (float)x : (float)y
|
||||||
{
|
{
|
||||||
|
[super DPSscale: x : y];
|
||||||
fprintf(gstream, "%g %g scale\n", x, y);
|
fprintf(gstream, "%g %g scale\n", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPStranslate: (float)x : (float)y
|
- (void) DPStranslate: (float)x : (float)y
|
||||||
{
|
{
|
||||||
|
[super DPStranslate: x : y];
|
||||||
fprintf(gstream, "%g %g translate\n", x, y);
|
fprintf(gstream, "%g %g translate\n", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSAffineTransform *) GSCurrentCTM
|
|
||||||
{
|
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) GSSetCTM: (NSAffineTransform *)ctm
|
- (void) GSSetCTM: (NSAffineTransform *)ctm
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
|
@ -584,28 +498,27 @@
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Window system ops */
|
/* Window system ops */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
- (void) DPScurrentgcdrawable: (void**)gc : (void**)draw : (int*)x : (int*)y
|
- (void) DPScurrentgcdrawable: (void**)gc : (void**)draw : (int*)x : (int*)y
|
||||||
{
|
{
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
NSLog(@"DPSinvalidcontext: getting gcdrawable from stream context");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPScurrentoffset: (int*)x : (int*)y
|
- (void) DPScurrentoffset: (int*)x : (int*)y
|
||||||
{
|
{
|
||||||
NSLog(@"DPSinvalidcontext: getting values from stream context");
|
NSLog(@"DPSinvalidcontext: getting drawable offset from stream context");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetgcdrawable: (void*)gc : (void*)draw : (int)x : (int)y
|
- (void) DPSsetgcdrawable: (void*)gc : (void*)draw : (int)x : (int)y
|
||||||
{
|
{
|
||||||
NSLog(@"DPSinvalidcontext: setting drawable from stream context");
|
NSLog(@"DPSinvalidcontext: setting gcdrawable from stream context");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) DPSsetoffset: (short int)x : (short int)y
|
- (void) DPSsetoffset: (short int)x : (short int)y
|
||||||
{
|
{
|
||||||
NSLog(@"DPSinvalidcontext: setting drawable from stream context");
|
NSLog(@"DPSinvalidcontext: setting drawable offset from stream context");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
108
Source/gsc/GSStreamGState.m
Normal file
108
Source/gsc/GSStreamGState.m
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/* GSStreamGState - PS Stream graphic state
|
||||||
|
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Adam Fedor <fedor@gnu.org>
|
||||||
|
Date: Sep 2002
|
||||||
|
|
||||||
|
This file is part of the GNU Objective C User Interface Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <Foundation/NSObjCRuntime.h>
|
||||||
|
#include <AppKit/NSAffineTransform.h>
|
||||||
|
#include <AppKit/NSBezierPath.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
|
#include <AppKit/NSFont.h>
|
||||||
|
#include <AppKit/NSGraphics.h>
|
||||||
|
#include "gsc/GSContext.h"
|
||||||
|
#include "gsc/GSStreamGState.h"
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
@implementation GSStreamGState
|
||||||
|
|
||||||
|
/* Designated initializer. */
|
||||||
|
- initWithDrawContext: (GSContext *)drawContext
|
||||||
|
{
|
||||||
|
[super initWithDrawContext: drawContext];
|
||||||
|
|
||||||
|
clinecap = 0;
|
||||||
|
clinejoin = 0;
|
||||||
|
clinewidth = 0;
|
||||||
|
cmiterlimit = 0;
|
||||||
|
cstrokeadjust = 0;
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentlinecap: (int*)linecap
|
||||||
|
{
|
||||||
|
if (linecap)
|
||||||
|
*linecap = clinecap;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentlinejoin: (int*)linejoin
|
||||||
|
{
|
||||||
|
if (linejoin)
|
||||||
|
*linejoin = clinejoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentlinewidth: (float*)width
|
||||||
|
{
|
||||||
|
if (width)
|
||||||
|
*width = clinewidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentmiterlimit: (float*)limit
|
||||||
|
{
|
||||||
|
if (limit)
|
||||||
|
*limit = cmiterlimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentstrokeadjust: (int*)b
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
*b = cstrokeadjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPSsetlinecap: (int)linecap
|
||||||
|
{
|
||||||
|
clinecap = linecap;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPSsetlinejoin: (int)linejoin
|
||||||
|
{
|
||||||
|
clinejoin = linejoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPSsetlinewidth: (float)width
|
||||||
|
{
|
||||||
|
clinewidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPSsetmiterlimit: (float)limit
|
||||||
|
{
|
||||||
|
cmiterlimit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPSsetstrokeadjust: (int)b
|
||||||
|
{
|
||||||
|
cstrokeadjust = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue