Better initgraphics

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@13638 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-05-13 03:34:47 +00:00
parent c0663fd092
commit 353df3bb6e
4 changed files with 33 additions and 27 deletions

View file

@ -1,5 +1,7 @@
2002-05-12 Adam Fedor <fedor@gnu.org>
* diffing (Index):
* Source/gsc/GSGState.m (-DPSsetalpha:): Call setColor:state:.
Clamp value to 0<x<1
(-DPSsetcmykcolor::::): Idem.
@ -7,15 +9,19 @@
(-DPSsethsbcolor:::):Idem.
(-DPSsetrgbcolor:::):Idem.
(-GSSetFontSize:): Use given size.
(-initWithDrawContext:): Set initial alpha to 1.
(-initWithDrawContext:): Call DPSinitgraphics
(-DPSinitgraphics): Init all our graphics state.
* Source/gsc/gscolors.c (gsHSBToRGB): Fix for h==1.
(gsColorToCMYK): Implement.
(gsColorToHSB): Idem. (Patches from alexander@malmberg.org).
(gsColorToHSB): Idem. (Patches and suggestions from
alexander@malmberg.org, rearranged a little).
* Source/xlib/XGFontManager.m (load_cache): Use NSBundle to find
font_cacher.
* Source/xlib/XGGState.m (GSSetFont:) Rename from setFont.
(-DPSinitgraphics): Call super.
* Source/winlib/WIN32GState.m (-DPSinitgraphics): Call super.
* Tools/GNUmakefile: Build font_cacher if BUILD_GRAPHICS=xlib

View file

@ -72,24 +72,12 @@
[super init];
drawcontext = drawContext;
ctm = [[NSAffineTransform allocWithZone: GSObjCZone(self)] init];
offset = NSMakePoint(0, 0);
path = nil;
font = nil;
/* Initialize colors. By default the same color is used for filling and
stroking unless fill and/or stroke color is set explicitly */
cstate = COLOR_BOTH;
fillColorS = nil;
strokeColorS = nil;
fillColor = gsMakeColor(gray_colorspace, 0, 0, 0, 0);
fillColor.field[AINDEX] = 1.0;
strokeColor = gsMakeColor(gray_colorspace, 0, 0, 0, 0);
strokeColor.field[AINDEX] = 1.0;
charSpacing = 0;
textMode = GSTextFill;
textCtm = [[NSAffineTransform allocWithZone: GSObjCZone(self)] init];
[self DPSinitgraphics];
return self;
}
@ -458,7 +446,28 @@
/* ----------------------------------------------------------------------- */
- (void) DPSinitgraphics
{
[self subclassResponsibility: _cmd];
DESTROY(path);
DESTROY(font);
DESTROY(fillColorS);
DESTROY(strokeColorS);
if (ctm)
[ctm makeIdentityMatrix];
else
ctm = [[NSAffineTransform allocWithZone: GSObjCZone(self)] init];
/* Initialize colors. By default the same color is used for filling and
stroking unless fill and/or stroke color is set explicitly */
fillColor = gsMakeColor(gray_colorspace, 0, 0, 0, 0);
[self setColor: fillColor state: COLOR_BOTH];
fillColor.field[AINDEX] = 1.0;
strokeColor.field[AINDEX] = 1.0;
charSpacing = 0;
textMode = GSTextFill;
if (textCtm)
[textCtm makeIdentityMatrix];
else
textCtm = [[NSAffineTransform allocWithZone: GSObjCZone(self)] init];
}
- (void)DPScurrentflat: (float *)flatness

View file

@ -540,10 +540,7 @@ RECT GSViewRectToWin(WIN32GState *s, NSRect r)
- (void)DPSinitgraphics
{
[ctm makeIdentityMatrix];
DESTROY(path);
fillColor = gsMakeColor(gray_colorspace, 0, 0, 0, 0);
[self setColor: fillColor state: COLOR_BOTH];
[super DPSinitgraphics];
}
- (void) DPSsetdash: (const float*)pattern : (int)count : (float)phase

View file

@ -1415,16 +1415,10 @@ typedef enum {
- (void)DPSinitgraphics
{
[ctm makeIdentityMatrix];
DESTROY(path);
[super DPSinitgraphics];
if (clipregion)
XDestroyRegion(clipregion);
clipregion = 0;
/* FIXME: reset the GC */
fillColor = gsMakeColor(gray_colorspace, 0, 0, 0, 0);
[self setColor: fillColor state: COLOR_BOTH];
fillColor.field[AINDEX] = 1.0;
strokeColor.field[AINDEX] = 1.0;
}
- (void)DPSsetdash: (const float *)pat : (int)size : (float)pat_offset