Fred Kiefer wrote: > What I was planning to do was add a simple (and of course slow) pattern > drawing mechanism for the gsc classes and perhaps overwrite this with a > faster one for the xlib backend. >
I had promissed a simple drawing mechanism, here it is (from GSGState.m): - (NSBezierPath*)clipPath { return nil; } - (void) _fillRect: (NSRect)rect withPattern: (NSImage*)colour_pattern { NSSize size; float x; float y; size = [colour_pattern size]; y = floor(NSMinY(rect) / size.height) * size.height; while (y < NSMaxY(rect)) { x = floor(NSMinX(rect) / size.width) * size.width; while (x < NSMaxX(rect)) { [colour_pattern compositeToPoint: NSMakePoint(x, y) operation: NSCompositeSourceOver]; x += size.width; } y += size.height; } } - (void) fillRect: (NSRect)rect withPattern: (NSImage*)colour_pattern { NSBezierPath *oldPath = path; NSBezierPath *oldClip; oldClip = [self clipPath]; path = [NSBezierPath bezierPathWithRect: rect]; [self DPSclip]; [self _fillRect: rect withPattern: pattern]; path = oldClip; [self DPSclip]; path = oldPath; } - (void) fillPath: (NSBezierPath*)fillPath withPattern: (NSImage*)colour_pattern { NSBezierPath *oldPath = path; NSBezierPath *oldClip; NSRect rect; oldClip = [self clipPath]; rect = [fillPath bounds]; path = fillPath; [self DPSclip]; [self _fillRect: rect withPattern: pattern]; path = oldClip; [self DPSclip]; path = oldPath; } in XGGState.m I then call: if (pattern != nil) { NSRect rect = NSMakeRect(x, y, w, h); [self fillRect: rect withPattern: pattern]; return; } and if (pattern != nil) { [self fillPath: path withPattern: pattern]; return; } All of this works fine. Of course EOFill is currently not supported, but simple to do (would require a call to DPSeoclip instead of DPSclip). And the clipping is what stops me from merging this code into CVS. As I need to change the clipping, and restore it afterwards, I could either implement this separately for each backend and not share any code or implement that clipPath method, used in the current implementation, for all backends. As this method is also not that easy, I could fake it by storing the current clip path in another slot of the GState (and keep the EO state within this path, as we need that as well when reseting the old clip). But perhaps somebody out there has a better idea for this? Cheers Fred _______________________________________________ Gnustep-dev mailing list Gnustep-dev@gnu.org http://lists.gnu.org/mailman/listinfo/gnustep-dev