mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
dded partial implementation for pattern colour and alpha image composition.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@21437 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e7240395c
commit
5a70e75973
6 changed files with 119 additions and 25 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2005-07-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/gsc/GSGState.h,
|
||||
Source/gsc/GSGState.m: New methods
|
||||
[-compositeGState:fromRect:toPoint:op:fraction:] and
|
||||
[GSSetPatterColor:]. Also added ivar pattern.
|
||||
* Source/gsc/GSGState.m (-dealloc, -deepen, -setColor:state:):
|
||||
Deal with pattern ivar.
|
||||
* Source/gsc/GSContext.m,
|
||||
Source/gsc/GSStreamContext.m: New methods
|
||||
[-GScomposite:toPoint:fromRect:operation:fraction:] and
|
||||
[-GSSetPatterColor:].
|
||||
* Source/xlib/XGGState.m: New method
|
||||
[-compositeGState:fromRect:toPoint:op:fraction:] use this to
|
||||
implement [-compositeGState:fromRect:toPoint:op:] and
|
||||
[-dissolveGState:fromRect:toPoint:delta:].
|
||||
|
||||
2005-07-04 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Documentation/news.texi: Update.
|
||||
|
|
|
@ -60,6 +60,7 @@ typedef enum {
|
|||
device_color_t fillColor; /* fill color */
|
||||
device_color_t strokeColor; /* stroke color */
|
||||
color_state_t cstate; /* state last time color was set */
|
||||
NSImage *pattern; /* If set, image to draw with */
|
||||
|
||||
float charSpacing;
|
||||
NSAffineTransform *textCtm; /* Text transform - concat with ctm */
|
||||
|
@ -74,6 +75,7 @@ typedef enum {
|
|||
- (NSPoint) offset;
|
||||
|
||||
- (void) setColor: (device_color_t *)color state: (color_state_t)cState;
|
||||
- (void) GSSetPatterColor: (NSImage*)image;
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
|
@ -85,6 +87,12 @@ typedef enum {
|
|||
toPoint: (NSPoint)aPoint
|
||||
delta: (float)delta;
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
op: (NSCompositingOperation)op
|
||||
fraction: (float)delta;
|
||||
|
||||
- (void) compositerect: (NSRect)aRect
|
||||
op: (NSCompositingOperation)op;
|
||||
|
||||
|
|
|
@ -255,6 +255,11 @@ static unsigned int unique_index = 0;
|
|||
[gstate DPSsetrgbcolor:r :g :b];
|
||||
}
|
||||
|
||||
- (void) GSSetPatterColor: (NSImage*)image
|
||||
{
|
||||
[gstate GSSetPatterColor: image];
|
||||
}
|
||||
|
||||
- (void) GSSetFillColorspace: (void *)spaceref
|
||||
{
|
||||
[gstate GSSetFillColorspace: spaceref];
|
||||
|
@ -757,6 +762,27 @@ static unsigned int unique_index = 0;
|
|||
[gstate dissolveGState: g fromRect: rect toPoint: p delta: delta];
|
||||
}
|
||||
|
||||
- (void) GScomposite: (int)gstateNum
|
||||
toPoint: (NSPoint)aPoint
|
||||
fromRect: (NSRect)srcRect
|
||||
operation: (NSCompositingOperation)op
|
||||
fraction: (float)delta
|
||||
{
|
||||
GSGState *g = gstate;
|
||||
|
||||
if (gstateNum)
|
||||
{
|
||||
[self DPSexecuserobject: gstateNum];
|
||||
ctxt_pop(g, opstack, GSGState);
|
||||
}
|
||||
|
||||
[gstate compositeGState: g
|
||||
fromRect: srcRect
|
||||
toPoint: aPoint
|
||||
op: op
|
||||
fraction: delta];
|
||||
}
|
||||
|
||||
- (void) GSDrawImage: (NSRect) rect: (void *) imageref
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSBezierPath.h>
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <GNUstepGUI/GSFontInfo.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include "gsc/GSContext.h"
|
||||
|
@ -90,6 +91,7 @@
|
|||
RELEASE(textCtm);
|
||||
RELEASE(fillColorS);
|
||||
RELEASE(strokeColorS);
|
||||
TEST_RELEASE(pattern);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,8 @@
|
|||
RETAIN(fillColorS);
|
||||
if (strokeColorS != nil)
|
||||
RETAIN(strokeColorS);
|
||||
if (pattern != nil)
|
||||
RETAIN(pattern);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -145,6 +149,12 @@
|
|||
strokeColor = *color;
|
||||
strokeColor.field[AINDEX] = alpha;
|
||||
cstate = cState;
|
||||
DESTROY(pattern);
|
||||
}
|
||||
|
||||
- (void) GSSetPatterColor: (NSImage*)image
|
||||
{
|
||||
ASSIGN(pattern, image);
|
||||
}
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
|
@ -163,6 +173,29 @@
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
op: (NSCompositingOperation)op
|
||||
fraction: (float)delta
|
||||
{
|
||||
if (op == NSCompositeSourceOver)
|
||||
{
|
||||
[self dissolveGState: source
|
||||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
delta: delta];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self compositeGState: source
|
||||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
op: op];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) compositerect: (NSRect)aRect
|
||||
op: (NSCompositingOperation)op
|
||||
{
|
||||
|
@ -948,7 +981,7 @@ typedef enum {
|
|||
- (void) GSSendBezierPath: (NSBezierPath *)newpath
|
||||
{
|
||||
int count = 10;
|
||||
float pattern[10];
|
||||
float dash_pattern[10];
|
||||
float phase;
|
||||
|
||||
// Appending to the current path is a lot faster than copying!
|
||||
|
@ -965,8 +998,8 @@ typedef enum {
|
|||
[self DPSsetmiterlimit: [newpath miterLimit]];
|
||||
[self DPSsetflat: [newpath flatness]];
|
||||
|
||||
[newpath getLineDash: pattern count: &count phase: &phase];
|
||||
[self DPSsetdash: pattern : count : phase];
|
||||
[newpath getLineDash: dash_pattern count: &count phase: &phase];
|
||||
[self DPSsetdash: dash_pattern : count : phase];
|
||||
}
|
||||
|
||||
- (void) GSRectClipList: (const NSRect *)rects : (int) count
|
||||
|
|
|
@ -171,6 +171,10 @@ fpfloat(FILE *stream, float f)
|
|||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) GSSetPatterColor: (NSImage*)image
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Text operations */
|
||||
|
@ -772,6 +776,15 @@ fpfloat(FILE *stream, float f)
|
|||
NSLog(@"DPSinvalidcontext: dissolve in a stream context");
|
||||
}
|
||||
|
||||
- (void) GScomposite: (int)gstateNum
|
||||
toPoint: (NSPoint)aPoint
|
||||
fromRect: (NSRect)srcRect
|
||||
operation: (NSCompositingOperation)op
|
||||
fraction: (float)delta
|
||||
{
|
||||
[self DPScomposite: NSMinX(srcRect) : NSMinY(srcRect) : NSWidth(srcRect) : NSHeight(srcRect)
|
||||
: gstateNum : aPoint.x : aPoint.y : op];
|
||||
}
|
||||
|
||||
- (void) GSDrawImage: (NSRect)rect : (void *)imageref
|
||||
{
|
||||
|
|
|
@ -611,6 +611,7 @@ static Region emptyRegion;
|
|||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
op: (NSCompositingOperation)op
|
||||
fraction: (float)delta
|
||||
{
|
||||
BOOL do_copy, source_alpha;
|
||||
XGCValues comp_gcv;
|
||||
|
@ -734,7 +735,7 @@ static Region emptyRegion;
|
|||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
op: op
|
||||
fraction: 1];
|
||||
fraction: delta];
|
||||
}
|
||||
|
||||
|
||||
|
@ -745,32 +746,28 @@ static Region emptyRegion;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) compositeGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
op: (NSCompositingOperation)op
|
||||
{
|
||||
[self compositeGState: source
|
||||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
op: op
|
||||
fraction: 1.0];
|
||||
}
|
||||
|
||||
- (void) dissolveGState: (GSGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
delta: (float)delta
|
||||
{
|
||||
/* If we have no drawable, we can't proceed. */
|
||||
if (draw == 0)
|
||||
{
|
||||
DPS_WARN(DPSinvalidid, @"No Drawable defined for dissolve");
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldDrawAlpha == NO)
|
||||
{
|
||||
/* No alpha buffers */
|
||||
[self copyBits: (XGGState *)source fromRect: aRect toPoint: aPoint];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self _compositeGState: (XGGState *)source
|
||||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
op: NSCompositeSourceOver
|
||||
fraction: delta];
|
||||
}
|
||||
|
||||
[self compositeGState: source
|
||||
fromRect: aRect
|
||||
toPoint: aPoint
|
||||
op: NSCompositeSourceOver
|
||||
fraction: delta];
|
||||
}
|
||||
|
||||
- (void) compositerect: (NSRect)aRect
|
||||
|
|
Loading…
Reference in a new issue