mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
* Headers/gsc/GSGState.h
* Source/gsc/GSContext.m * Source/gsc/GSGState.m * Source/cairo/CairoGState.m Implement per gstate methods for antialias, patternPhase and compositingOperation. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@39026 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4552dff9f1
commit
0f3d255824
5 changed files with 81 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
|||
2015-10-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/gsc/GSGState.h
|
||||
* Source/gsc/GSContext.m
|
||||
* Source/gsc/GSGState.m
|
||||
* Source/cairo/CairoGState.m
|
||||
Implement per gstate methods for antialias, patternPhase and
|
||||
compositingOperation.
|
||||
|
||||
2015-09-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/cairo/CairoGState.m: Preliminary support for anti alias
|
||||
|
|
|
@ -69,6 +69,9 @@ typedef enum {
|
|||
NSAffineTransform *textCtm; /* Text transform - concat with ctm */
|
||||
GSTextDrawingMode textMode;
|
||||
BOOL viewIsFlipped;
|
||||
BOOL _antialias;
|
||||
NSPoint _patternPhase;
|
||||
NSCompositingOperation _compositingOperation;
|
||||
}
|
||||
|
||||
- initWithDrawContext: (GSContext *)context;
|
||||
|
@ -80,6 +83,13 @@ typedef enum {
|
|||
- (void) setColor: (device_color_t *)color state: (color_state_t)cState;
|
||||
- (void) GSSetPatterColor: (NSImage*)image;
|
||||
|
||||
- (void) setShouldAntialias: (BOOL)antialias;
|
||||
- (BOOL) shouldAntialias;
|
||||
- (NSPoint) patternPhase;
|
||||
- (void) setPatternPhase: (NSPoint)phase;
|
||||
- (NSCompositingOperation) compositingOperation;
|
||||
- (void) setCompositingOperation:(NSCompositingOperation) operation;
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
|
|
|
@ -723,8 +723,7 @@ static inline cairo_filter_t cairoFilterFromNSImageInterpolation(NSImageInterpol
|
|||
break;
|
||||
}
|
||||
}
|
||||
// FIXME: Should be part of the state
|
||||
cairo_set_antialias(_ct, [drawcontext shouldAntialias] ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
|
||||
cairo_set_antialias(_ct, [self shouldAntialias] ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
|
||||
}
|
||||
|
||||
- (void) DPSclip
|
||||
|
|
|
@ -254,6 +254,36 @@ static NSMapTable *gtable;
|
|||
return gstate;
|
||||
}
|
||||
|
||||
- (void) setShouldAntialias: (BOOL)antialias
|
||||
{
|
||||
[gstate setShouldAntialias: antialias];
|
||||
}
|
||||
|
||||
- (BOOL) shouldAntialias
|
||||
{
|
||||
return [gstate shouldAntialias];
|
||||
}
|
||||
|
||||
- (NSPoint) patternPhase
|
||||
{
|
||||
return [gstate patternPhase];
|
||||
}
|
||||
|
||||
- (void) setPatternPhase: (NSPoint)phase
|
||||
{
|
||||
[gstate setPatternPhase: phase];
|
||||
}
|
||||
|
||||
- (NSCompositingOperation) compositingOperation
|
||||
{
|
||||
return [gstate compositingOperation];
|
||||
}
|
||||
|
||||
- (void) setCompositingOperation: (NSCompositingOperation)operation
|
||||
{
|
||||
[gstate setCompositingOperation: operation];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GSContext (Ops)
|
||||
|
|
|
@ -143,6 +143,36 @@
|
|||
ASSIGN(pattern, image);
|
||||
}
|
||||
|
||||
- (void) setShouldAntialias: (BOOL)antialias
|
||||
{
|
||||
_antialias = antialias;
|
||||
}
|
||||
|
||||
- (BOOL) shouldAntialias
|
||||
{
|
||||
return _antialias;
|
||||
}
|
||||
|
||||
- (NSPoint) patternPhase
|
||||
{
|
||||
return _patternPhase;
|
||||
}
|
||||
|
||||
- (void) setPatternPhase: (NSPoint)phase
|
||||
{
|
||||
_patternPhase = phase;
|
||||
}
|
||||
|
||||
- (NSCompositingOperation) compositingOperation
|
||||
{
|
||||
return _compositingOperation;
|
||||
}
|
||||
|
||||
- (void) setCompositingOperation: (NSCompositingOperation)operation
|
||||
{
|
||||
_compositingOperation = operation;
|
||||
}
|
||||
|
||||
// This is only a fall back, the method should not be called any more.
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
|
@ -1285,7 +1315,7 @@ typedef enum {
|
|||
[ictm invert];
|
||||
|
||||
size = [color_pattern size];
|
||||
patternPhase = [drawcontext patternPhase];
|
||||
patternPhase = [self patternPhase];
|
||||
|
||||
if (!NSEqualPoints(patternPhase, NSZeroPoint))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue