+2005-08-30 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ * Scripts/build-svg2png: Removed.
+ * svg2png/ImageDiff.h: Removed.
+ * svg2png/ImageDiff.m: Removed.
+ * svg2png/svg2png.m: Removed.
+ * svg2png/svg2png.xcodeproj/project.pbxproj: Removed.
+ * svg2png/svg2png_Prefix.pch: Removed.
+ svg2png is no longer needed.
+
2005-08-30 Darin Adler <darin@apple.com>
* Scripts/check-dom-results: Special case 100% to say something nice.
+++ /dev/null
-#!/usr/bin/perl -w
-
-# Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# Simplified build script for WebKit Open Source Project.
-# Modified copy of build-dumprendertree. Perhaps these could share code.
-
-use strict;
-use FindBin;
-use lib $FindBin::Bin;
-use webkitdirs;
-
-checkRequiredSystemConfig();
-setConfiguration();
-chdirWebKit();
-my @options = XcodeOptions();
-
-# Check to see that all the frameworks are built.
-checkSVGFrameworks();
-
-# Build
-chdir "WebKitTools/svg2png" or die;
-exit system "xcodebuild", "-project", "svg2png.xcodeproj", @options;
+++ /dev/null
-/*
- * Copyright (C) 2005 Ben La Monica <ben.lamonica@gmail.com>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// prototypes
-NSBitmapImageRep *getDifferenceBitmap(NSBitmapImageRep *testBitmap, NSBitmapImageRep *referenceBitmap);
-float computePercentageDifferent(NSBitmapImageRep *diffBitmap);
-void saveAnimatedGIFToFile(NSBitmapImageRep *firstFrame, NSBitmapImageRep *secondFrame, NSString *animatedGIFPath);
+++ /dev/null
-/*
- * Copyright (C) 2005 Ben La Monica <ben.lamonica@gmail.com>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <QuartzCore/CIFilter.h>
-#import <QuartzCore/CIImage.h>
-#import <QuartzCore/CIContext.h>
-#import <AppKit/NSBitmapImageRep.h>
-#import <AppKit/NSGraphicsContext.h>
-#import <AppKit/NSCIImageRep.h>
-
-#import "ImageDiff.h"
-
-/**
- * Takes a bitmap and performs a difference blend with a reference
- * image. If the images are exactly the same, the diffBitmap will
- * be solid black.
- *
- * It will write this difference blended bitmap to a file.
- *
- * Returns the difference bitmap
- */
-NSBitmapImageRep *getDifferenceBitmap(NSBitmapImageRep *testBitmap, NSBitmapImageRep *referenceBitmap)
-{
- // create a new graphics context to draw our CIImage on
- NSBitmapImageRep *diffBitmap = [testBitmap copy];
- NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:diffBitmap];
- CIImage *referenceImage = [[CIImage alloc] initWithBitmapImageRep:referenceBitmap];
- CIImage *testImage = [[CIImage alloc] initWithBitmapImageRep:testBitmap];
- CIImage *diffImage = nil;
- CIFilter *diffBlend = [CIFilter filterWithName:@"CIDifferenceBlendMode"];
-
- // generate the diff image
- [diffBlend setValue:referenceImage forKey:@"inputImage"];
- [diffBlend setValue:testImage forKey:@"inputBackgroundImage"];
- diffImage = [diffBlend valueForKey:@"outputImage"];
-
- // prepare to draw the image, save current state
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext: nsContext];
-
- // draw the difference image
- [[nsContext CIContext] drawImage:diffImage atPoint:CGPointZero fromRect:[diffImage extent]];
-
- // restore the previous context and state
- [NSGraphicsContext restoreGraphicsState];
-
- [referenceImage release];
- [testImage release];
-
- return diffBitmap;
-}
-
-/**
- * Counts the number of non-black pixels, and returns the percentage
- * of non-black pixels to total pixels in the image.
- */
-float computePercentageDifferent(NSBitmapImageRep *diffBitmap)
-{
- int totalPixels = [diffBitmap pixelsHigh] * [diffBitmap pixelsWide];
- int totalBytes = [diffBitmap bytesPerPlane];
- unsigned char *bitmapData = [diffBitmap bitmapData];
- int differences = 0;
-
- // NOTE: This may not be safe when switching between ENDIAN types
- for (int i = 0; i < totalBytes; i += 4) {
- if (*(bitmapData + i) != 0 || *(bitmapData + i + 1) != 0 || *(bitmapData + i + 2) != 0)
- differences++;
- }
-
- return (differences * 100.0)/totalPixels;
-}
-
-/**
- * Takes two images and places them in an animated GIF that repeats with a 2 second delay
- */
-void saveAnimatedGIFToFile(NSBitmapImageRep *firstFrame, NSBitmapImageRep *secondFrame, NSString *animatedGIFPath)
-{
- // options to set the delay on each frame of 2 seconds
- NSDictionary *frameProperties = [NSDictionary
- dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:2] forKey:(NSString *) kCGImagePropertyGIFDelayTime]
- forKey:(NSString *) kCGImagePropertyGIFDictionary];
-
- // options to turn on looping for the GIF
- NSDictionary *gifProperties = [NSDictionary
- dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:0] forKey:(NSString *) kCGImagePropertyGIFLoopCount]
- forKey:(NSString *) kCGImagePropertyGIFDictionary];
-
- // set the place to save the GIF to
- CGImageDestinationRef animatedGIF = CGImageDestinationCreateWithURL(
- (CFURLRef) [NSURL fileURLWithPath:animatedGIFPath],
- kUTTypeGIF,
- 2, // two images in this GIF
- NULL
- );
-
- // get the data for the first frame
- CGDataProviderRef firstFrameProvider = CGDataProviderCreateWithData(
- NULL,
- [firstFrame bitmapData],
- [firstFrame bytesPerRow] * [firstFrame pixelsHigh],
- NULL
- );
-
- // create a CGImage for the first frame
- CGImageRef cgFirstFrame = CGImageCreate (
- [firstFrame pixelsWide],
- [firstFrame pixelsHigh],
- [secondFrame bitsPerPixel] / [secondFrame samplesPerPixel],
- [firstFrame bitsPerPixel],
- [firstFrame bytesPerRow],
- CGColorSpaceCreateDeviceRGB(),
- kCGImageAlphaNone,
- firstFrameProvider,
- NULL,
- 0,
- kCGRenderingIntentDefault
- );
-
- // get the data for the second frame
- CGDataProviderRef secondFrameProvider = CGDataProviderCreateWithData(
- NULL,
- [secondFrame bitmapData],
- [secondFrame bytesPerRow] * [secondFrame pixelsHigh],
- NULL
- );
-
- // create a CGImage for the second frame
- CGImageRef cgSecondFrame = CGImageCreate (
- [secondFrame pixelsWide],
- [secondFrame pixelsHigh],
- [secondFrame bitsPerPixel] / [secondFrame samplesPerPixel],
- [secondFrame bitsPerPixel],
- [secondFrame bytesPerRow],
- CGColorSpaceCreateDeviceRGB(),
- kCGImageAlphaNone,
- secondFrameProvider,
- NULL,
- 0,
- kCGRenderingIntentDefault
- );
-
- // place the two images into the final animated gif and set related options
- CGImageDestinationAddImage(animatedGIF, cgFirstFrame, (CFDictionaryRef) frameProperties);
- CGImageDestinationAddImage(animatedGIF, cgSecondFrame, (CFDictionaryRef) frameProperties);
- CGImageDestinationSetProperties(animatedGIF, (CFDictionaryRef) gifProperties);
-
- // save the gif to a file
- CGImageDestinationFinalize(animatedGIF);
-
- // release the memory used
- CGDataProviderRelease(firstFrameProvider);
- CGDataProviderRelease(secondFrameProvider);
- CGImageRelease(cgFirstFrame);
- CGImageRelease(cgSecondFrame);
- CFRelease(animatedGIF);
-}
+++ /dev/null
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebCore+SVG/DrawDocumentPrivate.h>
-#import <WebCore+SVG/DrawView.h>
-#import "ImageDiff.h"
-
-extern const double svg2pngVersionNumber;
-extern const unsigned char svg2pngVersionString[];
-
-/* global variables */
-BOOL isMaxHeightSpecified = NO;
-BOOL isMaxWidthSpecified = NO;
-int maxWidth = 0;
-int maxHeight = 0;
-
-void usage(const char *name)
-{
- printf("Usage: %s [options] file[s]\n", name);
- printf("Options:\n");
- printf(" --baseline-dir <directory>\tthe directory where the baselines are stored\n");
- printf(" --baseline-suffix <suffix>\tthe suffix on the reference version of a picture\n");
- printf(" --max-width <int>\t\tsets the width of the output png\n");
- printf(" --max-height <int>\t\tsets the height of the output png\n");
- printf(" --output <outputfile>\t\tdump a png copy of a single svg input file\n\t\t\t\tto the named path\n");
- printf(" --output-dir <directory>\tthe directory where all files are output to\n");
- printf(" --suffix <suffix>\t\tappend <suffix> to each output file\n\t\t\t\te.g. <inputname><suffix>.png\n\n");
- printf(" --version\t\t\tPrints full version (%.1f) information and exits\n", svg2pngVersionNumber);
- printf("When --output is not specified, output files are created in the same directory\n");
- printf("as the original source files e.g. <source directory>/<filename><suffix>.png\n");
- printf("\nWhen --baseline-suffix is specified, svg2png will look for a PNG file that\n");
- printf("contains an example of what the SVG should look like when rendered. It will\n");
- printf("create a <filename><suffix>-diff.png file to show these differences.\n\n");
- exit(1);
-};
-
-NSBitmapImageRep *getBitmapForSVG(NSString *svgPath)
-{
-
- // load the given document
- DrawDocument *document = [[DrawDocument alloc] initWithContentsOfFile:svgPath];
-
- // create a view
- DrawView *view = [[DrawView alloc] initWithFrame:NSZeroRect]; // could be static...
- [view setDocument:document];
- [view sizeToFitViewBox];
-
- // Limit the maximum size, and default the size to 500x500 if not specified
- NSSize boundsSize = [view bounds].size;
- if (isMaxWidthSpecified && boundsSize.width > maxWidth) {
- // resize the height so that the aspect ratio remains the same
- boundsSize.height = (boundsSize.height / boundsSize.width) * maxWidth;
- boundsSize.width = maxWidth;
- }
- else if (boundsSize.width <= 0)
- boundsSize.width = 500;
-
- if (isMaxHeightSpecified && boundsSize.height > maxHeight) {
- // resize the width so that the aspect ratio reamins the same
- boundsSize.width = (boundsSize.width / boundsSize.height) * maxHeight;
- boundsSize.height = maxHeight;
- }
- else if (boundsSize.height <= 0)
- boundsSize.height = 500;
-
- [view setFrameSize:boundsSize];
-
- // tell that view to render
- NSBitmapImageRep *imageRep = [view bitmapImageRepForCachingDisplayInRect:[view bounds]];
- [view cacheDisplayInRect:[view bounds] toBitmapImageRep:imageRep];
-
- [view release]; // should be singleton.
- [document release];
-
- return imageRep;
-}
-
-int main (int argc, const char *argv[])
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- // deal with args
- NSMutableArray *svgs = [NSMutableArray array];
- const char *name = [[[NSString stringWithUTF8String:argv[0]] lastPathComponent] UTF8String];
- NSString *explicitOutputFile = nil;
- NSString *explicitOutputDirectory = nil;
- NSString *outputSuffix = nil;
- NSString *baselineSuffix = nil;
- NSString *explicitBaselineDirectory = nil;
-
- for(int x = 1; x < argc; x++) {
- const char *arg = argv[x];
- NSString *argString = [NSString stringWithUTF8String:arg];
-
- if ([argString hasPrefix:@"--"]) { // this is an option
- if ([argString isEqualToString:@"--help"])
- usage(name);
- else if ([argString isEqualToString:@"--version"]) {
- printf((char *)svg2pngVersionString);
- exit(0);
- } else if ([argString isEqualToString:@"--output"]) {
- if (x + 1 < argc) {
- explicitOutputFile = [NSString stringWithUTF8String:argv[x+1]];
- if ([explicitOutputFile hasPrefix:@"--"])
- printf("WARNING: did you really mean to output to: %s Or did you just forget the --output <filename> argument?\n", [explicitOutputFile UTF8String]);
- x++; // to skip the next arg
- } else {
- printf("--output requires an argument.\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--output-dir"]) {
- if (x + 1 < argc) {
- explicitOutputDirectory = [NSString stringWithUTF8String:argv[x+1]];
- if ([explicitOutputDirectory hasPrefix:@"--"])
- printf("WARNING: did you really mean to output to: %s Or did you just forget the --output <filename> argument?\n", [explicitOutputDirectory UTF8String]);
- x++; // to skip the next arg
- } else {
- printf("--output-dir requires an argument.\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--suffix"]) {
- if (x + 1 < argc) {
- outputSuffix = [NSString stringWithUTF8String:argv[x+1]];
- x++; // to skip the next arg
- } else {
- printf("--suffix requires an argument.\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--max-width"]) {
- if (x + 1 < argc) {
- maxWidth = [[NSString stringWithUTF8String:argv[x+1]] intValue];
- if (maxWidth <= 0) {
- printf("--max-width must be an integer > 0\n");
- usage(name);
- }
- isMaxWidthSpecified = YES;
- x++; // skip to the next arg
- } else {
- printf("--max-width requires an integer argument.\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--max-height"]) {
- if (x + 1 < argc) {
- maxHeight = [[NSString stringWithUTF8String:argv[x+1]] intValue];
- if (maxHeight <= 0) {
- printf("--max-height must be an integer > 0\n");
- usage(name);
- }
- isMaxHeightSpecified = YES;
- x++; // skip to the next arg
- } else {
- printf("--max-height requires an integer > 0\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--baseline-suffix"]) {
- if(x + 1 < argc) {
- baselineSuffix = [NSString stringWithUTF8String:argv[x+1]];
- x++; // skip to the next arg
- } else {
- printf("--baseline-suffix requires the suffix for the reference PNGs.\n");
- usage(name);
- }
- } else if ([argString isEqualToString:@"--baseline-dir"]) {
- if(x + 1 < argc) {
- explicitBaselineDirectory = [NSString stringWithUTF8String:argv[x+1]];
- x++; // skip to the next arg
- } else {
- printf("--baseline-dir requires the suffix for the reference PNGs.\n");
- usage(name);
- }
- } else {
- printf("Unrecognized option %s\n", [argString UTF8String]);
- usage(name);
- }
- } else {
- if (![[NSFileManager defaultManager] fileExistsAtPath:[argString stringByStandardizingPath]]) {
- printf("SVG does not exist at path: %s\n", [argString UTF8String]);
- exit(1);
- }
- [svgs addObject:argString];
- }
- }
-
- if (![svgs count]) {
- printf("No svgs specified.\n");
- usage(name);
- }
-
- if ( ([svgs count] > 1) && explicitOutputFile) {
- printf("--output name specifed, yet more than one input file was given!\n\n");
- usage(name);
- }
-
-
- NSString *svgPath = nil;
- foreacharray(svgPath, svgs) {
- NSBitmapImageRep *svgBitmap = nil;
- NSString *svgPNGPath = nil;
-
- if (explicitOutputFile)
- svgPNGPath = explicitOutputFile;
- else {
- if (explicitOutputDirectory)
- svgPNGPath = [[explicitOutputDirectory stringByAppendingPathComponent:[svgPath lastPathComponent]] stringByDeletingPathExtension];
- else
- svgPNGPath = [svgPath stringByDeletingPathExtension];
-
- if (outputSuffix)
- svgPNGPath = [svgPNGPath stringByAppendingString:outputSuffix];
-
- svgPNGPath = [svgPNGPath stringByAppendingPathExtension:@"png"];
- }
-
- // generate the SVG, save the bitmap data for the diff
- svgBitmap = getBitmapForSVG(svgPath);
-
- // output the resulting SVG to a PNG file
- NSData *svgPNGData = [svgBitmap representationUsingType:NSPNGFileType properties:nil];
- [svgPNGData writeToFile:svgPNGPath atomically:YES];
-
- if (baselineSuffix || explicitBaselineDirectory) {
- NSString *diffImagePath = [[[svgPNGPath stringByDeletingPathExtension]
- stringByAppendingString:@"-diff"]
- stringByAppendingPathExtension:@"png"];
-
- NSString *animatedGIFPath = [[diffImagePath stringByDeletingPathExtension]
- stringByAppendingPathExtension:@"gif"];
-
- NSString *baselineImagePath = nil;
-
- // if set, look for baselines in a seperate directory
- if (explicitBaselineDirectory)
- baselineImagePath = [[explicitBaselineDirectory
- stringByAppendingPathComponent:[svgPath lastPathComponent]] stringByDeletingPathExtension];
- else
- baselineImagePath = [svgPath stringByDeletingPathExtension];
-
- // if baselines have a special suffix, append that to the path
- if (baselineSuffix)
- baselineImagePath = [baselineImagePath stringByAppendingString:baselineSuffix];
-
- baselineImagePath = [baselineImagePath stringByAppendingPathExtension:@"png"];
-
- // compare
- NSBitmapImageRep *referenceBitmap = [NSBitmapImageRep imageRepWithContentsOfURL:[NSURL fileURLWithPath:baselineImagePath]];
- NSBitmapImageRep *diffBitmap = getDifferenceBitmap(svgBitmap, referenceBitmap);
-
- // output the resulting SVG to a PNG file
- NSData *diffPNGData = [diffBitmap representationUsingType:NSPNGFileType properties:nil];
- [diffPNGData writeToFile:diffImagePath atomically:YES];
-
- // save the reference and the svg images in an animated GIF
- saveAnimatedGIFToFile(svgBitmap, referenceBitmap, animatedGIFPath);
-
- float percentage = computePercentageDifferent(diffBitmap);
- printf("%s\t%3.3f%%\t%s\n", [svgPath UTF8String], percentage, (percentage > 1 ? "Failed." : "Passed."));
-
- [diffBitmap release];
- }
- }
-
- [pool drain];
-
- return 0;
-}
+++ /dev/null
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 42;
- objects = {
-
-/* Begin PBXBuildFile section */
- 8DD76F9A0486AA7600D96B5E /* svg2png.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* svg2png.m */; settings = {ATTRIBUTES = (); }; };
- 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
- A898F79508824B4A0075EFB2 /* WebCore+SVG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A898F79408824B4A0075EFB2 /* WebCore+SVG.framework */; };
- B50D9AFB08A0048500ECF782 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50D9AFA08A0048500ECF782 /* QuartzCore.framework */; };
- B555988908A341E3001EB5FD /* ImageDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = B555988808A341E3001EB5FD /* ImageDiff.m */; };
- B55598AE08A3440B001EB5FD /* ImageDiff.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B55598AD08A3440B001EB5FD /* ImageDiff.h */; };
- B59F58FC08A1D1CA00BE2664 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B59F58FB08A1D1CA00BE2664 /* AppKit.framework */; };
- B5D925A308A4B87700BC94F6 /* svg2png in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8DD76FA10486AA7600D96B5E /* svg2png */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXBuildStyle section */
- 014CEA4F0018CE4811CA2923 /* Development */ = {
- isa = PBXBuildStyle;
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- ZERO_LINK = YES;
- };
- name = Development;
- };
- 014CEA500018CE4811CA2923 /* Deployment */ = {
- isa = PBXBuildStyle;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- ZERO_LINK = NO;
- };
- name = Deployment;
- };
-/* End PBXBuildStyle section */
-
-/* Begin PBXCopyFilesBuildPhase section */
- 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 8;
- dstPath = /usr/share/man/man1/;
- dstSubfolderSpec = 0;
- files = (
- B55598AE08A3440B001EB5FD /* ImageDiff.h in CopyFiles */,
- B5D925A308A4B87700BC94F6 /* svg2png in CopyFiles */,
- );
- runOnlyForDeploymentPostprocessing = 1;
- };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
- 08FB7796FE84155DC02AAC07 /* svg2png.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = svg2png.m; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
- 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
- 32A70AAB03705E1F00C91783 /* svg2png_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svg2png_Prefix.pch; sourceTree = "<group>"; };
- 8DD76FA10486AA7600D96B5E /* svg2png */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = svg2png; sourceTree = BUILT_PRODUCTS_DIR; };
- A898F79408824B4A0075EFB2 /* WebCore+SVG.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = "WebCore+SVG.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
- B50D9AFA08A0048500ECF782 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
- B555988808A341E3001EB5FD /* ImageDiff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageDiff.m; sourceTree = "<group>"; };
- B55598AD08A3440B001EB5FD /* ImageDiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDiff.h; sourceTree = "<group>"; };
- B59F58FB08A1D1CA00BE2664 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 8DD76F9B0486AA7600D96B5E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */,
- A898F79508824B4A0075EFB2 /* WebCore+SVG.framework in Frameworks */,
- B50D9AFB08A0048500ECF782 /* QuartzCore.framework in Frameworks */,
- B59F58FC08A1D1CA00BE2664 /* AppKit.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 08FB7794FE84155DC02AAC07 /* svg2png */ = {
- isa = PBXGroup;
- children = (
- 08FB7795FE84155DC02AAC07 /* Source */,
- 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
- 1AB674ADFE9D54B511CA2CBB /* Products */,
- );
- name = svg2png;
- sourceTree = "<group>";
- };
- 08FB7795FE84155DC02AAC07 /* Source */ = {
- isa = PBXGroup;
- children = (
- 32A70AAB03705E1F00C91783 /* svg2png_Prefix.pch */,
- 08FB7796FE84155DC02AAC07 /* svg2png.m */,
- B555988808A341E3001EB5FD /* ImageDiff.m */,
- B55598AD08A3440B001EB5FD /* ImageDiff.h */,
- );
- name = Source;
- sourceTree = "<group>";
- };
- 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
- isa = PBXGroup;
- children = (
- B59F58FB08A1D1CA00BE2664 /* AppKit.framework */,
- B50D9AFA08A0048500ECF782 /* QuartzCore.framework */,
- A898F79408824B4A0075EFB2 /* WebCore+SVG.framework */,
- 08FB779EFE84155DC02AAC07 /* Foundation.framework */,
- );
- name = "External Frameworks and Libraries";
- sourceTree = "<group>";
- };
- 1AB674ADFE9D54B511CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 8DD76FA10486AA7600D96B5E /* svg2png */,
- );
- name = Products;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 8DD76F960486AA7600D96B5E /* svg2png */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = A8C006250897569A00BA5114 /* Build configuration list for PBXNativeTarget "svg2png" */;
- buildPhases = (
- 8DD76F990486AA7600D96B5E /* Sources */,
- 8DD76F9B0486AA7600D96B5E /* Frameworks */,
- 8DD76F9E0486AA7600D96B5E /* CopyFiles */,
- );
- buildRules = (
- );
- buildSettings = {
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_MODEL_TUNING = G5;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = svg2png_Prefix.pch;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INSTALL_PATH = "$(HOME)/bin";
- PREBINDING = NO;
- PRODUCT_NAME = svg2png;
- VERSIONING_SYSTEM = "apple-generic";
- };
- dependencies = (
- );
- name = svg2png;
- productInstallPath = "$(HOME)/bin";
- productName = svg2png;
- productReference = 8DD76FA10486AA7600D96B5E /* svg2png */;
- productType = "com.apple.product-type.tool";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = A8C006290897569A00BA5114 /* Build configuration list for PBXProject "svg2png" */;
- buildSettings = {
- };
- buildStyles = (
- 014CEA4F0018CE4811CA2923 /* Development */,
- 014CEA500018CE4811CA2923 /* Deployment */,
- );
- hasScannedForEncodings = 1;
- mainGroup = 08FB7794FE84155DC02AAC07 /* svg2png */;
- projectDirPath = "";
- targets = (
- 8DD76F960486AA7600D96B5E /* svg2png */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
- 8DD76F990486AA7600D96B5E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8DD76F9A0486AA7600D96B5E /* svg2png.m in Sources */,
- B555988908A341E3001EB5FD /* ImageDiff.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- A8C006260897569A00BA5114 /* Development */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_MODEL_TUNING = G5;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = svg2png_Prefix.pch;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INSTALL_PATH = "$(HOME)/bin";
- PREBINDING = NO;
- PRODUCT_NAME = svg2png;
- VERSIONING_SYSTEM = "apple-generic";
- ZERO_LINK = YES;
- };
- name = Development;
- };
- A8C006270897569A00BA5114 /* Deployment */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_MODEL_TUNING = G5;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = svg2png_Prefix.pch;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INSTALL_PATH = "$(HOME)/bin";
- PREBINDING = NO;
- PRODUCT_NAME = svg2png;
- VERSIONING_SYSTEM = "apple-generic";
- ZERO_LINK = NO;
- };
- name = Deployment;
- };
- A8C006280897569A00BA5114 /* Default */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_MODEL_TUNING = G5;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = svg2png_Prefix.pch;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INSTALL_PATH = "$(HOME)/bin";
- PREBINDING = NO;
- PRODUCT_NAME = svg2png;
- VERSIONING_SYSTEM = "apple-generic";
- };
- name = Default;
- };
- A8C0062A0897569A00BA5114 /* Development */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- VERSIONING_SYSTEM = "apple-generic";
- };
- name = Development;
- };
- A8C0062B0897569A00BA5114 /* Deployment */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- VERSIONING_SYSTEM = "apple-generic";
- };
- name = Deployment;
- };
- A8C0062C0897569A00BA5114 /* Default */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- VERSIONING_SYSTEM = "apple-generic";
- };
- name = Default;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- A8C006250897569A00BA5114 /* Build configuration list for PBXNativeTarget "svg2png" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- A8C006260897569A00BA5114 /* Development */,
- A8C006270897569A00BA5114 /* Deployment */,
- A8C006280897569A00BA5114 /* Default */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
- };
- A8C006290897569A00BA5114 /* Build configuration list for PBXProject "svg2png" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- A8C0062A0897569A00BA5114 /* Development */,
- A8C0062B0897569A00BA5114 /* Deployment */,
- A8C0062C0897569A00BA5114 /* Default */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
+++ /dev/null
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-//
-// Prefix header for all source files of the 'svg2png' target in the 'svg2png' project.
-//
-
-#ifdef __OBJC__
-#import <Foundation/Foundation.h>
-
-#define foreacharray(__variable, __container) \
- for (int __variable##__i=0, __variable##__n=[__container count]; \
- __variable##__i < __variable##__n && (__variable = [__container objectAtIndex:__variable##__i]); \
- ++__variable##__i)
-#endif