From 690e1c86190a0521bb3f2b644ae6020287e00a79 Mon Sep 17 00:00:00 2001 From: Curtis Hard Date: Sat, 6 Jul 2019 16:55:07 +0100 Subject: [PATCH] visibleColors now also returns if it has patternFills --- .../compuserver_msn_Ford_Focus.svg | 3050 +++++++++++++++++ IJSVGExample/IJSVGExample/test (1).svg | 30 + source/IJSVG.h | 4 +- source/IJSVG.m | 6 +- 4 files changed, 3088 insertions(+), 2 deletions(-) create mode 100644 IJSVGExample/IJSVGExample/compuserver_msn_Ford_Focus.svg create mode 100644 IJSVGExample/IJSVGExample/test (1).svg diff --git a/IJSVGExample/IJSVGExample/compuserver_msn_Ford_Focus.svg b/IJSVGExample/IJSVGExample/compuserver_msn_Ford_Focus.svg new file mode 100644 index 0000000..0547dc8 --- /dev/null +++ b/IJSVGExample/IJSVGExample/compuserver_msn_Ford_Focus.svg @@ -0,0 +1,3050 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IJSVGExample/IJSVGExample/test (1).svg b/IJSVGExample/IJSVGExample/test (1).svg new file mode 100644 index 0000000..5cb3a55 --- /dev/null +++ b/IJSVGExample/IJSVGExample/test (1).svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/IJSVG.h b/source/IJSVG.h index ab789e9..2b3510a 100644 --- a/source/IJSVG.h +++ b/source/IJSVG.h @@ -163,8 +163,10 @@ withSVGString:(NSString *)subSVGString; - (void)beginVectorDraw; - (void)endVectorDraw; +- (NSRect)computeOriginalDrawingFrameWithSize:(NSSize)aSize; + // colors -- (NSArray *)visibleColors; +- (NSArray *)visibleColors:(BOOL *)hasPatternFills; - (void)setReplacementColors:(NSDictionary *)colors; - (void)removeReplacementColor:(NSColor *)color; - (void)replaceColor:(NSColor *)color diff --git a/source/IJSVG.m b/source/IJSVG.m index f35b245..816a6c1 100644 --- a/source/IJSVG.m +++ b/source/IJSVG.m @@ -819,7 +819,7 @@ return [self layerWithTree:renderer]; } -- (NSArray *)visibleColors +- (NSArray *)visibleColors:(BOOL *)hasPatternFills { // set for the colors NSMutableSet * colors = [[[NSMutableSet alloc] init] autorelease]; @@ -843,6 +843,10 @@ [colors addObject:color]; } } + if(sLayer.patternFillLayer != nil || + sLayer.gradientFillLayer != nil) { + *hasPatternFills = YES; + } } };