mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2025-02-12 15:20:47 +00:00
- Fixed case sensitivity on ObjC* #import's for case sensitive file systems submitted by halfactivist.
- CGWindow, NSCustomView, NSDrawer, NSWindow, NSWindowController, Win32Window fixes from Issues 10-17 submitted by Rolf Jansen. - NSFileWrapper implementation submitted by Dirk Theisen. - Added stubs to NSAssertionHandler, NSDirectoryEnumerator, NSFileManager for methods needed by NSFileWrapper addition. - Added FlateDecode filter derived from a public domain implementation (not zlib) by Sean Barrett to the PDF system. - Added ImageIO directory and starting point files. - Added more starting point code in KoreGraphics and clean up in KG and Win32. Added KG(Mutable)Path. - First pass at NSPDFImageRep hooks into underlying KG classes.
This commit is contained in:
parent
496f2b7ba1
commit
291d859a1e
@ -305,19 +305,17 @@
|
||||
6E2B55B70976075300DA0954 /* CGGeometry.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55B60976075300DA0954 /* CGGeometry.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55B90976075300DA0954 /* CGAffineTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55B80976075300DA0954 /* CGAffineTransform.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55BB0976075300DA0954 /* CGFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55BA0976075300DA0954 /* CGFont.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55BD0976075300DA0954 /* CGGraphicsState.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55BC0976075300DA0954 /* CGGraphicsState.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55BF0976075300DA0954 /* CGContextSimple.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55BE0976075300DA0954 /* CGContextSimple.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55C10976075300DA0954 /* CGRenderingContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55C00976075300DA0954 /* CGRenderingContext.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55BD0976075300DA0954 /* KGGraphicsState.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55BC0976075300DA0954 /* KGGraphicsState.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55C10976075300DA0954 /* KGRenderingContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55C00976075300DA0954 /* KGRenderingContext.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55C30976075300DA0954 /* CGWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55C20976075300DA0954 /* CGWindow.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55C50976075300DA0954 /* CGEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55C40976075300DA0954 /* CGEvent.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B55C80976075300DA0954 /* CGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55C70976075300DA0954 /* CGContext.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
|
||||
6E2B55CA0976075300DA0954 /* CGGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55C90976075300DA0954 /* CGGeometry.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55CA0976075300DA0954 /* CGGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55C90976075300DA0954 /* CGGeometry.h */; settings = {ATTRIBUTES = (Project, Public, ); }; };
|
||||
6E2B55CC0976075300DA0954 /* CGAffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55CB0976075300DA0954 /* CGAffineTransform.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
|
||||
6E2B55CE0976075300DA0954 /* CGFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55CD0976075300DA0954 /* CGFont.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55CE0976075300DA0954 /* CGFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55CD0976075300DA0954 /* CGFont.h */; settings = {ATTRIBUTES = (Project, Public, ); }; };
|
||||
6E2B55D00976075300DA0954 /* CoreGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55CF0976075300DA0954 /* CoreGraphics.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
|
||||
6E2B55D20976075300DA0954 /* CGGraphicsState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D10976075300DA0954 /* CGGraphicsState.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55D40976075300DA0954 /* CGContextSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D30976075300DA0954 /* CGContextSimple.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55D60976075300DA0954 /* CGRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D50976075300DA0954 /* CGRenderingContext.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55D20976075300DA0954 /* KGGraphicsState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D10976075300DA0954 /* KGGraphicsState.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55D60976075300DA0954 /* KGRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D50976075300DA0954 /* KGRenderingContext.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55D80976075300DA0954 /* CGWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D70976075300DA0954 /* CGWindow.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55DA0976075300DA0954 /* CGEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B55D90976075300DA0954 /* CGEvent.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B55E20976075300DA0954 /* NSColorPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B55E10976075300DA0954 /* NSColorPicker.m */; settings = {ATTRIBUTES = (); }; };
|
||||
@ -335,7 +333,6 @@
|
||||
6E2B55FD0976075300DA0954 /* NSColorPickerSlidersHSB.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6E2B55FC0976075300DA0954 /* NSColorPickerSlidersHSB.tiff */; };
|
||||
6E2B55FF0976075300DA0954 /* NSColorPickerSlidersRGB.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6E2B55FE0976075300DA0954 /* NSColorPickerSlidersRGB.tiff */; };
|
||||
6E2B56010976075300DA0954 /* NSColorPickerSlidersGray.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6E2B56000976075300DA0954 /* NSColorPickerSlidersGray.tiff */; };
|
||||
6E2B56090976075300DA0954 /* Win32Brush.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56080976075300DA0954 /* Win32Brush.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B560B0976075300DA0954 /* Win32Cursor.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B560A0976075300DA0954 /* Win32Cursor.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B560D0976075300DA0954 /* Win32DeviceContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B560C0976075300DA0954 /* Win32DeviceContext.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B560F0976075300DA0954 /* Win32DeviceContextBitmap.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B560E0976075300DA0954 /* Win32DeviceContextBitmap.m */; settings = {ATTRIBUTES = (); }; };
|
||||
@ -344,20 +341,16 @@
|
||||
6E2B56150976075300DA0954 /* Win32Display.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56140976075300DA0954 /* Win32Display.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56170976075400DA0954 /* Win32Event.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56160976075300DA0954 /* Win32Event.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56190976075400DA0954 /* Win32Font.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56180976075400DA0954 /* Win32Font.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B561B0976075400DA0954 /* Win32GraphicsContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B561A0976075400DA0954 /* Win32GraphicsContext.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B561D0976075400DA0954 /* Win32GraphicsState.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B561C0976075400DA0954 /* Win32GraphicsState.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B561F0976075400DA0954 /* Win32Region.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B561E0976075400DA0954 /* Win32Region.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56210976075400DA0954 /* Win32Window.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56200976075400DA0954 /* Win32Window.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56230976075400DA0954 /* Win32Application.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56220976075400DA0954 /* Win32Application.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56250976075400DA0954 /* Win32SplashPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56240976075400DA0954 /* Win32SplashPanel.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56270976075400DA0954 /* Win32RunningCopyPipe.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56260976075400DA0954 /* Win32RunningCopyPipe.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56290976075400DA0954 /* Win32EventInputSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56280976075400DA0954 /* Win32EventInputSource.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B562B0976075400DA0954 /* Win32RenderingContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B562A0976075400DA0954 /* Win32RenderingContext.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B562D0976075400DA0954 /* Win32Workspace.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B562C0976075400DA0954 /* Win32Workspace.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B562F0976075400DA0954 /* NSSavePanel-Win32.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B562E0976075400DA0954 /* NSSavePanel-Win32.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56310976075400DA0954 /* NSOpenPanel-Win32.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56300976075400DA0954 /* NSOpenPanel-Win32.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56330976075400DA0954 /* NSPlatform-Win32.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2B56320976075400DA0954 /* NSPlatform-Win32.m */; settings = {ATTRIBUTES = (); }; };
|
||||
6E2B56360976075400DA0954 /* Win32Brush.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56350976075400DA0954 /* Win32Brush.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B56380976075400DA0954 /* Win32Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56370976075400DA0954 /* Win32Cursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B563A0976075400DA0954 /* Win32DeviceContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56390976075400DA0954 /* Win32DeviceContext.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B563C0976075400DA0954 /* Win32DeviceContextBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B563B0976075400DA0954 /* Win32DeviceContextBitmap.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
@ -366,15 +359,12 @@
|
||||
6E2B56420976075400DA0954 /* Win32Display.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56410976075400DA0954 /* Win32Display.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B56440976075400DA0954 /* Win32Event.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56430976075400DA0954 /* Win32Event.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B56460976075400DA0954 /* Win32Font.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56450976075400DA0954 /* Win32Font.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B56480976075400DA0954 /* Win32GraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56470976075400DA0954 /* Win32GraphicsContext.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B564A0976075400DA0954 /* Win32GraphicsState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56490976075400DA0954 /* Win32GraphicsState.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B564C0976075400DA0954 /* Win32Region.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B564B0976075400DA0954 /* Win32Region.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B564E0976075400DA0954 /* Win32Window.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B564D0976075400DA0954 /* Win32Window.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B56500976075400DA0954 /* Win32Application.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B564F0976075400DA0954 /* Win32Application.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B56520976075400DA0954 /* Win32SplashPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56510976075400DA0954 /* Win32SplashPanel.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B56540976075400DA0954 /* Win32RunningCopyPipe.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56530976075400DA0954 /* Win32RunningCopyPipe.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B56560976075400DA0954 /* Win32EventInputSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56550976075400DA0954 /* Win32EventInputSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B56580976075400DA0954 /* Win32RenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56570976075400DA0954 /* Win32RenderingContext.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
|
||||
6E2B565A0976075400DA0954 /* Win32Workspace.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B56590976075400DA0954 /* Win32Workspace.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B565C0976075400DA0954 /* NSSavePanel-Win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B565B0976075400DA0954 /* NSSavePanel-Win32.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6E2B565E0976075400DA0954 /* NSOpenPanel-Win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B565D0976075400DA0954 /* NSOpenPanel-Win32.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
@ -491,6 +481,44 @@
|
||||
6ECABDFA0A3FA2B700AD7F7B /* NSCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECABDF80A3FA2B700AD7F7B /* NSCustomView.m */; };
|
||||
6ECABE330A40520700AD7F7B /* NSNibKeyedUnarchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ECABE310A40520700AD7F7B /* NSNibKeyedUnarchiver.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6ECABE340A40520700AD7F7B /* NSNibKeyedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECABE320A40520700AD7F7B /* NSNibKeyedUnarchiver.m */; };
|
||||
FE064AC70B8B805000853FBB /* CGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AA90B8B805000853FBB /* CGColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064AC80B8B805000853FBB /* CGColor.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AAA0B8B805000853FBB /* CGColor.m */; };
|
||||
FE064AC90B8B805000853FBB /* CGColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AAB0B8B805000853FBB /* CGColorSpace.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064ACA0B8B805000853FBB /* CGColorSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AAC0B8B805000853FBB /* CGColorSpace.m */; };
|
||||
FE064ACB0B8B805000853FBB /* CGDataProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AAD0B8B805000853FBB /* CGDataProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064ACC0B8B805000853FBB /* CGDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AAE0B8B805000853FBB /* CGDataProvider.m */; };
|
||||
FE064ACD0B8B805000853FBB /* CGFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AAF0B8B805000853FBB /* CGFunction.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064ACE0B8B805000853FBB /* CGFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AB00B8B805000853FBB /* CGFunction.m */; };
|
||||
FE064AD10B8B805000853FBB /* CGLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AB30B8B805000853FBB /* CGLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064AD20B8B805000853FBB /* CGLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AB40B8B805000853FBB /* CGLayer.m */; };
|
||||
FE064AD30B8B805000853FBB /* CGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AB50B8B805000853FBB /* CGPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064AD40B8B805000853FBB /* CGPath.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AB60B8B805000853FBB /* CGPath.m */; };
|
||||
FE064AD50B8B805000853FBB /* CGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AB70B8B805000853FBB /* CGPattern.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064AD60B8B805000853FBB /* CGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AB80B8B805000853FBB /* CGPattern.m */; };
|
||||
FE064AD70B8B805000853FBB /* CGShading.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AB90B8B805000853FBB /* CGShading.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE064AD80B8B805000853FBB /* CGShading.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064ABA0B8B805000853FBB /* CGShading.m */; };
|
||||
FE064AD90B8B805000853FBB /* KGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064ABB0B8B805000853FBB /* KGColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE064ADA0B8B805000853FBB /* KGColor.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064ABC0B8B805000853FBB /* KGColor.m */; };
|
||||
FE064ADD0B8B805000853FBB /* KGImage_context.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064ABF0B8B805000853FBB /* KGImage_context.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE064ADE0B8B805000853FBB /* KGImage_context.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AC00B8B805000853FBB /* KGImage_context.m */; };
|
||||
FE064ADF0B8B805000853FBB /* KGLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AC10B8B805000853FBB /* KGLayer.h */; };
|
||||
FE064AE00B8B805000853FBB /* KGLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AC20B8B805000853FBB /* KGLayer.m */; };
|
||||
FE064AE10B8B805000853FBB /* KGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AC30B8B805000853FBB /* KGPath.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE064AE20B8B805000853FBB /* KGPath.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AC40B8B805000853FBB /* KGPath.m */; };
|
||||
FE064AE30B8B805000853FBB /* KGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = FE064AC50B8B805000853FBB /* KGPattern.h */; };
|
||||
FE064AE40B8B805000853FBB /* KGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = FE064AC60B8B805000853FBB /* KGPattern.m */; };
|
||||
FE267E8B0B8BCC3C0000DDC0 /* KGImageSource_JPEG.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267E830B8BCC3C0000DDC0 /* KGImageSource_JPEG.h */; };
|
||||
FE267E8C0B8BCC3C0000DDC0 /* KGImageSource_JPEG.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267E840B8BCC3C0000DDC0 /* KGImageSource_JPEG.m */; };
|
||||
FE267E8D0B8BCC3C0000DDC0 /* KGImageSource_PNG.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267E850B8BCC3C0000DDC0 /* KGImageSource_PNG.h */; };
|
||||
FE267E8E0B8BCC3C0000DDC0 /* KGImageSource_PNG.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267E860B8BCC3C0000DDC0 /* KGImageSource_PNG.m */; };
|
||||
FE267E8F0B8BCC3C0000DDC0 /* KGImageSource_TIFF.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267E870B8BCC3C0000DDC0 /* KGImageSource_TIFF.h */; };
|
||||
FE267E900B8BCC3C0000DDC0 /* KGImageSource_TIFF.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267E880B8BCC3C0000DDC0 /* KGImageSource_TIFF.m */; };
|
||||
FE267E910B8BCC3C0000DDC0 /* KGImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267E890B8BCC3C0000DDC0 /* KGImageSource.h */; };
|
||||
FE267E920B8BCC3C0000DDC0 /* KGImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267E8A0B8BCC3C0000DDC0 /* KGImageSource.m */; };
|
||||
FE267EB70B8BD2690000DDC0 /* CGBitmapContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267EB30B8BD2690000DDC0 /* CGBitmapContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE267EB80B8BD2690000DDC0 /* CGBitmapContext.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267EB40B8BD2690000DDC0 /* CGBitmapContext.m */; };
|
||||
FE267EB90B8BD2690000DDC0 /* KGBitmapContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE267EB50B8BD2690000DDC0 /* KGBitmapContext.h */; };
|
||||
FE267EBA0B8BD2690000DDC0 /* KGBitmapContext.m in Sources */ = {isa = PBXBuildFile; fileRef = FE267EB60B8BD2690000DDC0 /* KGBitmapContext.m */; };
|
||||
FE2A101F0B44A201006C03DE /* NSAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2A101D0B44A201006C03DE /* NSAlert.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE2A10200B44A201006C03DE /* NSAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2A101E0B44A201006C03DE /* NSAlert.m */; };
|
||||
FE2A102A0B44A26B006C03DE /* NSArrayController.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2A10280B44A26B006C03DE /* NSArrayController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -551,13 +579,13 @@
|
||||
FE6466E40B2C611D00B302B0 /* NSMutableParagraphStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = FE6466E20B2C611D00B302B0 /* NSMutableParagraphStyle.m */; };
|
||||
FE64B8E10B81239D007EE513 /* KGColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A70B81239D007EE513 /* KGColorSpace.h */; };
|
||||
FE64B8E20B81239D007EE513 /* KGColorSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8A80B81239D007EE513 /* KGColorSpace.m */; };
|
||||
FE64B8E30B81239D007EE513 /* KGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A90B81239D007EE513 /* KGContext.h */; };
|
||||
FE64B8E30B81239D007EE513 /* KGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A90B81239D007EE513 /* KGContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE64B8E40B81239D007EE513 /* KGContext.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AA0B81239D007EE513 /* KGContext.m */; };
|
||||
FE64B8E50B81239D007EE513 /* KGDataProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AB0B81239D007EE513 /* KGDataProvider.h */; };
|
||||
FE64B8E60B81239D007EE513 /* KGDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AC0B81239D007EE513 /* KGDataProvider.m */; };
|
||||
FE64B8E70B81239D007EE513 /* KGFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AD0B81239D007EE513 /* KGFunction.h */; };
|
||||
FE64B8E80B81239D007EE513 /* KGFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AE0B81239D007EE513 /* KGFunction.m */; };
|
||||
FE64B8E90B81239D007EE513 /* KGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AF0B81239D007EE513 /* KGImage.h */; };
|
||||
FE64B8E90B81239D007EE513 /* KGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AF0B81239D007EE513 /* KGImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE64B8EA0B81239D007EE513 /* KGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B00B81239D007EE513 /* KGImage.m */; };
|
||||
FE64B8EB0B81239D007EE513 /* KGPDFArray.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8B10B81239D007EE513 /* KGPDFArray.h */; };
|
||||
FE64B8EC0B81239D007EE513 /* KGPDFArray.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B20B81239D007EE513 /* KGPDFArray.m */; };
|
||||
@ -565,7 +593,7 @@
|
||||
FE64B8EE0B81239D007EE513 /* KGPDFContentStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B40B81239D007EE513 /* KGPDFContentStream.m */; };
|
||||
FE64B8EF0B81239D007EE513 /* KGPDFDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8B50B81239D007EE513 /* KGPDFDictionary.h */; };
|
||||
FE64B8F00B81239D007EE513 /* KGPDFDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B60B81239D007EE513 /* KGPDFDictionary.m */; };
|
||||
FE64B8F10B81239D007EE513 /* KGPDFDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8B70B81239D007EE513 /* KGPDFDocument.h */; };
|
||||
FE64B8F10B81239D007EE513 /* KGPDFDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8B70B81239D007EE513 /* KGPDFDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE64B8F20B81239D007EE513 /* KGPDFDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B80B81239D007EE513 /* KGPDFDocument.m */; };
|
||||
FE64B8F30B81239D007EE513 /* KGPDFFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8B90B81239D007EE513 /* KGPDFFilter.h */; };
|
||||
FE64B8F40B81239D007EE513 /* KGPDFFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8BA0B81239D007EE513 /* KGPDFFilter.m */; };
|
||||
@ -593,7 +621,7 @@
|
||||
FE64B90A0B81239D007EE513 /* KGPDFOperators.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8D00B81239D007EE513 /* KGPDFOperators.m */; };
|
||||
FE64B90B0B81239D007EE513 /* KGPDFOperatorTable.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8D10B81239D007EE513 /* KGPDFOperatorTable.h */; };
|
||||
FE64B90C0B81239D007EE513 /* KGPDFOperatorTable.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8D20B81239D007EE513 /* KGPDFOperatorTable.m */; };
|
||||
FE64B90D0B81239D007EE513 /* KGPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8D30B81239D007EE513 /* KGPDFPage.h */; };
|
||||
FE64B90D0B81239D007EE513 /* KGPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8D30B81239D007EE513 /* KGPDFPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE64B90E0B81239D007EE513 /* KGPDFPage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8D40B81239D007EE513 /* KGPDFPage.m */; };
|
||||
FE64B90F0B81239D007EE513 /* KGPDFScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8D50B81239D007EE513 /* KGPDFScanner.h */; };
|
||||
FE64B9100B81239D007EE513 /* KGPDFScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8D60B81239D007EE513 /* KGPDFScanner.m */; };
|
||||
@ -607,8 +635,12 @@
|
||||
FE64B9180B81239D007EE513 /* KGPDFxrefEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8DE0B81239D007EE513 /* KGPDFxrefEntry.m */; };
|
||||
FE64B9190B81239D007EE513 /* KGShading.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8DF0B81239D007EE513 /* KGShading.h */; };
|
||||
FE64B91A0B81239D007EE513 /* KGShading.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8E00B81239D007EE513 /* KGShading.m */; };
|
||||
FE64B9220B8123F1007EE513 /* CGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B9200B8123F1007EE513 /* CGImage.h */; };
|
||||
FE64B9220B8123F1007EE513 /* CGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B9200B8123F1007EE513 /* CGImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FE64B9230B8123F1007EE513 /* CGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B9210B8123F1007EE513 /* CGImage.m */; };
|
||||
FEEF00590B96441800069FD1 /* CGPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = FEEF00570B96441800069FD1 /* CGPDFPage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FEEF005A0B96441800069FD1 /* CGPDFPage.m in Sources */ = {isa = PBXBuildFile; fileRef = FEEF00580B96441800069FD1 /* CGPDFPage.m */; };
|
||||
FEF33C010B93543C00DC0B6F /* KGMutablePath.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF33BFF0B93543C00DC0B6F /* KGMutablePath.h */; };
|
||||
FEF33C020B93543C00DC0B6F /* KGMutablePath.m in Sources */ = {isa = PBXBuildFile; fileRef = FEF33C000B93543C00DC0B6F /* KGMutablePath.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildRule section */
|
||||
@ -955,9 +987,8 @@
|
||||
6E2B55B60976075300DA0954 /* CGGeometry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGGeometry.m; sourceTree = "<group>"; };
|
||||
6E2B55B80976075300DA0954 /* CGAffineTransform.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGAffineTransform.m; sourceTree = "<group>"; };
|
||||
6E2B55BA0976075300DA0954 /* CGFont.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGFont.m; sourceTree = "<group>"; };
|
||||
6E2B55BC0976075300DA0954 /* CGGraphicsState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGGraphicsState.m; sourceTree = "<group>"; };
|
||||
6E2B55BE0976075300DA0954 /* CGContextSimple.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGContextSimple.m; sourceTree = "<group>"; };
|
||||
6E2B55C00976075300DA0954 /* CGRenderingContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGRenderingContext.m; sourceTree = "<group>"; };
|
||||
6E2B55BC0976075300DA0954 /* KGGraphicsState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KGGraphicsState.m; sourceTree = "<group>"; };
|
||||
6E2B55C00976075300DA0954 /* KGRenderingContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KGRenderingContext.m; sourceTree = "<group>"; };
|
||||
6E2B55C20976075300DA0954 /* CGWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGWindow.m; sourceTree = "<group>"; };
|
||||
6E2B55C40976075300DA0954 /* CGEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CGEvent.m; sourceTree = "<group>"; };
|
||||
6E2B55C70976075300DA0954 /* CGContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGContext.h; sourceTree = "<group>"; };
|
||||
@ -965,9 +996,8 @@
|
||||
6E2B55CB0976075300DA0954 /* CGAffineTransform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGAffineTransform.h; sourceTree = "<group>"; };
|
||||
6E2B55CD0976075300DA0954 /* CGFont.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGFont.h; sourceTree = "<group>"; };
|
||||
6E2B55CF0976075300DA0954 /* CoreGraphics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreGraphics.h; sourceTree = "<group>"; };
|
||||
6E2B55D10976075300DA0954 /* CGGraphicsState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGGraphicsState.h; sourceTree = "<group>"; };
|
||||
6E2B55D30976075300DA0954 /* CGContextSimple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGContextSimple.h; sourceTree = "<group>"; };
|
||||
6E2B55D50976075300DA0954 /* CGRenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGRenderingContext.h; sourceTree = "<group>"; };
|
||||
6E2B55D10976075300DA0954 /* KGGraphicsState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KGGraphicsState.h; sourceTree = "<group>"; };
|
||||
6E2B55D50976075300DA0954 /* KGRenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KGRenderingContext.h; sourceTree = "<group>"; };
|
||||
6E2B55D70976075300DA0954 /* CGWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGWindow.h; sourceTree = "<group>"; };
|
||||
6E2B55D90976075300DA0954 /* CGEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGEvent.h; sourceTree = "<group>"; };
|
||||
6E2B55E10976075300DA0954 /* NSColorPicker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSColorPicker.m; sourceTree = "<group>"; };
|
||||
@ -985,7 +1015,6 @@
|
||||
6E2B55FC0976075300DA0954 /* NSColorPickerSlidersHSB.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSColorPickerSlidersHSB.tiff; sourceTree = "<group>"; };
|
||||
6E2B55FE0976075300DA0954 /* NSColorPickerSlidersRGB.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSColorPickerSlidersRGB.tiff; sourceTree = "<group>"; };
|
||||
6E2B56000976075300DA0954 /* NSColorPickerSlidersGray.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSColorPickerSlidersGray.tiff; sourceTree = "<group>"; };
|
||||
6E2B56080976075300DA0954 /* Win32Brush.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Brush.m; sourceTree = "<group>"; };
|
||||
6E2B560A0976075300DA0954 /* Win32Cursor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Cursor.m; sourceTree = "<group>"; };
|
||||
6E2B560C0976075300DA0954 /* Win32DeviceContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32DeviceContext.m; sourceTree = "<group>"; };
|
||||
6E2B560E0976075300DA0954 /* Win32DeviceContextBitmap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32DeviceContextBitmap.m; sourceTree = "<group>"; };
|
||||
@ -994,20 +1023,16 @@
|
||||
6E2B56140976075300DA0954 /* Win32Display.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Display.m; sourceTree = "<group>"; };
|
||||
6E2B56160976075300DA0954 /* Win32Event.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Event.m; sourceTree = "<group>"; };
|
||||
6E2B56180976075400DA0954 /* Win32Font.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Font.m; sourceTree = "<group>"; };
|
||||
6E2B561A0976075400DA0954 /* Win32GraphicsContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32GraphicsContext.m; sourceTree = "<group>"; };
|
||||
6E2B561C0976075400DA0954 /* Win32GraphicsState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32GraphicsState.m; sourceTree = "<group>"; };
|
||||
6E2B561E0976075400DA0954 /* Win32Region.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Region.m; sourceTree = "<group>"; };
|
||||
6E2B56200976075400DA0954 /* Win32Window.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Window.m; sourceTree = "<group>"; };
|
||||
6E2B56220976075400DA0954 /* Win32Application.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Application.m; sourceTree = "<group>"; };
|
||||
6E2B56240976075400DA0954 /* Win32SplashPanel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32SplashPanel.m; sourceTree = "<group>"; };
|
||||
6E2B56260976075400DA0954 /* Win32RunningCopyPipe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32RunningCopyPipe.m; sourceTree = "<group>"; };
|
||||
6E2B56280976075400DA0954 /* Win32EventInputSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32EventInputSource.m; sourceTree = "<group>"; };
|
||||
6E2B562A0976075400DA0954 /* Win32RenderingContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32RenderingContext.m; sourceTree = "<group>"; };
|
||||
6E2B562C0976075400DA0954 /* Win32Workspace.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Win32Workspace.m; sourceTree = "<group>"; };
|
||||
6E2B562E0976075400DA0954 /* NSSavePanel-Win32.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSSavePanel-Win32.m"; sourceTree = "<group>"; };
|
||||
6E2B56300976075400DA0954 /* NSOpenPanel-Win32.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSOpenPanel-Win32.m"; sourceTree = "<group>"; };
|
||||
6E2B56320976075400DA0954 /* NSPlatform-Win32.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSPlatform-Win32.m"; sourceTree = "<group>"; };
|
||||
6E2B56350976075400DA0954 /* Win32Brush.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Brush.h; sourceTree = "<group>"; };
|
||||
6E2B56370976075400DA0954 /* Win32Cursor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Cursor.h; sourceTree = "<group>"; };
|
||||
6E2B56390976075400DA0954 /* Win32DeviceContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32DeviceContext.h; sourceTree = "<group>"; };
|
||||
6E2B563B0976075400DA0954 /* Win32DeviceContextBitmap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32DeviceContextBitmap.h; sourceTree = "<group>"; };
|
||||
@ -1016,15 +1041,12 @@
|
||||
6E2B56410976075400DA0954 /* Win32Display.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Display.h; sourceTree = "<group>"; };
|
||||
6E2B56430976075400DA0954 /* Win32Event.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Event.h; sourceTree = "<group>"; };
|
||||
6E2B56450976075400DA0954 /* Win32Font.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Font.h; sourceTree = "<group>"; };
|
||||
6E2B56470976075400DA0954 /* Win32GraphicsContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32GraphicsContext.h; sourceTree = "<group>"; };
|
||||
6E2B56490976075400DA0954 /* Win32GraphicsState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32GraphicsState.h; sourceTree = "<group>"; };
|
||||
6E2B564B0976075400DA0954 /* Win32Region.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Region.h; sourceTree = "<group>"; };
|
||||
6E2B564D0976075400DA0954 /* Win32Window.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Window.h; sourceTree = "<group>"; };
|
||||
6E2B564F0976075400DA0954 /* Win32Application.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Application.h; sourceTree = "<group>"; };
|
||||
6E2B56510976075400DA0954 /* Win32SplashPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32SplashPanel.h; sourceTree = "<group>"; };
|
||||
6E2B56530976075400DA0954 /* Win32RunningCopyPipe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32RunningCopyPipe.h; sourceTree = "<group>"; };
|
||||
6E2B56550976075400DA0954 /* Win32EventInputSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32EventInputSource.h; sourceTree = "<group>"; };
|
||||
6E2B56570976075400DA0954 /* Win32RenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32RenderingContext.h; sourceTree = "<group>"; };
|
||||
6E2B56590976075400DA0954 /* Win32Workspace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Win32Workspace.h; sourceTree = "<group>"; };
|
||||
6E2B565B0976075400DA0954 /* NSSavePanel-Win32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSSavePanel-Win32.h"; sourceTree = "<group>"; };
|
||||
6E2B565D0976075400DA0954 /* NSOpenPanel-Win32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSOpenPanel-Win32.h"; sourceTree = "<group>"; };
|
||||
@ -1142,6 +1164,44 @@
|
||||
6ECABDF80A3FA2B700AD7F7B /* NSCustomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCustomView.m; sourceTree = "<group>"; };
|
||||
6ECABE310A40520700AD7F7B /* NSNibKeyedUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSNibKeyedUnarchiver.h; sourceTree = "<group>"; };
|
||||
6ECABE320A40520700AD7F7B /* NSNibKeyedUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSNibKeyedUnarchiver.m; sourceTree = "<group>"; };
|
||||
FE064AA90B8B805000853FBB /* CGColor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGColor.h; sourceTree = "<group>"; };
|
||||
FE064AAA0B8B805000853FBB /* CGColor.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGColor.m; sourceTree = "<group>"; };
|
||||
FE064AAB0B8B805000853FBB /* CGColorSpace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGColorSpace.h; sourceTree = "<group>"; };
|
||||
FE064AAC0B8B805000853FBB /* CGColorSpace.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGColorSpace.m; sourceTree = "<group>"; };
|
||||
FE064AAD0B8B805000853FBB /* CGDataProvider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGDataProvider.h; sourceTree = "<group>"; };
|
||||
FE064AAE0B8B805000853FBB /* CGDataProvider.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGDataProvider.m; sourceTree = "<group>"; };
|
||||
FE064AAF0B8B805000853FBB /* CGFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGFunction.h; sourceTree = "<group>"; };
|
||||
FE064AB00B8B805000853FBB /* CGFunction.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGFunction.m; sourceTree = "<group>"; };
|
||||
FE064AB30B8B805000853FBB /* CGLayer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGLayer.h; sourceTree = "<group>"; };
|
||||
FE064AB40B8B805000853FBB /* CGLayer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGLayer.m; sourceTree = "<group>"; };
|
||||
FE064AB50B8B805000853FBB /* CGPath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGPath.h; sourceTree = "<group>"; };
|
||||
FE064AB60B8B805000853FBB /* CGPath.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGPath.m; sourceTree = "<group>"; };
|
||||
FE064AB70B8B805000853FBB /* CGPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGPattern.h; sourceTree = "<group>"; };
|
||||
FE064AB80B8B805000853FBB /* CGPattern.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGPattern.m; sourceTree = "<group>"; };
|
||||
FE064AB90B8B805000853FBB /* CGShading.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGShading.h; sourceTree = "<group>"; };
|
||||
FE064ABA0B8B805000853FBB /* CGShading.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGShading.m; sourceTree = "<group>"; };
|
||||
FE064ABB0B8B805000853FBB /* KGColor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGColor.h; sourceTree = "<group>"; };
|
||||
FE064ABC0B8B805000853FBB /* KGColor.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGColor.m; sourceTree = "<group>"; };
|
||||
FE064ABF0B8B805000853FBB /* KGImage_context.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGImage_context.h; sourceTree = "<group>"; };
|
||||
FE064AC00B8B805000853FBB /* KGImage_context.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGImage_context.m; sourceTree = "<group>"; };
|
||||
FE064AC10B8B805000853FBB /* KGLayer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGLayer.h; sourceTree = "<group>"; };
|
||||
FE064AC20B8B805000853FBB /* KGLayer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGLayer.m; sourceTree = "<group>"; };
|
||||
FE064AC30B8B805000853FBB /* KGPath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGPath.h; sourceTree = "<group>"; };
|
||||
FE064AC40B8B805000853FBB /* KGPath.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGPath.m; sourceTree = "<group>"; };
|
||||
FE064AC50B8B805000853FBB /* KGPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGPattern.h; sourceTree = "<group>"; };
|
||||
FE064AC60B8B805000853FBB /* KGPattern.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGPattern.m; sourceTree = "<group>"; };
|
||||
FE267E830B8BCC3C0000DDC0 /* KGImageSource_JPEG.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGImageSource_JPEG.h; sourceTree = "<group>"; };
|
||||
FE267E840B8BCC3C0000DDC0 /* KGImageSource_JPEG.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGImageSource_JPEG.m; sourceTree = "<group>"; };
|
||||
FE267E850B8BCC3C0000DDC0 /* KGImageSource_PNG.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGImageSource_PNG.h; sourceTree = "<group>"; };
|
||||
FE267E860B8BCC3C0000DDC0 /* KGImageSource_PNG.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGImageSource_PNG.m; sourceTree = "<group>"; };
|
||||
FE267E870B8BCC3C0000DDC0 /* KGImageSource_TIFF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGImageSource_TIFF.h; sourceTree = "<group>"; };
|
||||
FE267E880B8BCC3C0000DDC0 /* KGImageSource_TIFF.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGImageSource_TIFF.m; sourceTree = "<group>"; };
|
||||
FE267E890B8BCC3C0000DDC0 /* KGImageSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGImageSource.h; sourceTree = "<group>"; };
|
||||
FE267E8A0B8BCC3C0000DDC0 /* KGImageSource.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGImageSource.m; sourceTree = "<group>"; };
|
||||
FE267EB30B8BD2690000DDC0 /* CGBitmapContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGBitmapContext.h; sourceTree = "<group>"; };
|
||||
FE267EB40B8BD2690000DDC0 /* CGBitmapContext.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGBitmapContext.m; sourceTree = "<group>"; };
|
||||
FE267EB50B8BD2690000DDC0 /* KGBitmapContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGBitmapContext.h; sourceTree = "<group>"; };
|
||||
FE267EB60B8BD2690000DDC0 /* KGBitmapContext.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGBitmapContext.m; sourceTree = "<group>"; };
|
||||
FE2A101D0B44A201006C03DE /* NSAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAlert.h; sourceTree = "<group>"; };
|
||||
FE2A101E0B44A201006C03DE /* NSAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAlert.m; sourceTree = "<group>"; };
|
||||
FE2A10280B44A26B006C03DE /* NSArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSArrayController.h; sourceTree = "<group>"; };
|
||||
@ -1260,6 +1320,10 @@
|
||||
FE64B8E00B81239D007EE513 /* KGShading.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGShading.m; sourceTree = "<group>"; };
|
||||
FE64B9200B8123F1007EE513 /* CGImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGImage.h; sourceTree = "<group>"; };
|
||||
FE64B9210B8123F1007EE513 /* CGImage.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CGImage.m; sourceTree = "<group>"; };
|
||||
FEEF00570B96441800069FD1 /* CGPDFPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPDFPage.h; sourceTree = "<group>"; };
|
||||
FEEF00580B96441800069FD1 /* CGPDFPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPDFPage.m; sourceTree = "<group>"; };
|
||||
FEF33BFF0B93543C00DC0B6F /* KGMutablePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KGMutablePath.h; sourceTree = "<group>"; };
|
||||
FEF33C000B93543C00DC0B6F /* KGMutablePath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KGMutablePath.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -1299,6 +1363,7 @@
|
||||
6E2B53240976075200DA0954 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FE267E7F0B8BCB660000DDC0 /* ImageIO */,
|
||||
6E2B53FC0976075200DA0954 /* AppKit.h */,
|
||||
6E2B53FA0976075200DA0954 /* AppKitExport.h */,
|
||||
6E2B55B20976075300DA0954 /* CoreGraphics */,
|
||||
@ -1549,10 +1614,6 @@
|
||||
6E2B53DB0976075200DA0954 /* NSTextFieldCell.m */,
|
||||
FE2A114D0B45C608006C03DE /* NSTextTable */,
|
||||
6E2B55680976075300DA0954 /* NSTextView */,
|
||||
6E14EC6509A3C40F009C8693 /* NSTIFFImageFileDirectory.h */,
|
||||
6E14EC6609A3C40F009C8693 /* NSTIFFImageFileDirectory.m */,
|
||||
6E14EC6709A3C40F009C8693 /* NSTIFFReader.h */,
|
||||
6E14EC6809A3C40F009C8693 /* NSTIFFReader.m */,
|
||||
FE2A11520B45C65E006C03DE /* NSTokenField.h */,
|
||||
FE2A11530B45C65E006C03DE /* NSTokenField.m */,
|
||||
FE2A115A0B45C66A006C03DE /* NSTokenFieldCell.h */,
|
||||
@ -1737,25 +1798,43 @@
|
||||
children = (
|
||||
6E2B55CB0976075300DA0954 /* CGAffineTransform.h */,
|
||||
6E2B55B80976075300DA0954 /* CGAffineTransform.m */,
|
||||
FE267EB30B8BD2690000DDC0 /* CGBitmapContext.h */,
|
||||
FE267EB40B8BD2690000DDC0 /* CGBitmapContext.m */,
|
||||
FE064AA90B8B805000853FBB /* CGColor.h */,
|
||||
FE064AAA0B8B805000853FBB /* CGColor.m */,
|
||||
FE064AAB0B8B805000853FBB /* CGColorSpace.h */,
|
||||
FE064AAC0B8B805000853FBB /* CGColorSpace.m */,
|
||||
6E2B55C70976075300DA0954 /* CGContext.h */,
|
||||
6E2B55B40976075300DA0954 /* CGContext.m */,
|
||||
6E2B55D30976075300DA0954 /* CGContextSimple.h */,
|
||||
6E2B55BE0976075300DA0954 /* CGContextSimple.m */,
|
||||
FE064AAD0B8B805000853FBB /* CGDataProvider.h */,
|
||||
FE064AAE0B8B805000853FBB /* CGDataProvider.m */,
|
||||
6E2B55D90976075300DA0954 /* CGEvent.h */,
|
||||
6E2B55C40976075300DA0954 /* CGEvent.m */,
|
||||
6E2B55CD0976075300DA0954 /* CGFont.h */,
|
||||
6E2B55BA0976075300DA0954 /* CGFont.m */,
|
||||
FE064AAF0B8B805000853FBB /* CGFunction.h */,
|
||||
FE064AB00B8B805000853FBB /* CGFunction.m */,
|
||||
6E2B55C90976075300DA0954 /* CGGeometry.h */,
|
||||
6E2B55B60976075300DA0954 /* CGGeometry.m */,
|
||||
6E2B55D10976075300DA0954 /* CGGraphicsState.h */,
|
||||
6E2B55BC0976075300DA0954 /* CGGraphicsState.m */,
|
||||
FE64B9200B8123F1007EE513 /* CGImage.h */,
|
||||
FE64B9210B8123F1007EE513 /* CGImage.m */,
|
||||
6E2B55D50976075300DA0954 /* CGRenderingContext.h */,
|
||||
6E2B55C00976075300DA0954 /* CGRenderingContext.m */,
|
||||
FE064AB30B8B805000853FBB /* CGLayer.h */,
|
||||
FE064AB40B8B805000853FBB /* CGLayer.m */,
|
||||
FE064AB50B8B805000853FBB /* CGPath.h */,
|
||||
FE064AB60B8B805000853FBB /* CGPath.m */,
|
||||
FE064AB70B8B805000853FBB /* CGPattern.h */,
|
||||
FE064AB80B8B805000853FBB /* CGPattern.m */,
|
||||
FEEF00570B96441800069FD1 /* CGPDFPage.h */,
|
||||
FEEF00580B96441800069FD1 /* CGPDFPage.m */,
|
||||
FE064AB90B8B805000853FBB /* CGShading.h */,
|
||||
FE064ABA0B8B805000853FBB /* CGShading.m */,
|
||||
6E2B55D70976075300DA0954 /* CGWindow.h */,
|
||||
6E2B55C20976075300DA0954 /* CGWindow.m */,
|
||||
6E2B55CF0976075300DA0954 /* CoreGraphics.h */,
|
||||
FE267EB50B8BD2690000DDC0 /* KGBitmapContext.h */,
|
||||
FE267EB60B8BD2690000DDC0 /* KGBitmapContext.m */,
|
||||
FE064ABB0B8B805000853FBB /* KGColor.h */,
|
||||
FE064ABC0B8B805000853FBB /* KGColor.m */,
|
||||
FE64B8A70B81239D007EE513 /* KGColorSpace.h */,
|
||||
FE64B8A80B81239D007EE513 /* KGColorSpace.m */,
|
||||
FE64B8A90B81239D007EE513 /* KGContext.h */,
|
||||
@ -1764,8 +1843,20 @@
|
||||
FE64B8AC0B81239D007EE513 /* KGDataProvider.m */,
|
||||
FE64B8AD0B81239D007EE513 /* KGFunction.h */,
|
||||
FE64B8AE0B81239D007EE513 /* KGFunction.m */,
|
||||
6E2B55D10976075300DA0954 /* KGGraphicsState.h */,
|
||||
6E2B55BC0976075300DA0954 /* KGGraphicsState.m */,
|
||||
FE64B8AF0B81239D007EE513 /* KGImage.h */,
|
||||
FE64B8B00B81239D007EE513 /* KGImage.m */,
|
||||
FE064ABF0B8B805000853FBB /* KGImage_context.h */,
|
||||
FE064AC00B8B805000853FBB /* KGImage_context.m */,
|
||||
FE064AC10B8B805000853FBB /* KGLayer.h */,
|
||||
FE064AC20B8B805000853FBB /* KGLayer.m */,
|
||||
FEF33BFF0B93543C00DC0B6F /* KGMutablePath.h */,
|
||||
FEF33C000B93543C00DC0B6F /* KGMutablePath.m */,
|
||||
FE064AC30B8B805000853FBB /* KGPath.h */,
|
||||
FE064AC40B8B805000853FBB /* KGPath.m */,
|
||||
FE064AC50B8B805000853FBB /* KGPattern.h */,
|
||||
FE064AC60B8B805000853FBB /* KGPattern.m */,
|
||||
FE64B8B10B81239D007EE513 /* KGPDFArray.h */,
|
||||
FE64B8B20B81239D007EE513 /* KGPDFArray.m */,
|
||||
FE64B8B30B81239D007EE513 /* KGPDFContentStream.h */,
|
||||
@ -1812,6 +1903,8 @@
|
||||
FE64B8DC0B81239D007EE513 /* KGPDFxref.m */,
|
||||
FE64B8DD0B81239D007EE513 /* KGPDFxrefEntry.h */,
|
||||
FE64B8DE0B81239D007EE513 /* KGPDFxrefEntry.m */,
|
||||
6E2B55D50976075300DA0954 /* KGRenderingContext.h */,
|
||||
6E2B55C00976075300DA0954 /* KGRenderingContext.m */,
|
||||
FE64B8DF0B81239D007EE513 /* KGShading.h */,
|
||||
FE64B8E00B81239D007EE513 /* KGShading.m */,
|
||||
);
|
||||
@ -1870,8 +1963,6 @@
|
||||
6E2B562E0976075400DA0954 /* NSSavePanel-Win32.m */,
|
||||
6E2B564F0976075400DA0954 /* Win32Application.h */,
|
||||
6E2B56220976075400DA0954 /* Win32Application.m */,
|
||||
6E2B56350976075400DA0954 /* Win32Brush.h */,
|
||||
6E2B56080976075300DA0954 /* Win32Brush.m */,
|
||||
6E2B56370976075400DA0954 /* Win32Cursor.h */,
|
||||
6E2B560A0976075300DA0954 /* Win32Cursor.m */,
|
||||
6E2B56390976075400DA0954 /* Win32DeviceContext.h */,
|
||||
@ -1891,14 +1982,8 @@
|
||||
6E2B56280976075400DA0954 /* Win32EventInputSource.m */,
|
||||
6E2B56450976075400DA0954 /* Win32Font.h */,
|
||||
6E2B56180976075400DA0954 /* Win32Font.m */,
|
||||
6E2B56470976075400DA0954 /* Win32GraphicsContext.h */,
|
||||
6E2B561A0976075400DA0954 /* Win32GraphicsContext.m */,
|
||||
6E2B56490976075400DA0954 /* Win32GraphicsState.h */,
|
||||
6E2B561C0976075400DA0954 /* Win32GraphicsState.m */,
|
||||
6E2B564B0976075400DA0954 /* Win32Region.h */,
|
||||
6E2B561E0976075400DA0954 /* Win32Region.m */,
|
||||
6E2B56570976075400DA0954 /* Win32RenderingContext.h */,
|
||||
6E2B562A0976075400DA0954 /* Win32RenderingContext.m */,
|
||||
6E2B56530976075400DA0954 /* Win32RunningCopyPipe.h */,
|
||||
6E2B56260976075400DA0954 /* Win32RunningCopyPipe.m */,
|
||||
6E2B56510976075400DA0954 /* Win32SplashPanel.h */,
|
||||
@ -2110,6 +2195,25 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE267E7F0B8BCB660000DDC0 /* ImageIO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FE267E890B8BCC3C0000DDC0 /* KGImageSource.h */,
|
||||
FE267E8A0B8BCC3C0000DDC0 /* KGImageSource.m */,
|
||||
FE267E830B8BCC3C0000DDC0 /* KGImageSource_JPEG.h */,
|
||||
FE267E840B8BCC3C0000DDC0 /* KGImageSource_JPEG.m */,
|
||||
FE267E850B8BCC3C0000DDC0 /* KGImageSource_PNG.h */,
|
||||
FE267E860B8BCC3C0000DDC0 /* KGImageSource_PNG.m */,
|
||||
FE267E870B8BCC3C0000DDC0 /* KGImageSource_TIFF.h */,
|
||||
FE267E880B8BCC3C0000DDC0 /* KGImageSource_TIFF.m */,
|
||||
6E14EC6509A3C40F009C8693 /* NSTIFFImageFileDirectory.h */,
|
||||
6E14EC6609A3C40F009C8693 /* NSTIFFImageFileDirectory.m */,
|
||||
6E14EC6709A3C40F009C8693 /* NSTIFFReader.h */,
|
||||
6E14EC6809A3C40F009C8693 /* NSTIFFReader.m */,
|
||||
);
|
||||
path = ImageIO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE2A10250B44A239006C03DE /* NSController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -2285,16 +2389,14 @@
|
||||
6E2B55CC0976075300DA0954 /* CGAffineTransform.h in Headers */,
|
||||
6E2B55CE0976075300DA0954 /* CGFont.h in Headers */,
|
||||
6E2B55D00976075300DA0954 /* CoreGraphics.h in Headers */,
|
||||
6E2B55D20976075300DA0954 /* CGGraphicsState.h in Headers */,
|
||||
6E2B55D40976075300DA0954 /* CGContextSimple.h in Headers */,
|
||||
6E2B55D60976075300DA0954 /* CGRenderingContext.h in Headers */,
|
||||
6E2B55D20976075300DA0954 /* KGGraphicsState.h in Headers */,
|
||||
6E2B55D60976075300DA0954 /* KGRenderingContext.h in Headers */,
|
||||
6E2B55D80976075300DA0954 /* CGWindow.h in Headers */,
|
||||
6E2B55DA0976075300DA0954 /* CGEvent.h in Headers */,
|
||||
6E2B55EB0976075300DA0954 /* NSColorPicker.h in Headers */,
|
||||
6E2B55ED0976075300DA0954 /* NSColorPickerColorList.h in Headers */,
|
||||
6E2B55EF0976075300DA0954 /* NSBrowserCellColorList.h in Headers */,
|
||||
6E2B55F10976075300DA0954 /* NSColorPickerSliders.h in Headers */,
|
||||
6E2B56360976075400DA0954 /* Win32Brush.h in Headers */,
|
||||
6E2B56380976075400DA0954 /* Win32Cursor.h in Headers */,
|
||||
6E2B563A0976075400DA0954 /* Win32DeviceContext.h in Headers */,
|
||||
6E2B563C0976075400DA0954 /* Win32DeviceContextBitmap.h in Headers */,
|
||||
@ -2303,15 +2405,12 @@
|
||||
6E2B56420976075400DA0954 /* Win32Display.h in Headers */,
|
||||
6E2B56440976075400DA0954 /* Win32Event.h in Headers */,
|
||||
6E2B56460976075400DA0954 /* Win32Font.h in Headers */,
|
||||
6E2B56480976075400DA0954 /* Win32GraphicsContext.h in Headers */,
|
||||
6E2B564A0976075400DA0954 /* Win32GraphicsState.h in Headers */,
|
||||
6E2B564C0976075400DA0954 /* Win32Region.h in Headers */,
|
||||
6E2B564E0976075400DA0954 /* Win32Window.h in Headers */,
|
||||
6E2B56500976075400DA0954 /* Win32Application.h in Headers */,
|
||||
6E2B56520976075400DA0954 /* Win32SplashPanel.h in Headers */,
|
||||
6E2B56540976075400DA0954 /* Win32RunningCopyPipe.h in Headers */,
|
||||
6E2B56560976075400DA0954 /* Win32EventInputSource.h in Headers */,
|
||||
6E2B56580976075400DA0954 /* Win32RenderingContext.h in Headers */,
|
||||
6E2B565A0976075400DA0954 /* Win32Workspace.h in Headers */,
|
||||
6E2B565C0976075400DA0954 /* NSSavePanel-Win32.h in Headers */,
|
||||
6E2B565E0976075400DA0954 /* NSOpenPanel-Win32.h in Headers */,
|
||||
@ -2428,6 +2527,27 @@
|
||||
FE64B9170B81239D007EE513 /* KGPDFxrefEntry.h in Headers */,
|
||||
FE64B9190B81239D007EE513 /* KGShading.h in Headers */,
|
||||
FE64B9220B8123F1007EE513 /* CGImage.h in Headers */,
|
||||
FE064AC70B8B805000853FBB /* CGColor.h in Headers */,
|
||||
FE064AC90B8B805000853FBB /* CGColorSpace.h in Headers */,
|
||||
FE064ACB0B8B805000853FBB /* CGDataProvider.h in Headers */,
|
||||
FE064ACD0B8B805000853FBB /* CGFunction.h in Headers */,
|
||||
FE064AD10B8B805000853FBB /* CGLayer.h in Headers */,
|
||||
FE064AD30B8B805000853FBB /* CGPath.h in Headers */,
|
||||
FE064AD50B8B805000853FBB /* CGPattern.h in Headers */,
|
||||
FE064AD70B8B805000853FBB /* CGShading.h in Headers */,
|
||||
FE064AD90B8B805000853FBB /* KGColor.h in Headers */,
|
||||
FE064ADD0B8B805000853FBB /* KGImage_context.h in Headers */,
|
||||
FE064ADF0B8B805000853FBB /* KGLayer.h in Headers */,
|
||||
FE064AE10B8B805000853FBB /* KGPath.h in Headers */,
|
||||
FE064AE30B8B805000853FBB /* KGPattern.h in Headers */,
|
||||
FE267E8B0B8BCC3C0000DDC0 /* KGImageSource_JPEG.h in Headers */,
|
||||
FE267E8D0B8BCC3C0000DDC0 /* KGImageSource_PNG.h in Headers */,
|
||||
FE267E8F0B8BCC3C0000DDC0 /* KGImageSource_TIFF.h in Headers */,
|
||||
FE267E910B8BCC3C0000DDC0 /* KGImageSource.h in Headers */,
|
||||
FE267EB70B8BD2690000DDC0 /* CGBitmapContext.h in Headers */,
|
||||
FE267EB90B8BD2690000DDC0 /* KGBitmapContext.h in Headers */,
|
||||
FEF33C010B93543C00DC0B6F /* KGMutablePath.h in Headers */,
|
||||
FEEF00590B96441800069FD1 /* CGPDFPage.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -2697,16 +2817,14 @@
|
||||
6E2B55B70976075300DA0954 /* CGGeometry.m in Sources */,
|
||||
6E2B55B90976075300DA0954 /* CGAffineTransform.m in Sources */,
|
||||
6E2B55BB0976075300DA0954 /* CGFont.m in Sources */,
|
||||
6E2B55BD0976075300DA0954 /* CGGraphicsState.m in Sources */,
|
||||
6E2B55BF0976075300DA0954 /* CGContextSimple.m in Sources */,
|
||||
6E2B55C10976075300DA0954 /* CGRenderingContext.m in Sources */,
|
||||
6E2B55BD0976075300DA0954 /* KGGraphicsState.m in Sources */,
|
||||
6E2B55C10976075300DA0954 /* KGRenderingContext.m in Sources */,
|
||||
6E2B55C30976075300DA0954 /* CGWindow.m in Sources */,
|
||||
6E2B55C50976075300DA0954 /* CGEvent.m in Sources */,
|
||||
6E2B55E20976075300DA0954 /* NSColorPicker.m in Sources */,
|
||||
6E2B55E40976075300DA0954 /* NSColorPickerColorList.m in Sources */,
|
||||
6E2B55E60976075300DA0954 /* NSBrowserCellColorList.m in Sources */,
|
||||
6E2B55E80976075300DA0954 /* NSColorPickerSliders.m in Sources */,
|
||||
6E2B56090976075300DA0954 /* Win32Brush.m in Sources */,
|
||||
6E2B560B0976075300DA0954 /* Win32Cursor.m in Sources */,
|
||||
6E2B560D0976075300DA0954 /* Win32DeviceContext.m in Sources */,
|
||||
6E2B560F0976075300DA0954 /* Win32DeviceContextBitmap.m in Sources */,
|
||||
@ -2715,15 +2833,12 @@
|
||||
6E2B56150976075300DA0954 /* Win32Display.m in Sources */,
|
||||
6E2B56170976075400DA0954 /* Win32Event.m in Sources */,
|
||||
6E2B56190976075400DA0954 /* Win32Font.m in Sources */,
|
||||
6E2B561B0976075400DA0954 /* Win32GraphicsContext.m in Sources */,
|
||||
6E2B561D0976075400DA0954 /* Win32GraphicsState.m in Sources */,
|
||||
6E2B561F0976075400DA0954 /* Win32Region.m in Sources */,
|
||||
6E2B56210976075400DA0954 /* Win32Window.m in Sources */,
|
||||
6E2B56230976075400DA0954 /* Win32Application.m in Sources */,
|
||||
6E2B56250976075400DA0954 /* Win32SplashPanel.m in Sources */,
|
||||
6E2B56270976075400DA0954 /* Win32RunningCopyPipe.m in Sources */,
|
||||
6E2B56290976075400DA0954 /* Win32EventInputSource.m in Sources */,
|
||||
6E2B562B0976075400DA0954 /* Win32RenderingContext.m in Sources */,
|
||||
6E2B562D0976075400DA0954 /* Win32Workspace.m in Sources */,
|
||||
6E2B562F0976075400DA0954 /* NSSavePanel-Win32.m in Sources */,
|
||||
6E2B56310976075400DA0954 /* NSOpenPanel-Win32.m in Sources */,
|
||||
@ -2841,6 +2956,27 @@
|
||||
FE64B9180B81239D007EE513 /* KGPDFxrefEntry.m in Sources */,
|
||||
FE64B91A0B81239D007EE513 /* KGShading.m in Sources */,
|
||||
FE64B9230B8123F1007EE513 /* CGImage.m in Sources */,
|
||||
FE064AC80B8B805000853FBB /* CGColor.m in Sources */,
|
||||
FE064ACA0B8B805000853FBB /* CGColorSpace.m in Sources */,
|
||||
FE064ACC0B8B805000853FBB /* CGDataProvider.m in Sources */,
|
||||
FE064ACE0B8B805000853FBB /* CGFunction.m in Sources */,
|
||||
FE064AD20B8B805000853FBB /* CGLayer.m in Sources */,
|
||||
FE064AD40B8B805000853FBB /* CGPath.m in Sources */,
|
||||
FE064AD60B8B805000853FBB /* CGPattern.m in Sources */,
|
||||
FE064AD80B8B805000853FBB /* CGShading.m in Sources */,
|
||||
FE064ADA0B8B805000853FBB /* KGColor.m in Sources */,
|
||||
FE064ADE0B8B805000853FBB /* KGImage_context.m in Sources */,
|
||||
FE064AE00B8B805000853FBB /* KGLayer.m in Sources */,
|
||||
FE064AE20B8B805000853FBB /* KGPath.m in Sources */,
|
||||
FE064AE40B8B805000853FBB /* KGPattern.m in Sources */,
|
||||
FE267E8C0B8BCC3C0000DDC0 /* KGImageSource_JPEG.m in Sources */,
|
||||
FE267E8E0B8BCC3C0000DDC0 /* KGImageSource_PNG.m in Sources */,
|
||||
FE267E900B8BCC3C0000DDC0 /* KGImageSource_TIFF.m in Sources */,
|
||||
FE267E920B8BCC3C0000DDC0 /* KGImageSource.m in Sources */,
|
||||
FE267EB80B8BD2690000DDC0 /* CGBitmapContext.m in Sources */,
|
||||
FE267EBA0B8BD2690000DDC0 /* KGBitmapContext.m in Sources */,
|
||||
FEF33C020B93543C00DC0B6F /* KGMutablePath.m in Sources */,
|
||||
FEEF005A0B96441800069FD1 /* CGPDFPage.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -2893,10 +3029,10 @@
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-shared",
|
||||
"-lOLE32",
|
||||
"-lGDI32",
|
||||
"-lUSER32",
|
||||
"-lCOMDLG32",
|
||||
"-lole32",
|
||||
"-lgdi32",
|
||||
"-luser32",
|
||||
"-lcomdlg32",
|
||||
"-Wl,--enable-auto-import",
|
||||
"-Wl,--export-all-symbols",
|
||||
"-Wl,--out-implib,$TARGET_BUILD_DIR/AppKit.framework/libAppKit.a",
|
||||
|
18
AppKit/CoreGraphics.subproj/CGContextSimple.h → AppKit/CoreGraphics.subproj/CGBitmapContext.h
Executable file → Normal file
18
AppKit/CoreGraphics.subproj/CGContextSimple.h → AppKit/CoreGraphics.subproj/CGBitmapContext.h
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
@ -6,18 +6,6 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/CGContext.h>
|
||||
|
||||
@class CGRenderingContext;
|
||||
|
||||
@interface CGContextSimple : CGContext {
|
||||
CGRenderingContext *_renderingContext;
|
||||
CGAffineTransform _deviceTransform;
|
||||
NSRect _clipRect;
|
||||
|
||||
NSMutableArray *_stateStack;
|
||||
}
|
||||
|
||||
-initWithRenderingContext:(CGRenderingContext *)renderingContext transform:(CGAffineTransform)deviceTransform clipRect:(NSRect)clipRect;
|
||||
|
||||
@end
|
||||
#import <AppKit/CGImage.h>
|
11
AppKit/CoreGraphics.subproj/CGBitmapContext.m
Normal file
11
AppKit/CoreGraphics.subproj/CGBitmapContext.m
Normal file
@ -0,0 +1,11 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGBitmapContext.h>
|
||||
#import "KGBitmapContext.h"
|
||||
|
13
AppKit/CoreGraphics.subproj/CGColor.h
Normal file
13
AppKit/CoreGraphics.subproj/CGColor.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGColor;
|
||||
|
||||
typedef KGColor *CGColorRef;
|
10
AppKit/CoreGraphics.subproj/CGColor.m
Normal file
10
AppKit/CoreGraphics.subproj/CGColor.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGColor.h>
|
||||
#import "KGColor.h"
|
27
AppKit/CoreGraphics.subproj/CGColorSpace.h
Normal file
27
AppKit/CoreGraphics.subproj/CGColorSpace.h
Normal file
@ -0,0 +1,27 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
|
||||
@class KGColorSpace;
|
||||
|
||||
typedef KGColorSpace *CGColorSpaceRef;
|
||||
|
||||
typedef enum {
|
||||
kCGRenderingIntentDefault,
|
||||
kCGRenderingIntentAbsoluteColorimetric,
|
||||
kCGRenderingIntentRelativeColorimetric,
|
||||
kCGRenderingIntentSaturation,
|
||||
kCGRenderingIntentPerceptual,
|
||||
} CGColorRenderingIntent;
|
||||
|
||||
APPKIT_EXPORT void CGColorSpaceRelease(CGColorSpaceRef colorSpace);
|
||||
|
||||
APPKIT_EXPORT CGColorSpaceRef CGColorSpaceCreateDeviceRGB();
|
19
AppKit/CoreGraphics.subproj/CGColorSpace.m
Normal file
19
AppKit/CoreGraphics.subproj/CGColorSpace.m
Normal file
@ -0,0 +1,19 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGColorSpace.h>
|
||||
#import "KGColorSpace.h"
|
||||
|
||||
void CGColorSpaceRelease(CGColorSpaceRef colorSpace) {
|
||||
return [colorSpace release];
|
||||
}
|
||||
|
||||
CGColorSpaceRef CGColorSpaceCreateDeviceRGB() {
|
||||
return [[KGColorSpace alloc] initWithDeviceRGB];
|
||||
}
|
||||
|
@ -1,85 +1,202 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted,free of charge,to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction,including without limitation the rights to use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of the Software,and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
#import <AppKit/CGGeometry.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
#import <AppKit/CGImage.h>
|
||||
#import <AppKit/CGColor.h>
|
||||
#import <AppKit/CGPath.h>
|
||||
#import <AppKit/CGPattern.h>
|
||||
#import <AppKit/CGShading.h>
|
||||
#import <AppKit/CGPDFPage.h>
|
||||
#import <AppKit/CGLayer.h>
|
||||
|
||||
@class CGRenderingContext;
|
||||
|
||||
@interface CGContext : NSObject
|
||||
|
||||
@end
|
||||
@class NSDictionary;
|
||||
|
||||
typedef enum {
|
||||
kCGEncodingFontSpecific
|
||||
} CGTextEncoding;
|
||||
|
||||
typedef CGContext *CGContextRef;
|
||||
typedef int CGLineCap;
|
||||
typedef int CGLineJoin;
|
||||
typedef int CGPathDrawingMode;
|
||||
typedef int CGInterpolationQuality;
|
||||
typedef int CGBlendMode;
|
||||
typedef int CGTextDrawingMode;
|
||||
|
||||
APPKIT_EXPORT void CGContextSaveGState(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextRestoreGState(CGContextRef context);
|
||||
@class KGContext;
|
||||
|
||||
APPKIT_EXPORT CGAffineTransform CGContextGetCTM(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextConcatCTM(CGContextRef context,CGAffineTransform transform);
|
||||
APPKIT_EXPORT void CGContextTranslateCTM(CGContextRef context,float translatex,float translatey);
|
||||
APPKIT_EXPORT void CGContextScaleCTM(CGContextRef context,float scalex,float scaley);
|
||||
APPKIT_EXPORT void CGContextRotateCTM(CGContextRef context,float radians);
|
||||
typedef KGContext *CGContextRef;
|
||||
|
||||
APPKIT_EXPORT CGAffineTransform CGContextGetTextMatrix(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextSetTextMatrix(CGContextRef context, CGAffineTransform transform);
|
||||
APPKIT_EXPORT CGContextRef CGContextRetain(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextRelease(CGContextRef context);
|
||||
|
||||
APPKIT_EXPORT void CGContextClipToRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextClipToRects(CGContextRef context,const CGRect *rects,unsigned count);
|
||||
// context state
|
||||
APPKIT_EXPORT void CGContextSetAllowsAntialiasing(CGContextRef context,BOOL yesOrNo);
|
||||
|
||||
// layers
|
||||
APPKIT_EXPORT void CGContextBeginTransparencyLayer(CGContextRef context,NSDictionary *unused);
|
||||
APPKIT_EXPORT void CGContextEndTransparencyLayer(CGContextRef context);
|
||||
|
||||
// path
|
||||
APPKIT_EXPORT BOOL CGContextIsPathEmpty(CGContextRef context);
|
||||
APPKIT_EXPORT CGPoint CGContextGetPathCurrentPoint(CGContextRef context);
|
||||
APPKIT_EXPORT CGRect CGContextGetPathBoundingBox(CGContextRef context);
|
||||
APPKIT_EXPORT BOOL CGContextPathContainsPoint(CGContextRef context,CGPoint point,CGPathDrawingMode pathMode);
|
||||
|
||||
APPKIT_EXPORT void CGContextBeginPath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextClosePath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextMoveToPoint(CGContextRef context,float x,float y);
|
||||
APPKIT_EXPORT void CGContextAddLineToPoint(CGContextRef context,float x,float y);
|
||||
APPKIT_EXPORT void CGContextAddArc(CGContextRef context,float x,float y,float radius,float startRadian,float endRadian,int clockwise);
|
||||
APPKIT_EXPORT void CGContextAddArcToPoint(CGContextRef context,float x1,float y1,float x2,float y2,float radius);
|
||||
APPKIT_EXPORT void CGContextAddCurveToPoint(CGContextRef context,float cx1,float cy1,float cx2,float cy2,float x,float y);
|
||||
APPKIT_EXPORT void CGContextAddQuadCurveToPoint(CGContextRef context,float cx1,float cy1,float x,float y);
|
||||
|
||||
APPKIT_EXPORT void CGContextFillPath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextFillRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextFillRects(CGContextRef context,const CGRect *rects,unsigned count);
|
||||
APPKIT_EXPORT void CGContextAddLines(CGContextRef context,const CGPoint *points,unsigned count);
|
||||
APPKIT_EXPORT void CGContextAddRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextAddRects(CGContextRef context,const CGRect *rects,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextAddArc(CGContextRef context,float x,float y,float radius,float startRadian,float endRadian,BOOL clockwise);
|
||||
APPKIT_EXPORT void CGContextAddArcToPoint(CGContextRef context,float x1,float y1,float x2,float y2,float radius);
|
||||
APPKIT_EXPORT void CGContextAddEllipseInRect(CGContextRef context,CGRect rect);
|
||||
|
||||
APPKIT_EXPORT void CGContextAddPath(CGContextRef context,CGPathRef path);
|
||||
|
||||
APPKIT_EXPORT void CGContextReplacePathWithStrokedPath(CGContextRef context);
|
||||
|
||||
// gstate
|
||||
|
||||
APPKIT_EXPORT void CGContextSaveGState(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextRestoreGState(CGContextRef context);
|
||||
|
||||
APPKIT_EXPORT CGAffineTransform CGContextGetUserSpaceToDeviceSpaceTransform(CGContextRef context);
|
||||
APPKIT_EXPORT CGAffineTransform CGContextGetCTM(CGContextRef context);
|
||||
APPKIT_EXPORT CGRect CGContextGetClipBoundingBox(CGContextRef context);
|
||||
APPKIT_EXPORT CGAffineTransform CGContextGetTextMatrix(CGContextRef context);
|
||||
APPKIT_EXPORT CGInterpolationQuality CGContextGetInterpolationQuality(CGContextRef context);
|
||||
APPKIT_EXPORT CGPoint CGContextGetTextPosition(CGContextRef context);
|
||||
|
||||
APPKIT_EXPORT CGPoint CGContextConvertPointToDeviceSpace(CGContextRef context,CGPoint point);
|
||||
APPKIT_EXPORT CGPoint CGContextConvertPointToUserSpace(CGContextRef context,CGPoint point);
|
||||
APPKIT_EXPORT CGSize CGContextConvertSizeToDeviceSpace(CGContextRef context,CGSize size);
|
||||
APPKIT_EXPORT CGSize CGContextConvertSizeToUserSpace(CGContextRef context,CGSize size);
|
||||
APPKIT_EXPORT CGRect CGContextConvertRectToDeviceSpace(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT CGRect CGContextConvertRectToUserSpace(CGContextRef context,CGRect rect);
|
||||
|
||||
APPKIT_EXPORT void CGContextConcatCTM(CGContextRef context,CGAffineTransform matrix);
|
||||
APPKIT_EXPORT void CGContextTranslateCTM(CGContextRef context,float translatex,float translatey);
|
||||
APPKIT_EXPORT void CGContextScaleCTM(CGContextRef context,float scalex,float scaley);
|
||||
APPKIT_EXPORT void CGContextRotateCTM(CGContextRef context,float radians);
|
||||
|
||||
APPKIT_EXPORT void CGContextClip(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextEOClip(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextClipToMask(CGContextRef context,CGRect rect,CGImageRef image);
|
||||
APPKIT_EXPORT void CGContextClipToRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextClipToRects(CGContextRef context,const CGRect *rects,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetStrokeColorSpace(CGContextRef context,CGColorSpaceRef colorSpace);
|
||||
APPKIT_EXPORT void CGContextSetFillColorSpace(CGContextRef context,CGColorSpaceRef colorSpace);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetStrokeColor(CGContextRef context,const float *components);
|
||||
APPKIT_EXPORT void CGContextSetStrokeColorWithColor(CGContextRef context,CGColorRef color);
|
||||
APPKIT_EXPORT void CGContextSetGrayStrokeColor(CGContextRef context,float gray,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetRGBStrokeColor(CGContextRef context,float r,float g,float b,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetCMYKStrokeColor(CGContextRef context,float c,float m,float y,float k,float alpha);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetFillColor(CGContextRef context,const float *components);
|
||||
APPKIT_EXPORT void CGContextSetFillColorWithColor(CGContextRef context,CGColorRef color);
|
||||
APPKIT_EXPORT void CGContextSetGrayFillColor(CGContextRef context,float gray,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetRGBFillColor(CGContextRef context,float r,float g,float b,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetCMYKFillColor(CGContextRef context,float c,float m,float y,float k,float alpha);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetAlpha(CGContextRef context,float alpha);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetPatternPhase(CGContextRef context,CGSize phase);
|
||||
APPKIT_EXPORT void CGContextSetStrokePattern(CGContextRef context,CGPatternRef pattern,const float *components);
|
||||
APPKIT_EXPORT void CGContextSetFillPattern(CGContextRef context,CGPatternRef pattern,const float *components);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetTextMatrix(CGContextRef context,CGAffineTransform matrix);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetTextPosition(CGContextRef context,float x,float y);
|
||||
APPKIT_EXPORT void CGContextSetCharacterSpacing(CGContextRef context,float spacing);
|
||||
APPKIT_EXPORT void CGContextSetTextDrawingMode(CGContextRef context,CGTextDrawingMode textMode);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetFont(CGContextRef context,CGFontRef font);
|
||||
APPKIT_EXPORT void CGContextSetFontSize(CGContextRef context,float size);
|
||||
APPKIT_EXPORT void CGContextSelectFont(CGContextRef context,const char *name,float size,CGTextEncoding encoding);
|
||||
APPKIT_EXPORT void CGContextSetShouldSmoothFonts(CGContextRef context,BOOL yesOrNo);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetLineWidth(CGContextRef context,float width);
|
||||
APPKIT_EXPORT void CGContextSetLineCap(CGContextRef context,CGLineCap lineCap);
|
||||
APPKIT_EXPORT void CGContextSetLineJoin(CGContextRef context,CGLineJoin lineJoin);
|
||||
APPKIT_EXPORT void CGContextSetMiterLimit(CGContextRef context,float miterLimit);
|
||||
APPKIT_EXPORT void CGContextSetLineDash(CGContextRef context,float phase,const float *lengths,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetRenderingIntent(CGContextRef context,CGColorRenderingIntent renderingIntent);
|
||||
APPKIT_EXPORT void CGContextSetBlendMode(CGContextRef context,CGBlendMode blendMode);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetFlatness(CGContextRef context,float flatness);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetInterpolationQuality(CGContextRef context,CGInterpolationQuality quality);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetShadowWithColor(CGContextRef context,CGSize offset,float blur,CGColorRef color);
|
||||
APPKIT_EXPORT void CGContextSetShadow(CGContextRef context,CGSize offset,float blur);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetShouldAntialias(CGContextRef context,BOOL yesOrNo);
|
||||
|
||||
// drawing
|
||||
APPKIT_EXPORT void CGContextStrokeLineSegments(CGContextRef context,const CGPoint *points,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextStrokePath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextStrokeRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextStrokeRectWithWidth(CGContextRef context,CGRect rect,float width);
|
||||
APPKIT_EXPORT void CGContextStrokeEllipseInRect(CGContextRef context,CGRect rect);
|
||||
|
||||
APPKIT_EXPORT void CGContextSelectFont(CGContextRef context,const char *name,float size,CGTextEncoding encoding);
|
||||
APPKIT_EXPORT void CGContextShowTextAtPoint(CGContextRef context,float x,float y,const char *text,unsigned count);
|
||||
APPKIT_EXPORT void CGContextFillRect(CGContextRef context,CGRect rect);
|
||||
APPKIT_EXPORT void CGContextFillRects(CGContextRef context,const CGRect *rects,unsigned count);
|
||||
APPKIT_EXPORT void CGContextFillEllipseInRect(CGContextRef context,CGRect rect);
|
||||
|
||||
APPKIT_EXPORT void CGContextDrawPath(CGContextRef context,CGPathDrawingMode pathMode);
|
||||
APPKIT_EXPORT void CGContextStrokePath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextFillPath(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextEOFillPath(CGContextRef context);
|
||||
|
||||
APPKIT_EXPORT void CGContextClearRect(CGContextRef context,CGRect rect);
|
||||
|
||||
APPKIT_EXPORT void CGContextShowGlyphs(CGContextRef context,const CGGlyph *glyphs,unsigned count);
|
||||
APPKIT_EXPORT void CGContextShowGlyphsAtPoint(CGContextRef context,float x,float y,const CGGlyph *glyphs,unsigned count);
|
||||
APPKIT_EXPORT void CGContextShowGlyphsWithAdvances(CGContextRef context,const CGGlyph *glyphs,const CGSize *advances,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextShowText(CGContextRef context,const char *text,unsigned count);
|
||||
APPKIT_EXPORT void CGContextShowTextAtPoint(CGContextRef context,float x,float y,const char *text,unsigned count);
|
||||
|
||||
APPKIT_EXPORT void CGContextDrawShading(CGContextRef context,CGShadingRef shading);
|
||||
APPKIT_EXPORT void CGContextDrawImage(CGContextRef context,CGRect rect,CGImageRef image);
|
||||
APPKIT_EXPORT void CGContextDrawLayerAtPoint(CGContextRef context,CGPoint point,CGLayerRef layer);
|
||||
APPKIT_EXPORT void CGContextDrawLayerInRect(CGContextRef context,CGRect rect,CGLayerRef layer);
|
||||
APPKIT_EXPORT void CGContextDrawPDFPage(CGContextRef context,CGPDFPageRef page);
|
||||
|
||||
APPKIT_EXPORT void CGContextFlush(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextSynchronize(CGContextRef context);
|
||||
|
||||
// pagination
|
||||
|
||||
APPKIT_EXPORT void CGContextBeginPage(CGContextRef context,const CGRect *mediaBox);
|
||||
APPKIT_EXPORT void CGContextEndPage(CGContextRef context);
|
||||
|
||||
// Temporary hacks
|
||||
|
||||
APPKIT_EXPORT void CGContextSetDeviceGrayColor(CGContextRef context,float gray,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetDeviceRGBColor(CGContextRef context,float red,float green,float blue,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetDeviceCMYKColor(CGContextRef context,float cyan,float magenta,float yellow,float black,float alpha);
|
||||
|
||||
APPKIT_EXPORT void CGContextSetCalibratedGrayColor(CGContextRef context,float gray,float alpha);
|
||||
APPKIT_EXPORT void CGContextSetCalibratedRGBColor(CGContextRef context,float red,float green,float blue,float alpha);
|
||||
|
||||
APPKIT_EXPORT void CGContextCopyBits(CGContextRef context,CGRect rect,CGPoint point,int gState);
|
||||
|
||||
APPKIT_EXPORT void CGContextSourceOverRGBAImage(CGContextRef context,CGRect rect,int width,int height,unsigned int *data,float fraction);
|
||||
|
||||
APPKIT_EXPORT void CGContextBitCopy(CGContextRef context,NSPoint dstOrigin,CGRenderingContext *deviceContext,NSPoint srcOrigin,NSSize size);
|
||||
|
||||
APPKIT_EXPORT void CGContextBeginDocument(CGContextRef context);
|
||||
APPKIT_EXPORT void CGContextScalePage(CGContextRef context,float scalex,float scaley);
|
||||
APPKIT_EXPORT void CGContextEndDocument(CGContextRef context);
|
||||
|
@ -1,120 +1,49 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted,free of charge,to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction,including without limitation the rights to use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of the Software,and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/CGContext.h>
|
||||
#import "KGContext.h"
|
||||
|
||||
@interface CGContext(CGContext_private)
|
||||
|
||||
-(void)saveGState;
|
||||
-(void)restoreGState;
|
||||
|
||||
-(CGAffineTransform)getCTM;
|
||||
-(void)concatCTM:(CGAffineTransform)transform;
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley;
|
||||
-(void)translateCTM:(float)translatex:(float)translatey;
|
||||
-(void)rotateCTM:(float)radians;
|
||||
|
||||
-(CGAffineTransform)textMatrix;
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform;
|
||||
|
||||
-(void)clipToRect:(NSRect)rect;
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count;
|
||||
|
||||
-(void)beginPath;
|
||||
-(void)closePath;
|
||||
-(void)moveToPoint:(float)x:(float)y;
|
||||
-(void)addLineToPoint:(float)x:(float)y;
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise;
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius;
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y;
|
||||
|
||||
-(void)fillPath;
|
||||
-(void)fillRects:(const CGRect *)rects count:(unsigned)count;
|
||||
|
||||
-(void)setLineWidth:(float)width;
|
||||
|
||||
-(void)strokePath;
|
||||
-(void)strokeRect:(CGRect)rect width:(float)width;
|
||||
|
||||
-(void)selectFontWithName:(NSString *)name pointSize:(float)pointSize;
|
||||
-(void)moveto:(float)x:(float)y show:(const char *)cString:(int)length;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs:(unsigned)numberOfGlyphs atPoint:(NSPoint)point;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs advances:(const CGSize *)advances count:(unsigned)count;
|
||||
|
||||
-(void)beginPage:(const CGRect *)mediaBox;
|
||||
-(void)endPage;
|
||||
|
||||
-(void)setDeviceColorWhite:(float)white alpha:(float)alpha;
|
||||
-(void)setDeviceColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
|
||||
-(void)setDeviceColorCyan:(float)cyan magenta:(float)magenta yellow:(float)yellow black:(float)black alpha:(float)alpha;
|
||||
|
||||
-(void)setCalibratedColorWhite:(float)white alpha:(float)alpha;
|
||||
-(void)setCalibratedColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point gState:(int)gState;
|
||||
|
||||
-(void)drawRGBAImageInRect:(NSRect)rect width:(int)width height:(int)height data:(unsigned int *)data fraction:(float)fraction;
|
||||
|
||||
-(void)bitCopyToPoint:(NSPoint)dstOrigin renderingContext:(CGRenderingContext *)renderingContext fromPoint:(NSPoint)srcOrigin size:(NSSize)size;
|
||||
|
||||
-(void)beginDocument;
|
||||
-(void)scalePage:(float)scalex:(float)scaley;
|
||||
-(void)endDocument;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CGContext
|
||||
|
||||
@end
|
||||
|
||||
void CGContextSaveGState(CGContext *context){
|
||||
[context saveGState];
|
||||
CGContextRef CGContextRetain(CGContextRef context) {
|
||||
return [context retain];
|
||||
}
|
||||
|
||||
void CGContextRestoreGState(CGContext *context){
|
||||
[context restoreGState];
|
||||
void CGContextRelease(CGContextRef context) {
|
||||
[context release];
|
||||
}
|
||||
|
||||
CGAffineTransform CGContextGetCTM(CGContext *context) {
|
||||
return [context getCTM];
|
||||
void CGContextSetAllowsAntialiasing(CGContextRef context,BOOL yesOrNo) {
|
||||
[context setAllowsAntialiasing:yesOrNo];
|
||||
}
|
||||
|
||||
void CGContextConcatCTM(CGContext *context,CGAffineTransform transform) {
|
||||
[context concatCTM:transform];
|
||||
void CGContextBeginTransparencyLayer(CGContextRef context,NSDictionary *unused) {
|
||||
[context beginTransparencyLayerWithInfo:unused];
|
||||
}
|
||||
|
||||
void CGContextScaleCTM(CGContext *context,float scalex,float scaley){
|
||||
[context scaleCTM:scalex:scaley];
|
||||
void CGContextEndTransparencyLayer(CGContextRef context) {
|
||||
[context endTransparencyLayer];
|
||||
}
|
||||
|
||||
void CGContextTranslateCTM(CGContext *context,float tx,float ty){
|
||||
[context translateCTM:tx:ty];
|
||||
BOOL CGContextIsPathEmpty(CGContextRef context) {
|
||||
return [context pathIsEmpty];
|
||||
}
|
||||
|
||||
void CGContextRotateCTM(CGContext *context,float radians) {
|
||||
[context rotateCTM:radians];
|
||||
CGPoint CGContextGetPathCurrentPoint(CGContextRef context) {
|
||||
return [context pathCurrentPoint];
|
||||
}
|
||||
|
||||
CGAffineTransform CGContextGetTextMatrix(CGContextRef context) {
|
||||
return [context textMatrix];
|
||||
CGRect CGContextGetPathBoundingBox(CGContextRef context) {
|
||||
return [context pathBoundingBox];
|
||||
}
|
||||
|
||||
void CGContextSetTextMatrix(CGContextRef context, CGAffineTransform transform) {
|
||||
[context setTextMatrix:transform];
|
||||
}
|
||||
|
||||
void CGContextClipToRect(CGContext *context, CGRect rect){
|
||||
[context clipToRect:rect];
|
||||
}
|
||||
|
||||
void CGContextClipToRects(CGContext *context,const CGRect *rects,unsigned count) {
|
||||
[context clipToRects:rects count:count];
|
||||
BOOL CGContextPathContainsPoint(CGContextRef context,CGPoint point,CGPathDrawingMode pathMode) {
|
||||
return [context pathContainsPoint:point drawingMode:pathMode];
|
||||
}
|
||||
|
||||
void CGContextBeginPath(CGContextRef context) {
|
||||
@ -133,7 +62,27 @@ void CGContextAddLineToPoint(CGContextRef context,float x,float y) {
|
||||
[context addLineToPoint:x:y];
|
||||
}
|
||||
|
||||
void CGContextAddArc(CGContextRef context,float x,float y,float radius,float startRadian,float endRadian,int clockwise) {
|
||||
void CGContextAddCurveToPoint(CGContextRef context,float cx1,float cy1,float cx2,float cy2,float x,float y) {
|
||||
[context addCurveToPoint:cx1:cy1:cx2:cy2:x:y];
|
||||
}
|
||||
|
||||
void CGContextAddQuadCurveToPoint(CGContextRef context,float cx1,float cy1,float x,float y) {
|
||||
[context addQuadCurveToPoint:cx1:cy1:x:y];
|
||||
}
|
||||
|
||||
void CGContextAddLines(CGContextRef context,const CGPoint *points,unsigned count) {
|
||||
[context addLinesWithPoints:points count:count];
|
||||
}
|
||||
|
||||
void CGContextAddRect(CGContextRef context,CGRect rect) {
|
||||
[context addRect:rect];
|
||||
}
|
||||
|
||||
void CGContextAddRects(CGContextRef context,const CGRect *rects,unsigned count) {
|
||||
[context addRects:rects count:count];
|
||||
}
|
||||
|
||||
void CGContextAddArc(CGContextRef context,float x,float y,float radius,float startRadian,float endRadian,BOOL clockwise) {
|
||||
[context addArc:x:y:radius:startRadian:endRadian:clockwise];
|
||||
}
|
||||
|
||||
@ -141,104 +90,385 @@ void CGContextAddArcToPoint(CGContextRef context,float x1,float y1,float x2,floa
|
||||
[context addArcToPoint:x1:y1:x2:y2:radius];
|
||||
}
|
||||
|
||||
|
||||
void CGContextAddCurveToPoint(CGContextRef context,float cx1,float cy1,float cx2,float cy2,float x,float y) {
|
||||
[context addCurveToPoint:cx1:cy1:cx2:cy2:x:y];
|
||||
void CGContextAddEllipseInRect(CGContextRef context,CGRect rect) {
|
||||
[context addEllipseInRect:rect];
|
||||
}
|
||||
|
||||
void CGContextFillPath(CGContextRef context) {
|
||||
[context fillPath];
|
||||
void CGContextAddPath(CGContextRef context,CGPathRef path) {
|
||||
[context addPath:path];
|
||||
}
|
||||
|
||||
void CGContextFillRect(CGContext *context,CGRect rect) {
|
||||
[context fillRects:&rect count:1];
|
||||
void CGContextReplacePathWithStrokedPath(CGContextRef context) {
|
||||
[context replacePathWithStrokedPath];
|
||||
}
|
||||
|
||||
void CGContextFillRects(CGContext *context,const CGRect *rects,unsigned count) {
|
||||
[context fillRects:rects count:count];
|
||||
void CGContextSaveGState(CGContextRef context){
|
||||
[context saveGState];
|
||||
}
|
||||
|
||||
void CGContextRestoreGState(CGContextRef context){
|
||||
[context restoreGState];
|
||||
}
|
||||
|
||||
CGAffineTransform CGContextGetUserSpaceToDeviceSpaceTransform(CGContextRef context) {
|
||||
return [context userSpaceToDeviceSpaceTransform];
|
||||
}
|
||||
|
||||
CGAffineTransform CGContextGetCTM(CGContextRef context) {
|
||||
return [context ctm];
|
||||
}
|
||||
|
||||
CGRect CGContextGetClipBoundingBox(CGContextRef context) {
|
||||
return [context clipBoundingBox];
|
||||
}
|
||||
|
||||
CGAffineTransform CGContextGetTextMatrix(CGContextRef context) {
|
||||
return [context textMatrix];
|
||||
}
|
||||
|
||||
CGInterpolationQuality CGContextGetInterpolationQuality(CGContextRef context) {
|
||||
return [context interpolationQuality];
|
||||
}
|
||||
|
||||
CGPoint CGContextGetTextPosition(CGContextRef context) {
|
||||
return [context textPosition];
|
||||
}
|
||||
|
||||
CGPoint CGContextConvertPointToDeviceSpace(CGContextRef context,CGPoint point) {
|
||||
return [context convertPointToDeviceSpace:point];
|
||||
}
|
||||
|
||||
CGPoint CGContextConvertPointToUserSpace(CGContextRef context,CGPoint point) {
|
||||
return [context convertPointToUserSpace:point];
|
||||
}
|
||||
|
||||
CGSize CGContextConvertSizeToDeviceSpace(CGContextRef context,CGSize size) {
|
||||
return [context convertSizeToDeviceSpace:size];
|
||||
}
|
||||
|
||||
CGSize CGContextConvertSizeToUserSpace(CGContextRef context,CGSize size) {
|
||||
return [context convertSizeToUserSpace:size];
|
||||
}
|
||||
|
||||
CGRect CGContextConvertRectToDeviceSpace(CGContextRef context,CGRect rect) {
|
||||
return [context convertRectToDeviceSpace:rect];
|
||||
}
|
||||
|
||||
CGRect CGContextConvertRectToUserSpace(CGContextRef context,CGRect rect) {
|
||||
return [context convertRectToUserSpace:rect];
|
||||
}
|
||||
|
||||
void CGContextConcatCTM(CGContextRef context,CGAffineTransform matrix) {
|
||||
[context concatCTM:matrix];
|
||||
}
|
||||
|
||||
void CGContextTranslateCTM(CGContextRef context,float tx,float ty){
|
||||
[context translateCTM:tx:ty];
|
||||
}
|
||||
|
||||
void CGContextScaleCTM(CGContextRef context,float scalex,float scaley){
|
||||
[context scaleCTM:scalex:scaley];
|
||||
}
|
||||
|
||||
void CGContextRotateCTM(CGContextRef context,float radians) {
|
||||
[context rotateCTM:radians];
|
||||
}
|
||||
|
||||
void CGContextClip(CGContextRef context) {
|
||||
[context clipToPath];
|
||||
}
|
||||
|
||||
void CGContextEOClip(CGContextRef context) {
|
||||
[context evenOddClipToPath];
|
||||
}
|
||||
|
||||
void CGContextClipToMask(CGContextRef context,CGRect rect,CGImageRef image) {
|
||||
[context clipToMask:image inRect:rect];
|
||||
}
|
||||
|
||||
void CGContextClipToRect(CGContextRef context,CGRect rect){
|
||||
[context clipToRect:rect];
|
||||
}
|
||||
|
||||
void CGContextClipToRects(CGContextRef context,const CGRect *rects,unsigned count) {
|
||||
[context clipToRects:rects count:count];
|
||||
}
|
||||
|
||||
void CGContextSetStrokeColorSpace(CGContextRef context,CGColorSpaceRef colorSpace) {
|
||||
[context setStrokeColorSpace:colorSpace];
|
||||
}
|
||||
|
||||
void CGContextSetFillColorSpace(CGContextRef context,CGColorSpaceRef colorSpace) {
|
||||
[context setFillColorSpace:colorSpace];
|
||||
}
|
||||
|
||||
void CGContextSetStrokeColor(CGContextRef context,const float *components) {
|
||||
[context setStrokeColorWithComponents:components];
|
||||
}
|
||||
|
||||
void CGContextSetStrokeColorWithColor(CGContextRef context,CGColorRef color) {
|
||||
[context setStrokeColor:color];
|
||||
}
|
||||
|
||||
void CGContextSetGrayStrokeColor(CGContextRef context,float gray,float alpha) {
|
||||
[context setGrayStrokeColor:gray:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetRGBStrokeColor(CGContextRef context,float r,float g,float b,float alpha) {
|
||||
[context setRGBStrokeColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetCMYKStrokeColor(CGContextRef context,float c,float m,float y,float k,float alpha) {
|
||||
[context setCMYKStrokeColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetFillColor(CGContextRef context,const float *components) {
|
||||
[context setFillColorWithComponents:components];
|
||||
}
|
||||
|
||||
void CGContextSetFillColorWithColor(CGContextRef context,CGColorRef color) {
|
||||
[context setFillColor:color];
|
||||
}
|
||||
|
||||
void CGContextSetGrayFillColor(CGContextRef context,float gray,float alpha) {
|
||||
[context setGrayFillColor:gray:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetRGBFillColor(CGContextRef context,float r,float g,float b,float alpha) {
|
||||
[context setRGBFillColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetCMYKFillColor(CGContextRef context,float c,float m,float y,float k,float alpha) {
|
||||
[context setCMYKFillColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetAlpha(CGContextRef context,float alpha) {
|
||||
[context setStrokeAndFillAlpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetPatternPhase(CGContextRef context,CGSize phase) {
|
||||
[context setPatternPhase:phase];
|
||||
}
|
||||
|
||||
void CGContextSetStrokePattern(CGContextRef context,CGPatternRef pattern,const float *components) {
|
||||
[context setStrokePattern:pattern components:components];
|
||||
}
|
||||
|
||||
void CGContextSetFillPattern(CGContextRef context,CGPatternRef pattern,const float *components) {
|
||||
[context setFillPattern:pattern components:components];
|
||||
}
|
||||
|
||||
void CGContextSetTextMatrix(CGContextRef context,CGAffineTransform matrix) {
|
||||
[context setTextMatrix:matrix];
|
||||
}
|
||||
|
||||
void CGContextSetTextPosition(CGContextRef context,float x,float y) {
|
||||
[context setTextPosition:x:y];
|
||||
}
|
||||
|
||||
void CGContextSetCharacterSpacing(CGContextRef context,float spacing) {
|
||||
[context setCharacterSpacing:spacing];
|
||||
}
|
||||
|
||||
void CGContextSetTextDrawingMode(CGContextRef context,CGTextDrawingMode textMode) {
|
||||
[context setTextDrawingMode:textMode];
|
||||
}
|
||||
|
||||
void CGContextSetFont(CGContextRef context,CGFontRef font) {
|
||||
[context setFont:font];
|
||||
}
|
||||
|
||||
void CGContextSetFontSize(CGContextRef context,float size) {
|
||||
[context setFontSize:size];
|
||||
}
|
||||
|
||||
void CGContextSelectFont(CGContextRef context,const char *name,float size,CGTextEncoding encoding) {
|
||||
[context selectFontWithName:name size:size encoding:encoding];
|
||||
}
|
||||
|
||||
void CGContextSetShouldSmoothFonts(CGContextRef context,BOOL yesOrNo) {
|
||||
[context setShouldSmoothFonts:yesOrNo];
|
||||
}
|
||||
|
||||
void CGContextSetLineWidth(CGContextRef context,float width) {
|
||||
[context setLineWidth:width];
|
||||
}
|
||||
|
||||
void CGContextSetLineCap(CGContextRef context,CGLineCap lineCap) {
|
||||
[context setLineCap:lineCap];
|
||||
}
|
||||
|
||||
void CGContextSetLineJoin(CGContextRef context,CGLineJoin lineJoin) {
|
||||
[context setLineJoin:lineJoin];
|
||||
}
|
||||
|
||||
void CGContextSetMiterLimit(CGContextRef context,float miterLimit) {
|
||||
[context setMiterLimit:miterLimit];
|
||||
}
|
||||
|
||||
void CGContextSetLineDash(CGContextRef context,float phase,const float *lengths,unsigned count) {
|
||||
[context setLineDashPhase:phase lengths:lengths count:count];
|
||||
}
|
||||
|
||||
void CGContextSetRenderingIntent(CGContextRef context,CGColorRenderingIntent renderingIntent) {
|
||||
[context setRenderingIntent:renderingIntent];
|
||||
}
|
||||
|
||||
void CGContextSetBlendMode(CGContextRef context,CGBlendMode blendMode) {
|
||||
[context setBlendMode:blendMode];
|
||||
}
|
||||
|
||||
void CGContextSetFlatness(CGContextRef context,float flatness) {
|
||||
[context setFlatness:flatness];
|
||||
}
|
||||
|
||||
void CGContextSetInterpolationQuality(CGContextRef context,CGInterpolationQuality quality) {
|
||||
[context setInterpolationQuality:quality];
|
||||
}
|
||||
|
||||
void CGContextSetShadowWithColor(CGContextRef context,CGSize offset,float blur,CGColorRef color) {
|
||||
[context setShadowOffset:offset blur:blur color:color];
|
||||
}
|
||||
|
||||
void CGContextSetShadow(CGContextRef context,CGSize offset,float blur) {
|
||||
[context setShadowOffset:offset blur:blur];
|
||||
}
|
||||
|
||||
void CGContextSetShouldAntialias(CGContextRef context,BOOL yesOrNo) {
|
||||
[context setShouldAntialias:yesOrNo];
|
||||
}
|
||||
|
||||
void CGContextStrokeLineSegments(CGContextRef context,const CGPoint *points,unsigned count) {
|
||||
[context strokeLineSegmentsWithPoints:points count:count];
|
||||
}
|
||||
|
||||
void CGContextStrokeRect(CGContextRef context,CGRect rect) {
|
||||
[context strokeRect:rect];
|
||||
}
|
||||
|
||||
void CGContextStrokeRectWithWidth(CGContextRef context,CGRect rect,float width) {
|
||||
[context strokeRect:rect width:width];
|
||||
}
|
||||
|
||||
void CGContextStrokeEllipseInRect(CGContextRef context,CGRect rect) {
|
||||
[context strokeEllipseInRect:rect];
|
||||
}
|
||||
|
||||
void CGContextFillRect(CGContextRef context,CGRect rect) {
|
||||
[context fillRect:rect];
|
||||
}
|
||||
|
||||
void CGContextFillRects(CGContextRef context,const CGRect *rects,unsigned count) {
|
||||
[context fillRects:rects count:count];
|
||||
}
|
||||
|
||||
void CGContextFillEllipseInRect(CGContextRef context,CGRect rect) {
|
||||
[context fillEllipseInRect:rect];
|
||||
}
|
||||
|
||||
void CGContextDrawPath(CGContextRef context,CGPathDrawingMode pathMode) {
|
||||
[context drawPath:pathMode];
|
||||
}
|
||||
|
||||
void CGContextStrokePath(CGContextRef context) {
|
||||
[context strokePath];
|
||||
}
|
||||
|
||||
void CGContextStrokeRect(CGContext *context,CGRect rect) {
|
||||
[context strokeRect:rect width:1.0];
|
||||
void CGContextFillPath(CGContextRef context) {
|
||||
[context fillPath];
|
||||
}
|
||||
|
||||
void CGContextStrokeRectWithWidth(CGContext *context,CGRect rect,float width) {
|
||||
[context strokeRect:rect width:width];
|
||||
void CGContextEOFillPath(CGContextRef context) {
|
||||
[context evenOddFillPath];
|
||||
}
|
||||
|
||||
void CGContextSelectFont(CGContext *context,const char *name,float size,CGTextEncoding encoding) {
|
||||
[context selectFontWithName:[NSString stringWithCString:name] pointSize:size];
|
||||
void CGContextClearRect(CGContextRef context,CGRect rect) {
|
||||
[context clearRect:rect];
|
||||
}
|
||||
|
||||
void CGContextShowTextAtPoint(CGContext *context,float x,float y,const char *text,unsigned length) {
|
||||
[context moveto:x:y show:text:length];
|
||||
void CGContextShowGlyphs(CGContextRef context,const CGGlyph *glyphs,unsigned count) {
|
||||
[context showGlyphs:glyphs count:count];
|
||||
}
|
||||
|
||||
void CGContextShowGlyphsAtPoint(CGContext *context,float x,float y,const CGGlyph *glyphs,unsigned count) {
|
||||
[context showGlyphs:glyphs:count atPoint:NSMakePoint(x,y)];
|
||||
void CGContextShowGlyphsAtPoint(CGContextRef context,float x,float y,const CGGlyph *glyphs,unsigned count) {
|
||||
[context showGlyphs:glyphs count:count atPoint:x:y];
|
||||
}
|
||||
|
||||
void CGContextShowGlyphsWithAdvances(CGContextRef context,const CGGlyph *glyphs,const CGSize *advances,unsigned count) {
|
||||
[context showGlyphs:glyphs advances:advances count:count];
|
||||
[context showGlyphs:glyphs count:count advances:advances];
|
||||
}
|
||||
|
||||
void CGContextBeginPage(CGContext *context,const CGRect *mediaBox) {
|
||||
void CGContextShowText(CGContextRef context,const char *text,unsigned count) {
|
||||
[context showText:text length:count];
|
||||
}
|
||||
|
||||
void CGContextShowTextAtPoint(CGContextRef context,float x,float y,const char *text,unsigned count) {
|
||||
[context showText:text length:count atPoint:x:y];
|
||||
}
|
||||
|
||||
void CGContextDrawShading(CGContextRef context,CGShadingRef shading) {
|
||||
[context drawShading:shading];
|
||||
}
|
||||
|
||||
void CGContextDrawImage(CGContextRef context,CGRect rect,CGImageRef image) {
|
||||
[context drawImage:image inRect:rect];
|
||||
}
|
||||
|
||||
void CGContextDrawLayerAtPoint(CGContextRef context,CGPoint point,CGLayerRef layer) {
|
||||
[context drawLayer:layer atPoint:point];
|
||||
}
|
||||
|
||||
void CGContextDrawLayerInRect(CGContextRef context,CGRect rect,CGLayerRef layer) {
|
||||
[context drawLayer:layer inRect:rect];
|
||||
}
|
||||
|
||||
void CGContextDrawPDFPage(CGContextRef context,CGPDFPageRef page) {
|
||||
[context drawPDFPage:page];
|
||||
}
|
||||
|
||||
void CGContextFlush(CGContextRef context) {
|
||||
[context flush];
|
||||
}
|
||||
|
||||
void CGContextSynchronize(CGContextRef context) {
|
||||
[context synchronize];
|
||||
}
|
||||
|
||||
void CGContextBeginPage(CGContextRef context,const CGRect *mediaBox) {
|
||||
[context beginPage:mediaBox];
|
||||
}
|
||||
|
||||
void CGContextEndPage(CGContext *context) {
|
||||
void CGContextEndPage(CGContextRef context) {
|
||||
[context endPage];
|
||||
}
|
||||
|
||||
void CGContextSetDeviceGrayColor(CGContext *context,float gray,float alpha) {
|
||||
[context setDeviceColorWhite:gray alpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetDeviceRGBColor(CGContext *context,float red,float green,float blue,float alpha) {
|
||||
[context setDeviceColorRed:red green:green blue:blue alpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetDeviceCMYKColor(CGContext *context,float cyan,float magenta,float yellow,float black,float alpha) {
|
||||
[context setDeviceColorCyan:cyan magenta:magenta yellow:yellow black:black alpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetCalibratedGrayColor(CGContext *context,float gray,float alpha) {
|
||||
|
||||
|
||||
/// temporary hacks
|
||||
void CGContextSetCalibratedGrayColor(CGContextRef context,float gray,float alpha) {
|
||||
[context setCalibratedColorWhite:gray alpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextSetCalibratedRGBColor(CGContext *context,float red,float green,float blue,float alpha) {
|
||||
void CGContextSetCalibratedRGBColor(CGContextRef context,float red,float green,float blue,float alpha) {
|
||||
[context setCalibratedColorRed:red green:green blue:blue alpha:alpha];
|
||||
}
|
||||
|
||||
void CGContextCopyBits(CGContext *context,CGRect rect,CGPoint point,int gState) {
|
||||
void CGContextCopyBits(CGContextRef context,CGRect rect,CGPoint point,int gState) {
|
||||
[context copyBitsInRect:rect toPoint:point gState:gState];
|
||||
}
|
||||
|
||||
void CGContextSourceOverRGBAImage(CGContext *context,CGRect rect,int width,int height,unsigned int *data,float fraction) {
|
||||
[context drawRGBAImageInRect:rect width:width height:height data:data fraction:fraction];
|
||||
}
|
||||
|
||||
void CGContextBitCopy(CGContext *context,NSPoint dstOrigin,CGRenderingContext *renderingContext,NSPoint srcOrigin,NSSize size) {
|
||||
[context bitCopyToPoint:dstOrigin renderingContext:renderingContext fromPoint:srcOrigin size:size];
|
||||
}
|
||||
|
||||
void CGContextBeginDocument(CGContext *context) {
|
||||
void CGContextBeginDocument(CGContextRef context) {
|
||||
[context beginDocument];
|
||||
}
|
||||
|
||||
void CGContextScalePage(CGContext *context,float scalex,float scaley) {
|
||||
void CGContextScalePage(CGContextRef context,float scalex,float scaley) {
|
||||
[context scalePage:scalex:scaley];
|
||||
}
|
||||
|
||||
void CGContextEndDocument(CGContext *context) {
|
||||
void CGContextEndDocument(CGContextRef context) {
|
||||
[context endDocument];
|
||||
}
|
||||
|
||||
|
@ -1,226 +0,0 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/CGContextSimple.h>
|
||||
#import <AppKit/CGGraphicsState.h>
|
||||
#import <AppKit/CGRenderingContext.h>
|
||||
|
||||
@implementation CGContextSimple
|
||||
|
||||
-initWithRenderingContext:(CGRenderingContext *)renderingContext transform:(CGAffineTransform)deviceTransform clipRect:(NSRect)clipRect {
|
||||
_renderingContext=[renderingContext retain];
|
||||
_deviceTransform=deviceTransform;
|
||||
_clipRect=clipRect;
|
||||
_stateStack=[NSMutableArray new];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_renderingContext release];
|
||||
[_stateStack release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
static inline CGGraphicsState *currentState(CGContextSimple *self){
|
||||
return [self->_stateStack lastObject];
|
||||
}
|
||||
|
||||
-(CGGraphicsState *)currentState {
|
||||
return currentState(self);
|
||||
}
|
||||
|
||||
-(void)saveGState {
|
||||
CGGraphicsState *current=currentState(self),*next;
|
||||
|
||||
[current save];
|
||||
next=[current copy];
|
||||
[_stateStack addObject:next];
|
||||
[next release];
|
||||
}
|
||||
|
||||
-(void)restoreGState {
|
||||
[[_stateStack lastObject] abort];
|
||||
[_stateStack removeLastObject];
|
||||
[currentState(self) restore];
|
||||
}
|
||||
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley {
|
||||
[currentState(self) scaleCTM:scalex:scaley];
|
||||
}
|
||||
|
||||
-(void)translateCTM:(float)tx:(float)ty {
|
||||
[currentState(self) translateCTM:tx:ty];
|
||||
}
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)transform {
|
||||
[currentState(self) concatCTM:transform];
|
||||
}
|
||||
|
||||
-(void)setLineWidth:(float)width {
|
||||
[currentState(self) setLineWidth:width];
|
||||
}
|
||||
|
||||
-(void)beginPath {
|
||||
[currentState(self) beginPath];
|
||||
}
|
||||
|
||||
-(void)moveToPoint:(float)x:(float)y {
|
||||
[currentState(self) moveToPoint:x:y];
|
||||
}
|
||||
|
||||
-(void)addLineToPoint:(float)x:(float)y {
|
||||
[currentState(self) addLineToPoint:x:y];
|
||||
}
|
||||
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y {
|
||||
[currentState(self) addCurveToPoint:cx1:cy1:cx2:cy2:x:y];
|
||||
}
|
||||
|
||||
-(void)closePath {
|
||||
[currentState(self) closePath];
|
||||
}
|
||||
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise {
|
||||
[currentState(self) addArc:x:y:radius:startRadian:endRadian:clockwise];
|
||||
}
|
||||
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius {
|
||||
[currentState(self) addArcToPoint:x1:y1:x2:y2:radius];
|
||||
}
|
||||
|
||||
-(void)fillPath {
|
||||
[currentState(self) fillPath];
|
||||
}
|
||||
|
||||
-(void)strokePath {
|
||||
[currentState(self) strokePath];
|
||||
}
|
||||
|
||||
-(void)setDeviceColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha {
|
||||
[currentState(self) setDeviceColorRed:red green:green blue:blue alpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setDeviceColorWhite:(float)white alpha:(float)alpha {
|
||||
[self setDeviceColorRed:white green:white blue:white alpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setDeviceColorCyan:(float)cyan magenta:(float)magenta yellow:(float)yellow black:(float)black alpha:(float)alpha {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)setCalibratedColorRed:(float)r green:(float)g blue:(float)b alpha:(float)alpha {
|
||||
// NeXT gamma is 2.2 I think, my PC card is probably 1.3. This should be
|
||||
// assumed = PC card setting
|
||||
// display = NeXT 2.2
|
||||
// I think.
|
||||
|
||||
const float assumedGamma=1.3;
|
||||
const float displayGamma=2.2;
|
||||
|
||||
r=pow(r,assumedGamma/displayGamma);
|
||||
if(r>1.0)
|
||||
r=1.0;
|
||||
|
||||
g=pow(g,assumedGamma/displayGamma);
|
||||
if(g>1.0)
|
||||
g=1.0;
|
||||
|
||||
b=pow(b,assumedGamma/displayGamma);
|
||||
if(b>1.0)
|
||||
b=1.0;
|
||||
|
||||
[self setDeviceColorRed:r green:g blue:b alpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setCalibratedColorWhite:(float)white alpha:(float)alpha {
|
||||
[self setCalibratedColorRed:white green:white blue:white alpha:alpha];
|
||||
}
|
||||
|
||||
-(void)selectFontWithName:(NSString *)name pointSize:(float)pointSize {
|
||||
[currentState(self) selectFontWithName:name pointSize:pointSize];
|
||||
}
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform {
|
||||
[currentState(self) setTextMatrix:transform];
|
||||
}
|
||||
|
||||
-(CGAffineTransform)textMatrix {
|
||||
return [currentState(self) textMatrix];
|
||||
}
|
||||
|
||||
-(void)moveto:(float)x:(float)y
|
||||
show:(const char *)cString:(int)length {
|
||||
[currentState(self) moveto:x:y ashow:cString:length:0:0];
|
||||
}
|
||||
|
||||
-(void)moveto:(float)x:(float)y
|
||||
ashow:(const char *)cString:(int)length:(float)dx:(float)dy {
|
||||
[currentState(self) moveto:x:y ashow:cString:length:dx:dy];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs:(unsigned)numberOfGlyphs atPoint:(NSPoint)point {
|
||||
[currentState(self) showGlyphs:glyphs:numberOfGlyphs atPoint:point];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs advances:(const CGSize *)advances count:(unsigned)count {
|
||||
[currentState(self) showGlyphs:glyphs advances:advances count:count];
|
||||
}
|
||||
|
||||
|
||||
-(void)drawRGBAImageInRect:(NSRect)rect width:(int)width height:(int)height data:(unsigned int *)data fraction:(float)fraction {
|
||||
[currentState(self) drawRGBAImageInRect:rect width:width height:height data:data fraction:fraction];
|
||||
}
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point gState:(int)gState {
|
||||
[currentState(self) copyBitsInRect:rect toPoint:point];
|
||||
}
|
||||
|
||||
-(void)fillRects:(const CGRect *)rects count:(unsigned)count {
|
||||
[currentState(self) fillRects:rects count:count];
|
||||
}
|
||||
|
||||
-(void)strokeRect:(CGRect)strokeRect width:(float)width {
|
||||
[currentState(self) strokeRect:strokeRect width:width];
|
||||
}
|
||||
|
||||
-(void)clipToRect:(NSRect)rect {
|
||||
[currentState(self) clipToRect:rect];
|
||||
}
|
||||
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count {
|
||||
[currentState(self) clipToRects:rects count:count];
|
||||
}
|
||||
|
||||
-(void)bitCopyToPoint:(NSPoint)dstOrigin renderingContext:(CGRenderingContext *)renderingContext fromPoint:(NSPoint)srcOrigin size:(NSSize)size {
|
||||
[currentState(self) bitCopyToPoint:dstOrigin renderingContext:renderingContext fromPoint:srcOrigin size:size];
|
||||
}
|
||||
|
||||
// printing
|
||||
|
||||
-(void)beginPage:(const CGRect *)mediaBox {
|
||||
[_renderingContext beginPage];
|
||||
}
|
||||
|
||||
-(void)endPage {
|
||||
[_renderingContext endPage];
|
||||
}
|
||||
|
||||
-(void)beginDocument {
|
||||
[_renderingContext beginDocument];
|
||||
}
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley {
|
||||
[_renderingContext scalePage:scalex:scaley];
|
||||
}
|
||||
|
||||
-(void)endDocument {
|
||||
[_renderingContext endDocument];
|
||||
}
|
||||
|
||||
@end
|
19
AppKit/CoreGraphics.subproj/CGDataProvider.h
Normal file
19
AppKit/CoreGraphics.subproj/CGDataProvider.h
Normal file
@ -0,0 +1,19 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
|
||||
@class KGDataProvider,NSData;
|
||||
|
||||
typedef KGDataProvider *CGDataProviderRef;
|
||||
|
||||
APPKIT_EXPORT CGDataProviderRef CGDataProviderRetain(CGDataProviderRef provider);
|
||||
APPKIT_EXPORT void CGDataProviderRelease(CGDataProviderRef provider);
|
||||
|
||||
APPKIT_EXPORT CGDataProviderRef CGDataProviderCreateWithCFData(NSData *data);
|
22
AppKit/CoreGraphics.subproj/CGDataProvider.m
Normal file
22
AppKit/CoreGraphics.subproj/CGDataProvider.m
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGDataProvider.h>
|
||||
#import "KGDataProvider.h"
|
||||
|
||||
APPKIT_EXPORT CGDataProviderRef CGDataProviderRetain(CGDataProviderRef provider) {
|
||||
return [provider retain];
|
||||
}
|
||||
|
||||
APPKIT_EXPORT void CGDataProviderRelease(CGDataProviderRef provider) {
|
||||
return [provider release];
|
||||
}
|
||||
|
||||
APPKIT_EXPORT CGDataProviderRef CGDataProviderCreateWithCFData(NSData *data) {
|
||||
return [[KGDataProvider alloc] initWithData:data];
|
||||
}
|
@ -8,4 +8,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class KGFont;
|
||||
|
||||
typedef KGFont *CGFontRef;
|
||||
|
||||
typedef unsigned short CGGlyph;
|
||||
|
13
AppKit/CoreGraphics.subproj/CGFunction.h
Normal file
13
AppKit/CoreGraphics.subproj/CGFunction.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGFunction;
|
||||
|
||||
typedef KGFunction *CGFunctionRef;
|
10
AppKit/CoreGraphics.subproj/CGFunction.m
Normal file
10
AppKit/CoreGraphics.subproj/CGFunction.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGFunction.h>
|
||||
#import "KGFunction.h"
|
@ -1,76 +0,0 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
#import <AppKit/CGGeometry.h>
|
||||
|
||||
@class CGRenderingContext;
|
||||
|
||||
@interface CGGraphicsState : NSObject <NSCopying> {
|
||||
CGRenderingContext *_renderingContext;
|
||||
CGAffineTransform _deviceTransform;
|
||||
NSRect _clipRect;
|
||||
}
|
||||
|
||||
-initWithRenderingContext:(CGRenderingContext *)context transform:(CGAffineTransform)deviceTransform clipRect:(NSRect)clipRect;
|
||||
|
||||
// primitives
|
||||
-(void)moveToPoint:(float)x:(float)y;
|
||||
-(void)addLineToPoint:(float)x:(float)y;
|
||||
// --
|
||||
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y;
|
||||
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise;
|
||||
|
||||
|
||||
-(void)save;
|
||||
-(void)restore;
|
||||
-(void)abort;
|
||||
|
||||
-(void)clipToRect:(NSRect)clipRect;
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count;
|
||||
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley;
|
||||
-(void)translateCTM:(float)tx:(float)ty;
|
||||
-(void)concatCTM:(CGAffineTransform)transform;
|
||||
|
||||
-(void)beginPath;
|
||||
-(void)closePath;
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius;
|
||||
-(void)fillPath;
|
||||
-(void)strokePath;
|
||||
|
||||
-(void)setDeviceColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
|
||||
|
||||
-(void)selectFontWithName:(NSString *)name pointSize:(float)pointSize;
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform;
|
||||
-(CGAffineTransform)textMatrix;
|
||||
-(void)moveto:(float)x:(float)y
|
||||
ashow:(const char *)cString:(int)length:(float)dx:(float)dy;
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs:(unsigned)numberOfGlyphs atPoint:(NSPoint)point;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs advances:(const CGSize *)advances count:(unsigned)count;
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point;
|
||||
-(void)fillRects:(const CGRect *)rects count:(unsigned)count;
|
||||
-(void)strokeRect:(CGRect)strokeRect width:(float)width;
|
||||
|
||||
-(float)lineWidth;
|
||||
-(void)setLineWidth:(float)width;
|
||||
|
||||
-(void)drawRGBAImageInRect:(NSRect)rect width:(int)width height:(int)height data:(unsigned int *)data fraction:(float)fraction;
|
||||
|
||||
-(void)bitCopyToPoint:(NSPoint)dstOrigin renderingContext:(CGRenderingContext *)renderingContext fromPoint:(NSPoint)srcOrigin size:(NSSize)size;
|
||||
|
||||
@end
|
||||
|
||||
void CGGraphicsSourceOver_rgba32_onto_bgrx32(unsigned char *sourceRGBA,unsigned char *resultRGBX,int width,int height,float fraction);
|
@ -1,268 +0,0 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/CGGraphicsState.h>
|
||||
#import <AppKit/CGRenderingContext.h>
|
||||
|
||||
#import <AppKit/CoreGraphics.h>
|
||||
|
||||
// Bezier and arc to bezier algorithms from: Windows Graphics Programming by Feng Yuan
|
||||
|
||||
@implementation CGGraphicsState
|
||||
|
||||
-initWithRenderingContext:(CGRenderingContext *)context transform:(CGAffineTransform)deviceTransform clipRect:(NSRect)clipRect {
|
||||
_renderingContext=[context retain];
|
||||
_deviceTransform=deviceTransform;
|
||||
_clipRect=clipRect;
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_renderingContext release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
CGGraphicsState *copy=NSCopyObject(self,0,zone);
|
||||
|
||||
copy->_renderingContext=[_renderingContext retain];
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
-(void)moveToPoint:(float)x:(float)y {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)addLineToPoint:(float)x:(float)y {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
static void bezier(CGGraphicsState *self,double x1,double y1,double x2, double y2,double x3,double y3,double x4,double y4){
|
||||
// Ax+By+C=0 is the line (x1,y1) (x4,y4);
|
||||
double A=y4-y1;
|
||||
double B=x1-x4;
|
||||
double C=y1*(x4-x1)-x1*(y4-y1);
|
||||
double AB=A*A+B*B;
|
||||
|
||||
if((A*x2+B*y2+C)*(A*x2+B*y2+C)<AB &&
|
||||
(A*x3+B*y3+C)*(A*x3+B*y3+C)<AB){
|
||||
[self moveToPoint:x1:y1];
|
||||
[self addLineToPoint:x4:y4];
|
||||
return;
|
||||
}
|
||||
else {
|
||||
double x12=x1+x2;
|
||||
double y12=y1+y2;
|
||||
double x23=x2+x3;
|
||||
double y23=y2+y3;
|
||||
double x34=x3+x4;
|
||||
double y34=y3+y4;
|
||||
double x1223=x12+x23;
|
||||
double y1223=y12+y23;
|
||||
double x2334=x23+x34;
|
||||
double y2334=y23+y34;
|
||||
double x=x1223+x2334;
|
||||
double y=y1223+y2334;
|
||||
|
||||
bezier(self,x1,y1,x12/2,y12/2,x1223/4,y1223/4,x/8,y/8);
|
||||
bezier(self,x/8,y/8,x2334/4,y2334/4,x34/2,y34/2,x4,y4);
|
||||
}
|
||||
}
|
||||
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y {
|
||||
// bezier(self,_currentPoint.x,_currentPoint.y,cx1,cy1,cx2,cy2,x,y);
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise {
|
||||
// This is not complete, doesn't handle clockwise and probably doesn't manipulate the current
|
||||
// point properly
|
||||
float radiusx=radius,radiusy=radius;
|
||||
double remainder=endRadian-startRadian;
|
||||
double delta=3.141592653589793238/2; // 90 degrees
|
||||
int i;
|
||||
|
||||
for(;remainder>0;startRadian+=delta,remainder-=delta){
|
||||
double sweepangle=(remainder>delta)?delta:remainder;
|
||||
double XY[8];
|
||||
NSPoint points[4];
|
||||
double B=sin(sweepangle/2);
|
||||
double C=cos(sweepangle/2);
|
||||
double A=1-C;
|
||||
double X=A*4/3;
|
||||
double Y=B-X*(1-A)/B;
|
||||
double s=sin(startRadian+sweepangle/2);
|
||||
double c=cos(startRadian+sweepangle/2);
|
||||
|
||||
XY[0]= C;
|
||||
XY[1]=-B;
|
||||
XY[2]= C+X;
|
||||
XY[3]=-Y;
|
||||
XY[4]= C+X;
|
||||
XY[5]= Y;
|
||||
XY[6]= C;
|
||||
XY[7]= B;
|
||||
|
||||
for(i=0;i<4;i++){
|
||||
points[i].x=x+(XY[i*2]*c-XY[i*2+1]*s)*radiusx;
|
||||
points[i].y=y+(XY[i*2]*s+XY[i*2+1]*c)*radiusy;
|
||||
}
|
||||
|
||||
[self moveToPoint:points[0].x:points[0].y];
|
||||
[self addCurveToPoint:points[1].x:points[1].y:points[2].x:points[2].y:points[3].x:points[3].y];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)save {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)restore {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)abort {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)clipToRect:(NSRect)clipRect {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)translateCTM:(float)tx:(float)ty {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)transform {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
|
||||
-(void)beginPath {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)closePath {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)fillPath {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)strokePath {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)setDeviceColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)selectFontWithName:(NSString *)name pointSize:(float)pointSize {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(CGAffineTransform)textMatrix {
|
||||
NSInvalidAbstractInvocation();
|
||||
return CGAffineTransformIdentity;
|
||||
}
|
||||
|
||||
-(void)moveto:(float)x:(float)y
|
||||
ashow:(const char *)cString:(int)length:(float)dx:(float)dy {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs:(unsigned)numberOfGlyphs atPoint:(NSPoint)point {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs advances:(const CGSize *)advances count:(unsigned)count {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)fillRects:(const CGRect *)rects count:(unsigned)count {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)strokeRect:(CGRect)strokeRect width:(float)width {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(float)lineWidth {
|
||||
NSInvalidAbstractInvocation();
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(void)setLineWidth:(float)width {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)drawRGBAImageInRect:(NSRect)rect width:(int)width height:(int)height data:(unsigned int *)data fraction:(float)fraction {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)bitCopyToPoint:(NSPoint)dstOrigin renderingContext:(CGRenderingContext *)renderingContext fromPoint:(NSPoint)srcOrigin size:(NSSize)size {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
void CGGraphicsSourceOver_rgba32_onto_bgrx32(unsigned char *sourceRGBA,unsigned char *resultBGRX,int width,int height,float fraction) {
|
||||
int sourceIndex=0;
|
||||
int sourceLength=width*height*4;
|
||||
int destinationReadIndex=0;
|
||||
int destinationWriteIndex=0;
|
||||
|
||||
while(sourceIndex<sourceLength){
|
||||
unsigned srcr=sourceRGBA[sourceIndex++];
|
||||
unsigned srcg=sourceRGBA[sourceIndex++];
|
||||
unsigned srcb=sourceRGBA[sourceIndex++];
|
||||
unsigned srca=sourceRGBA[sourceIndex++]*fraction;
|
||||
|
||||
unsigned dstb=resultBGRX[destinationReadIndex++];
|
||||
unsigned dstg=resultBGRX[destinationReadIndex++];
|
||||
unsigned dstr=resultBGRX[destinationReadIndex++];
|
||||
unsigned dsta=255-srca;
|
||||
|
||||
destinationReadIndex++;
|
||||
|
||||
dstr=(srcr*srca+dstr*dsta)>>8;
|
||||
dstg=(srcg*srca+dstg*dsta)>>8;
|
||||
dstb=(srcb*srca+dstb*dsta)>>8;
|
||||
|
||||
resultBGRX[destinationWriteIndex++]=dstb;
|
||||
resultBGRX[destinationWriteIndex++]=dstg;
|
||||
resultBGRX[destinationWriteIndex++]=dstr;
|
||||
destinationWriteIndex++; // skip x
|
||||
}
|
||||
}
|
@ -8,10 +8,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
|
||||
#import <AppKit/CGColorSpace.h>
|
||||
#import <AppKit/CGDataProvider.h>
|
||||
@class KGImage;
|
||||
|
||||
typedef KGImage *CGImageRef;
|
||||
|
||||
APPKIT_EXPORT void CGImageRetain(KGImage *image);
|
||||
typedef unsigned CGBitmapInfo;
|
||||
|
||||
APPKIT_EXPORT CGImageRef CGImageRetain(KGImage *image);
|
||||
APPKIT_EXPORT void CGImageRelease(KGImage *image);
|
||||
|
||||
APPKIT_EXPORT CGImageRef CGImageCreate(unsigned width,unsigned height,unsigned bitsPerComponent,unsigned bitsPerPixel,unsigned bytesPerRow,CGColorSpaceRef colorSpace,CGBitmapInfo bitmapInfo,CGDataProviderRef dataProvider,const float *decode,BOOL interpolate,CGColorRenderingIntent renderingIntent);
|
||||
|
@ -6,14 +6,19 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "CGImage.h"
|
||||
#import <AppKit/CGImage.h>
|
||||
#import "KGImage.h"
|
||||
|
||||
void CGImageRetain(KGImage *image) {
|
||||
[image retain];
|
||||
CGImageRef CGImageRetain(KGImage *image) {
|
||||
return [image retain];
|
||||
}
|
||||
|
||||
void CGImageRelease(KGImage *image) {
|
||||
[image release];
|
||||
}
|
||||
|
||||
CGImageRef CGImageCreate(unsigned width,unsigned height,unsigned bitsPerComponent,unsigned bitsPerPixel,unsigned bytesPerRow,CGColorSpaceRef colorSpace,CGBitmapInfo bitmapInfo,CGDataProviderRef dataProvider,const float *decode,BOOL interpolate,CGColorRenderingIntent renderingIntent) {
|
||||
return [[KGImage alloc] initWithWidth:width height:height bitsPerComponent:bitsPerComponent bitsPerPixel:bitsPerPixel bytesPerRow:bytesPerRow colorSpace:colorSpace bitmapInfo:bitmapInfo provider:dataProvider decode:decode interpolate:interpolate renderingIntent:renderingIntent];
|
||||
|
||||
}
|
||||
|
||||
|
13
AppKit/CoreGraphics.subproj/CGLayer.h
Normal file
13
AppKit/CoreGraphics.subproj/CGLayer.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGLayer;
|
||||
|
||||
typedef KGLayer *CGLayerRef;
|
10
AppKit/CoreGraphics.subproj/CGLayer.m
Normal file
10
AppKit/CoreGraphics.subproj/CGLayer.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGLayer.h>
|
||||
#import "KGLayer.h"
|
13
AppKit/CoreGraphics.subproj/CGPDFPage.h
Normal file
13
AppKit/CoreGraphics.subproj/CGPDFPage.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGPDFPage;
|
||||
|
||||
typedef KGPDFPage *CGPDFPageRef;
|
9
AppKit/CoreGraphics.subproj/CGPDFPage.m
Normal file
9
AppKit/CoreGraphics.subproj/CGPDFPage.m
Normal file
@ -0,0 +1,9 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGPDFPage.h>
|
15
AppKit/CoreGraphics.subproj/CGPath.h
Normal file
15
AppKit/CoreGraphics.subproj/CGPath.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGPath,KGMutablePath;
|
||||
|
||||
typedef KGPath *CGPathRef;
|
||||
|
||||
typedef KGMutablePath *CGMutablePathRef;
|
10
AppKit/CoreGraphics.subproj/CGPath.m
Normal file
10
AppKit/CoreGraphics.subproj/CGPath.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGPath.h>
|
||||
#import "KGPath.h"
|
13
AppKit/CoreGraphics.subproj/CGPattern.h
Normal file
13
AppKit/CoreGraphics.subproj/CGPattern.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGPattern;
|
||||
|
||||
typedef KGPattern *CGPatternRef;
|
10
AppKit/CoreGraphics.subproj/CGPattern.m
Normal file
10
AppKit/CoreGraphics.subproj/CGPattern.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGPattern.h>
|
||||
#import "KGPattern.h"
|
@ -1,43 +0,0 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/CGRenderingContext.h>
|
||||
|
||||
@implementation CGRenderingContext
|
||||
|
||||
-(NSSize)size {
|
||||
return NSZeroSize;
|
||||
}
|
||||
|
||||
-(CGContext *)graphicsContextWithTransform:(CGAffineTransform)transform clipRect:(NSRect)clipRect {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)beginPage {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)endPage {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)beginDocument {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)endDocument {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
@end
|
13
AppKit/CoreGraphics.subproj/CGShading.h
Normal file
13
AppKit/CoreGraphics.subproj/CGShading.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGShading;
|
||||
|
||||
typedef KGShading *CGShadingRef;
|
10
AppKit/CoreGraphics.subproj/CGShading.m
Normal file
10
AppKit/CoreGraphics.subproj/CGShading.m
Normal file
@ -0,0 +1,10 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGShading.h>
|
||||
#import "KGShading.h"
|
@ -8,7 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class CGRenderingContext,CGEvent;
|
||||
@class KGContext,CGEvent;
|
||||
|
||||
@interface CGWindow : NSObject
|
||||
|
||||
@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
-(void)invalidate;
|
||||
|
||||
-(CGRenderingContext *)renderingContext;
|
||||
-(KGContext *)graphicsContext;
|
||||
|
||||
-(void)setTitle:(NSString *)title;
|
||||
-(void)setFrame:(NSRect)frame;
|
||||
@ -34,6 +34,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(void)captureEvents;
|
||||
-(void)miniaturize;
|
||||
-(void)deminiaturize;
|
||||
-(BOOL)isMiniaturized;
|
||||
|
||||
-(void)flushBuffer;
|
||||
|
||||
|
@ -25,7 +25,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
|
||||
-(CGRenderingContext *)renderingContext {
|
||||
-(KGContext *)graphicsContext {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
}
|
||||
@ -79,6 +79,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(BOOL)isMiniaturized {
|
||||
NSInvalidAbstractInvocation();
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(void)flushBuffer {
|
||||
NSInvalidAbstractInvocation();
|
||||
|
11
AppKit/Win32.subproj/Win32GraphicsContext.h → AppKit/CoreGraphics.subproj/KGBitmapContext.h
Executable file → Normal file
11
AppKit/Win32.subproj/Win32GraphicsContext.h → AppKit/CoreGraphics.subproj/KGBitmapContext.h
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
@ -6,13 +6,10 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/CGContextSimple.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class Win32RenderingContext;
|
||||
|
||||
@interface Win32GraphicsContext : CGContextSimple
|
||||
|
||||
-initWithRenderingContext:(CGRenderingContext *)context transform:(CGAffineTransform)deviceTransform clipRect:(NSRect)clipRect;
|
||||
@interface KGBitmapContext : NSObject {
|
||||
|
||||
}
|
||||
|
||||
@end
|
14
AppKit/CoreGraphics.subproj/KGBitmapContext.m
Normal file
14
AppKit/CoreGraphics.subproj/KGBitmapContext.m
Normal file
@ -0,0 +1,14 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGBitmapContext.h"
|
||||
|
||||
@implementation KGBitmapContext
|
||||
|
||||
@end
|
28
AppKit/CoreGraphics.subproj/KGColor.h
Normal file
28
AppKit/CoreGraphics.subproj/KGColor.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGColorSpace;
|
||||
|
||||
@interface KGColor : NSObject <NSCopying> {
|
||||
KGColorSpace *_colorSpace;
|
||||
unsigned _numberOfComponents;
|
||||
float *_components;
|
||||
}
|
||||
|
||||
-initWithColorSpace:(KGColorSpace *)colorSpace components:(const float *)components;
|
||||
|
||||
-copyWithAlpha:(float)alpha;
|
||||
|
||||
-(KGColorSpace *)colorSpace;
|
||||
-(unsigned)numberOfComponents;
|
||||
-(float *)components;
|
||||
-(float)alpha;
|
||||
|
||||
@end
|
71
AppKit/CoreGraphics.subproj/KGColor.m
Normal file
71
AppKit/CoreGraphics.subproj/KGColor.m
Normal file
@ -0,0 +1,71 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGColor.h"
|
||||
#import "KGColorSpace.h"
|
||||
|
||||
@implementation KGColor
|
||||
|
||||
-initWithColorSpace:(KGColorSpace *)colorSpace components:(const float *)components {
|
||||
int i;
|
||||
|
||||
_colorSpace=[colorSpace retain];
|
||||
_numberOfComponents=[_colorSpace numberOfComponents]+1;
|
||||
_components=NSZoneMalloc([self zone],sizeof(float)*_numberOfComponents);
|
||||
for(i=0;i<_numberOfComponents;i++)
|
||||
_components[i]=components[i];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-init {
|
||||
KGColorSpace *gray=[[[KGColorSpace alloc] initWithDeviceGray] autorelease];
|
||||
float components[2]={0,1};
|
||||
|
||||
return [self initWithColorSpace:gray components:components];
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_colorSpace release];
|
||||
NSZoneFree([self zone],_components);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
return [self retain];
|
||||
}
|
||||
|
||||
-copyWithAlpha:(float)alpha {
|
||||
int i;
|
||||
float components[_numberOfComponents];
|
||||
|
||||
for(i=0;i<_numberOfComponents-1;i++)
|
||||
components[i]=_components[i];
|
||||
components[i]=alpha;
|
||||
|
||||
return [[isa alloc] initWithColorSpace:_colorSpace components:components];
|
||||
}
|
||||
|
||||
-(KGColorSpace *)colorSpace {
|
||||
return _colorSpace;
|
||||
}
|
||||
|
||||
-(unsigned)numberOfComponents {
|
||||
return _numberOfComponents;
|
||||
}
|
||||
|
||||
-(float *)components {
|
||||
return _components;
|
||||
}
|
||||
|
||||
-(float)alpha {
|
||||
return _components[_numberOfComponents-1];
|
||||
}
|
||||
|
||||
@end
|
@ -23,7 +23,7 @@ typedef enum {
|
||||
KGColorSpaceIndexed
|
||||
} KGColorSpaceType;
|
||||
|
||||
@interface KGColorSpace : NSObject {
|
||||
@interface KGColorSpace : NSObject <NSCopying> {
|
||||
KGColorSpaceType _type;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return [[KGColorSpace_indexed alloc] initWithColorSpace:baseColorSpace hival:hival bytes:bytes];
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
return [self retain];
|
||||
}
|
||||
|
||||
-(unsigned)numberOfComponents {
|
||||
switch(_type){
|
||||
case KGColorSpaceDeviceGray: return 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
@ -7,71 +7,207 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#ifdef WIN32
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
#else
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
@class KGColorSpace,KGShading,KGImage;
|
||||
enum {
|
||||
// seperable
|
||||
KGBlendModeNormal,
|
||||
KGBlendModeMultiply,
|
||||
KGBlendModeScreen,
|
||||
KGBlendModeOverlay,
|
||||
KGBlendModeDarken,
|
||||
KGBlendModeLighten,
|
||||
KGBlendModeColorDodge,
|
||||
KGBlendModeColorBurn,
|
||||
KGBlendModeHardLight,
|
||||
KGBlendModeSoftLight,
|
||||
KGBlendModeDifference,
|
||||
KGBlendModeExclusion,
|
||||
// nonseperable
|
||||
KGBlendModeHue,
|
||||
KGBlendModeSaturation,
|
||||
KGBlendModeColor,
|
||||
KGBlendModeLuminosity,
|
||||
};
|
||||
|
||||
@interface KGContext : NSObject
|
||||
|
||||
@end
|
||||
@class KGColor,KGColorSpace,KGShading,KGImage,KGGraphicsState,KGMutablePath,KGPath,KGPattern,KGLayer,KGPDFPage,NSMutableArray;
|
||||
|
||||
@interface KGContext(platform)
|
||||
@interface KGContext : NSObject {
|
||||
NSMutableArray *_layerStack;
|
||||
NSMutableArray *_stateStack;
|
||||
KGMutablePath *_path;
|
||||
BOOL _allowsAntialiasing;
|
||||
}
|
||||
|
||||
-initWithGraphicsState:(KGGraphicsState *)state;
|
||||
|
||||
-(void)setAllowsAntialiasing:(BOOL)yesOrNo;
|
||||
|
||||
-(void)beginTransparencyLayerWithInfo:(NSDictionary *)unused;
|
||||
-(void)endTransparencyLayer;
|
||||
|
||||
-(BOOL)pathIsEmpty;
|
||||
-(NSPoint)pathCurrentPoint;
|
||||
-(NSRect)pathBoundingBox;
|
||||
-(BOOL)pathContainsPoint:(NSPoint)point drawingMode:(int)pathMode;
|
||||
|
||||
-(void)beginPath;
|
||||
-(void)closePath;
|
||||
-(void)moveToPoint:(float)x:(float)y;
|
||||
-(void)addLineToPoint:(float)x:(float)y;
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y;
|
||||
-(void)addQuadCurveToPoint:(float)cx1:(float)cy1:(float)x:(float)y;
|
||||
-(void)addLinesWithPoints:(const NSPoint *)points count:(unsigned)count;
|
||||
-(void)addRect:(NSRect)rect;
|
||||
-(void)addRects:(const NSRect *)rect count:(unsigned)count;
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise;
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius;
|
||||
-(void)addEllipseInRect:(NSRect)rect;
|
||||
-(void)addPath:(KGPath *)path;
|
||||
-(void)replacePathWithStrokedPath;
|
||||
|
||||
-(void)saveGState;
|
||||
-(void)restoreGState;
|
||||
|
||||
-(void)beginPath;
|
||||
-(void)closePath;
|
||||
-(void)strokePath;
|
||||
-(void)fillPath;
|
||||
-(void)eoFillPath;
|
||||
-(void)fillAndStrokePath;
|
||||
-(void)eoFillAndStrokePath;
|
||||
-(CGAffineTransform)userSpaceToDeviceSpaceTransform;
|
||||
-(CGAffineTransform)ctm;
|
||||
-(NSRect)clipBoundingBox;
|
||||
-(CGAffineTransform)textMatrix;
|
||||
-(int)interpolationQuality;
|
||||
-(NSPoint)textPosition;
|
||||
-(NSPoint)convertPointToDeviceSpace:(NSPoint)point;
|
||||
-(NSPoint)convertPointToUserSpace:(NSPoint)point;
|
||||
-(NSSize)convertSizeToDeviceSpace:(NSSize)size;
|
||||
-(NSSize)convertSizeToUserSpace:(NSSize)size;
|
||||
-(NSRect)convertRectToDeviceSpace:(NSRect)rect;
|
||||
-(NSRect)convertRectToUserSpace:(NSRect)rect;
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)matrix;
|
||||
-(void)translateCTM:(float)translatex:(float)translatey;
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley;
|
||||
-(void)rotateCTM:(float)radians;
|
||||
|
||||
-(void)clipToPath;
|
||||
-(void)eoClipToPath;
|
||||
-(void)evenOddClipToPath;
|
||||
-(void)clipToMask:(KGImage *)image inRect:(NSRect)rect;
|
||||
-(void)clipToRect:(NSRect)rect;
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count;
|
||||
|
||||
-(void)addCurveToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)x3:(float)y3;
|
||||
-(void)addQuadCurveToPoint:(float)x2:(float)y2:(float)x3:(float)y3;
|
||||
-(void)addLineToPoint:(float)x:(float)y;
|
||||
-(void)moveToPoint:(float)x:(float)y;
|
||||
-(void)addRect:(float)x:(float)y:(float)width:(float)height;
|
||||
|
||||
-(void)concatCTM:(float)a:(float)b:(float)c:(float)d:(float)tx:(float)ty;
|
||||
|
||||
-(void)setRenderingIntent:(int)intent;
|
||||
// I think we need more ways to set the color
|
||||
|
||||
-(void)setStrokeColorSpace:(KGColorSpace *)colorSpace;
|
||||
-(void)setFillColorSpace:(KGColorSpace *)colorSpace;
|
||||
|
||||
-(void)setStrokeColorWithComponents:(const float *)components;
|
||||
-(void)setStrokeColor:(KGColor *)color;
|
||||
-(void)setGrayStrokeColor:(float)gray:(float)alpha;
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b:(float)alpha;
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k:(float)alpha;
|
||||
|
||||
-(void)setFillColorWithComponents:(const float *)components;
|
||||
-(void)setFillColor:(KGColor *)color;
|
||||
-(void)setGrayFillColor:(float)gray:(float)alpha;
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b:(float)alpha;
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k:(float)alpha;
|
||||
|
||||
-(void)setStrokeAndFillAlpha:(float)alpha;
|
||||
|
||||
-(void)setStrokeAlpha:(float)alpha;
|
||||
-(void)setFillAlpha:(float)alpha;
|
||||
|
||||
// use gstate alpha
|
||||
-(void)setGrayFillColor:(float)gray;
|
||||
-(void)setGrayStrokeColor:(float)gray;
|
||||
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k;
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b;
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k;
|
||||
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b;
|
||||
-(void)setFillAlpha:(float)alpha;
|
||||
-(void)setGrayFillColor:(float)gray;
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b;
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k;
|
||||
|
||||
-(void)setPatternPhase:(NSSize)phase;
|
||||
-(void)setStrokePattern:(KGPattern *)pattern components:(const float *)components;
|
||||
-(void)setFillPattern:(KGPattern *)pattern components:(const float *)components;
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)matrix;
|
||||
-(void)setTextPosition:(float)x:(float)y;
|
||||
-(void)setCharacterSpacing:(float)spacing;
|
||||
-(void)setTextDrawingMode:(int)textMode;
|
||||
-(void)setFont:(KGFont *)font;
|
||||
-(void)setFontSize:(float)size;
|
||||
-(void)selectFontWithName:(const char *)name size:(float)size encoding:(int)encoding;
|
||||
-(void)setShouldSmoothFonts:(BOOL)yesOrNo;
|
||||
|
||||
-(void)setLineWidth:(float)width;
|
||||
-(void)setFlatness:(float)flatness;
|
||||
-(void)setLineDashPhase:(float)phase lengths:(float *)lengths count:(unsigned)count;
|
||||
-(void)setMiterLimit:(float)limit;
|
||||
-(void)setLineJoin:(int)lineJoin;
|
||||
-(void)setLineCap:(int)lineCap;
|
||||
-(void)setLineJoin:(int)lineJoin;
|
||||
-(void)setMiterLimit:(float)limit;
|
||||
-(void)setLineDashPhase:(float)phase lengths:(const float *)lengths count:(unsigned)count;
|
||||
|
||||
-(void)setCharacterSpacing:(float)spacing;
|
||||
-(void)setWordSpacing:(float)spacing;
|
||||
-(void)setTextPosition:(float)x:(float)y;
|
||||
-(void)setTextLeading:(float)x:(float)y;
|
||||
-(void)setTextMatrixIdentity;
|
||||
-(void)setTextMatrix:(float)a:(float)b:(float)c:(float)d:(float)tx:(float)ty;
|
||||
-(void)selectFont:(const char *)baseFont scale:(float)scale encoding:(int)encoding;
|
||||
-(void)showText:(const char *)bytes length:(unsigned)length;
|
||||
-(void)setRenderingIntent:(int)intent;
|
||||
-(void)setBlendMode:(int)mode;
|
||||
|
||||
-(void)setFlatness:(float)flatness;
|
||||
-(void)setInterpolationQuality:(int)quality;
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur color:(KGColor *)color;
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur;
|
||||
|
||||
-(void)setShouldAntialias:(BOOL)yesOrNo;
|
||||
|
||||
-(void)strokeLineSegmentsWithPoints:(const NSPoint *)points count:(unsigned)count;
|
||||
-(void)strokeRect:(NSRect)rect;
|
||||
-(void)strokeRect:(NSRect)rect width:(float)width;
|
||||
-(void)strokeEllipseInRect:(NSRect)rect;
|
||||
|
||||
-(void)fillRect:(NSRect)rect;
|
||||
-(void)fillRects:(const NSRect *)rects count:(unsigned)count;
|
||||
-(void)fillEllipseInRect:(NSRect)rect;
|
||||
|
||||
-(void)drawPath:(int)pathMode;
|
||||
-(void)strokePath;
|
||||
-(void)fillPath;
|
||||
-(void)evenOddFillPath;
|
||||
-(void)fillAndStrokePath;
|
||||
-(void)evenOddFillAndStrokePath;
|
||||
|
||||
-(void)clearRect:(NSRect)rect;
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count atPoint:(float)x:(float)y;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count advances:(const NSSize *)advances;
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length;
|
||||
-(void)showText:(const char *)text length:(unsigned)length atPoint:(float)x:(float)y;
|
||||
|
||||
-(void)drawImage:(KGImage *)image inRect:(float)x:(float)y:(float)width:(float)height;
|
||||
-(void)drawShading:(KGShading *)shading;
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect;
|
||||
-(void)drawLayer:(KGLayer *)layer atPoint:(NSPoint)point;
|
||||
-(void)drawLayer:(KGLayer *)layer inRect:(NSRect)rect;
|
||||
-(void)drawPDFPage:(KGPDFPage *)page;
|
||||
|
||||
-(void)flush;
|
||||
-(void)synchronize;
|
||||
|
||||
-(void)beginPage:(const NSRect *)mediaBox;
|
||||
-(void)endPage;
|
||||
|
||||
// temporary
|
||||
|
||||
-(void)setWordSpacing:(float)spacing;
|
||||
-(void)setTextLeading:(float)leading;
|
||||
|
||||
-(void)setCalibratedColorWhite:(float)white alpha:(float)alpha;
|
||||
-(void)setCalibratedColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point gState:(int)gState;
|
||||
|
||||
-(void)beginDocument;
|
||||
-(void)scalePage:(float)scalex:(float)scaley;
|
||||
-(void)endDocument;
|
||||
|
||||
@end
|
||||
|
@ -8,7 +8,588 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGContext.h"
|
||||
#import <AppKit/KGGraphicsState.h>
|
||||
#import <AppKit/KGRenderingContext.h>
|
||||
#import "KGMutablePath.h"
|
||||
#import "KGLayer.h"
|
||||
#import "KGPDFPage.h"
|
||||
#import <Foundation/NSRaise.h>
|
||||
|
||||
@implementation KGContext
|
||||
|
||||
-initWithGraphicsState:(KGGraphicsState *)state {
|
||||
_layerStack=[NSMutableArray new];
|
||||
_stateStack=[NSMutableArray new];
|
||||
[_stateStack addObject:state];
|
||||
_path=nil;
|
||||
_allowsAntialiasing=YES;
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_layerStack release];
|
||||
[_stateStack release];
|
||||
[_path release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
static inline KGGraphicsState *currentState(KGContext *self){
|
||||
return [self->_stateStack lastObject];
|
||||
}
|
||||
|
||||
-(void)setAllowsAntialiasing:(BOOL)yesOrNo {
|
||||
_allowsAntialiasing=yesOrNo;
|
||||
}
|
||||
|
||||
-(void)beginTransparencyLayerWithInfo:(NSDictionary *)unused {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)endTransparencyLayer {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(BOOL)pathIsEmpty {
|
||||
return (_path==nil)?YES:[_path isEmpty];
|
||||
}
|
||||
|
||||
-(NSPoint)pathCurrentPoint {
|
||||
return (_path==nil)?NSZeroPoint:[_path currentPoint];
|
||||
}
|
||||
|
||||
-(NSRect)pathBoundingBox {
|
||||
return (_path==nil)?NSZeroRect:[_path boundingBox];
|
||||
}
|
||||
|
||||
-(BOOL)pathContainsPoint:(NSPoint)point drawingMode:(int)pathMode {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
// FIX evenOdd
|
||||
return [_path containsPoint:point evenOdd:NO withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)beginPath {
|
||||
[_path release];
|
||||
_path=[[KGMutablePath alloc] init];
|
||||
}
|
||||
|
||||
-(void)closePath {
|
||||
[_path closeSubpath];
|
||||
}
|
||||
|
||||
-(void)moveToPoint:(float)x:(float)y {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path moveToPoint:NSMakePoint(x,y) withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addLineToPoint:(float)x:(float)y {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addLineToPoint:NSMakePoint(x,y) withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addCurveToPoint:(float)cx1:(float)cy1:(float)cx2:(float)cy2:(float)x:(float)y {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addCurveToControlPoint:NSMakePoint(cx1,cy1) controlPoint:NSMakePoint(cx2,cy2) endPoint:NSMakePoint(x,y) withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addQuadCurveToPoint:(float)cx1:(float)cy1:(float)x:(float)y {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addCurveToControlPoint:NSMakePoint(cx1,cy1) endPoint:NSMakePoint(x,y) withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addLinesWithPoints:(NSPoint *)points count:(unsigned)count {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addLinesWithPoints:points count:count withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addRect:(NSRect)rect {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addRect:rect withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addRects:(NSRect *)rect count:(unsigned)count {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addRects:rect count:count withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addArc:(float)x:(float)y:(float)radius:(float)startRadian:(float)endRadian:(int)clockwise {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addArcAtPoint:NSMakePoint(x,y) radius:radius startAngle:startRadian endAngle:endRadian clockwise:clockwise withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addArcToPoint:(float)x1:(float)y1:(float)x2:(float)y2:(float)radius {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addArcToPoint:NSMakePoint(x1,y1) point:NSMakePoint(x2,y2) radius:radius withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addEllipseInRect:(NSRect)rect {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addEllipseInRect:rect withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)addPath:(KGPath *)path {
|
||||
CGAffineTransform ctm=[currentState(self) ctm];
|
||||
|
||||
[_path addPath:path withTransform:&ctm];
|
||||
}
|
||||
|
||||
-(void)replacePathWithStrokedPath {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)saveGState {
|
||||
KGGraphicsState *current=currentState(self),*next;
|
||||
|
||||
[current save];
|
||||
next=[current copy];
|
||||
[_stateStack addObject:next];
|
||||
[next release];
|
||||
}
|
||||
|
||||
-(void)restoreGState {
|
||||
[_stateStack removeLastObject];
|
||||
[currentState(self) restore];
|
||||
}
|
||||
|
||||
-(CGAffineTransform)userSpaceToDeviceSpaceTransform {
|
||||
[currentState(self) userSpaceToDeviceSpaceTransform];
|
||||
}
|
||||
|
||||
-(CGAffineTransform)ctm {
|
||||
[currentState(self) ctm];
|
||||
}
|
||||
|
||||
-(NSRect)clipBoundingBox {
|
||||
[currentState(self) clipBoundingBox];
|
||||
}
|
||||
|
||||
-(CGAffineTransform)textMatrix {
|
||||
return [currentState(self) textMatrix];
|
||||
}
|
||||
|
||||
-(int)interpolationQuality {
|
||||
return [currentState(self) interpolationQuality];
|
||||
}
|
||||
|
||||
-(NSPoint)textPosition {
|
||||
return [currentState(self) textPosition];
|
||||
}
|
||||
|
||||
-(NSPoint)convertPointToDeviceSpace:(NSPoint)point {
|
||||
return [currentState(self) convertPointToDeviceSpace:point];
|
||||
}
|
||||
|
||||
-(NSPoint)convertPointToUserSpace:(NSPoint)point {
|
||||
return [currentState(self) convertPointToUserSpace:point];
|
||||
}
|
||||
|
||||
-(NSSize)convertSizeToDeviceSpace:(NSSize)size {
|
||||
return [currentState(self) convertSizeToDeviceSpace:size];
|
||||
}
|
||||
|
||||
-(NSSize)convertSizeToUserSpace:(NSSize)size {
|
||||
return [currentState(self) convertSizeToUserSpace:size];
|
||||
}
|
||||
|
||||
-(NSRect)convertRectToDeviceSpace:(NSRect)rect {
|
||||
return [currentState(self) convertRectToDeviceSpace:rect];
|
||||
}
|
||||
|
||||
-(NSRect)convertRectToUserSpace:(NSRect)rect {
|
||||
return [currentState(self) convertRectToUserSpace:rect];
|
||||
}
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)transform {
|
||||
[currentState(self) concatCTM:transform];
|
||||
}
|
||||
|
||||
-(void)translateCTM:(float)tx:(float)ty {
|
||||
[currentState(self) translateCTM:tx:ty];
|
||||
}
|
||||
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley {
|
||||
[currentState(self) scaleCTM:scalex:scaley];
|
||||
}
|
||||
|
||||
-(void)rotateCTM:(float)radians {
|
||||
[currentState(self) rotateCTM:radians];
|
||||
}
|
||||
|
||||
-(void)clipToPath {
|
||||
[currentState(self) clipToPath:_path];
|
||||
}
|
||||
|
||||
-(void)evenOddClipToPath {
|
||||
[currentState(self) evenOddClipToPath:_path];
|
||||
}
|
||||
|
||||
-(void)clipToMask:(KGImage *)image inRect:(NSRect)rect {
|
||||
[currentState(self) clipToMask:image inRect:rect];
|
||||
}
|
||||
|
||||
-(void)clipToRect:(NSRect)rect {
|
||||
[currentState(self) clipToRect:rect];
|
||||
}
|
||||
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count {
|
||||
[currentState(self) clipToRects:rects count:count];
|
||||
}
|
||||
|
||||
-(void)setStrokeColorSpace:(KGColorSpace *)colorSpace {
|
||||
[currentState(self) setStrokeColorSpace:colorSpace];
|
||||
}
|
||||
|
||||
-(void)setFillColorSpace:(KGColorSpace *)colorSpace {
|
||||
[currentState(self) setFillColorSpace:colorSpace];
|
||||
}
|
||||
|
||||
-(void)setStrokeColorWithComponents:(const float *)components {
|
||||
[currentState(self) setStrokeColorWithComponents:components];
|
||||
}
|
||||
|
||||
-(void)setStrokeColor:(KGColor *)color {
|
||||
[currentState(self) setStrokeColor:color];
|
||||
}
|
||||
|
||||
-(void)setGrayStrokeColor:(float)gray:(float)alpha {
|
||||
[currentState(self) setGrayStrokeColor:gray:alpha];
|
||||
}
|
||||
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b:(float)alpha {
|
||||
[currentState(self) setRGBStrokeColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k:(float)alpha {
|
||||
[currentState(self) setCMYKStrokeColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
-(void)setFillColorWithComponents:(const float *)components {
|
||||
[currentState(self) setFillColorWithComponents:components];
|
||||
}
|
||||
|
||||
-(void)setFillColor:(KGColor *)color {
|
||||
[currentState(self) setFillColor:color];
|
||||
}
|
||||
|
||||
-(void)setGrayFillColor:(float)gray:(float)alpha {
|
||||
[currentState(self) setGrayFillColor:gray:alpha];
|
||||
}
|
||||
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b:(float)alpha {
|
||||
[currentState(self) setRGBFillColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k:(float)alpha {
|
||||
[currentState(self) setCMYKFillColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
-(void)setStrokeAndFillAlpha:(float)alpha {
|
||||
[currentState(self) setStrokeAndFillAlpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setStrokeAlpha:(float)alpha {
|
||||
[currentState(self) setStrokeAlpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setGrayStrokeColor:(float)gray {
|
||||
[currentState(self) setGrayStrokeColor:gray];
|
||||
}
|
||||
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b {
|
||||
[currentState(self) setRGBStrokeColor:r:g:b];
|
||||
}
|
||||
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k {
|
||||
[currentState(self) setCMYKStrokeColor:c:y:m:k];
|
||||
}
|
||||
|
||||
-(void)setFillAlpha:(float)alpha {
|
||||
[currentState(self) setFillAlpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setGrayFillColor:(float)gray {
|
||||
[currentState(self) setGrayFillColor:gray];
|
||||
}
|
||||
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b {
|
||||
[currentState(self) setRGBFillColor:r:g:b];
|
||||
}
|
||||
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k {
|
||||
[currentState(self) setCMYKFillColor:c:y:m:k];
|
||||
}
|
||||
|
||||
-(void)setPatternPhase:(NSSize)phase {
|
||||
[currentState(self) setPatternPhase:phase];
|
||||
}
|
||||
|
||||
-(void)setStrokePattern:(KGPattern *)pattern components:(const float *)components {
|
||||
[currentState(self) setStrokePattern:pattern components:components];
|
||||
}
|
||||
|
||||
-(void)setFillPattern:(KGPattern *)pattern components:(const float *)components {
|
||||
[currentState(self) setFillPattern:pattern components:components];
|
||||
}
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform {
|
||||
[currentState(self) setTextMatrix:transform];
|
||||
}
|
||||
|
||||
-(void)setTextPosition:(float)x:(float)y {
|
||||
[currentState(self) setTextPosition:x:y];
|
||||
}
|
||||
|
||||
-(void)setCharacterSpacing:(float)spacing {
|
||||
[currentState(self) setCharacterSpacing:spacing];
|
||||
}
|
||||
|
||||
-(void)setTextDrawingMode:(int)textMode {
|
||||
[currentState(self) setTextDrawingMode:textMode];
|
||||
}
|
||||
|
||||
-(void)setFont:(KGFont *)font {
|
||||
[currentState(self) setFont:font];
|
||||
}
|
||||
|
||||
-(void)setFontSize:(float)size {
|
||||
[currentState(self) setFontSize:size];
|
||||
}
|
||||
|
||||
-(void)selectFontWithName:(const char *)name size:(float)size encoding:(int)encoding {
|
||||
[currentState(self) selectFontWithName:name size:size encoding:encoding];
|
||||
}
|
||||
|
||||
-(void)setShouldSmoothFonts:(BOOL)yesOrNo {
|
||||
[currentState(self) setShouldSmoothFonts:yesOrNo];
|
||||
}
|
||||
|
||||
-(void)setLineWidth:(float)width {
|
||||
[currentState(self) setLineWidth:width];
|
||||
}
|
||||
|
||||
-(void)setLineCap:(int)lineCap {
|
||||
[currentState(self) setLineCap:lineCap];
|
||||
}
|
||||
|
||||
-(void)setLineJoin:(int)lineJoin {
|
||||
[currentState(self) setLineJoin:lineJoin];
|
||||
}
|
||||
|
||||
-(void)setMiterLimit:(float)limit {
|
||||
[currentState(self) setMiterLimit:limit];
|
||||
}
|
||||
|
||||
-(void)setLineDashPhase:(float)phase lengths:(const float *)lengths count:(unsigned)count {
|
||||
[currentState(self) setLineDashPhase:phase lengths:lengths count:count];
|
||||
}
|
||||
|
||||
-(void)setRenderingIntent:(int)intent {
|
||||
[currentState(self) setRenderingIntent:intent];
|
||||
}
|
||||
|
||||
-(void)setBlendMode:(int)mode {
|
||||
[currentState(self) setBlendMode:mode];
|
||||
}
|
||||
|
||||
-(void)setFlatness:(float)flatness {
|
||||
[currentState(self) setFlatness:flatness];
|
||||
}
|
||||
|
||||
-(void)setInterpolationQuality:(int)quality {
|
||||
[currentState(self) setInterpolationQuality:quality];
|
||||
}
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur color:(KGColor *)color {
|
||||
[currentState(self) setShadowOffset:offset blur:blur color:color];
|
||||
}
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur {
|
||||
[currentState(self) setShadowOffset:offset blur:blur];
|
||||
}
|
||||
|
||||
-(void)setShouldAntialias:(BOOL)flag {
|
||||
[currentState(self) setShouldAntialias:flag];
|
||||
}
|
||||
|
||||
-(void)strokeLineSegmentsWithPoints:(NSPoint *)points count:(unsigned)count {
|
||||
[currentState(self) strokeLineSegmentsWithPoints:points count:count];
|
||||
}
|
||||
|
||||
-(void)strokeRect:(NSRect)rect {
|
||||
[currentState(self) strokeRect:rect];
|
||||
}
|
||||
|
||||
-(void)strokeRect:(NSRect)rect width:(float)width {
|
||||
[currentState(self) strokeRect:rect width:width];
|
||||
}
|
||||
|
||||
-(void)strokeEllipseInRect:(NSRect)rect {
|
||||
[currentState(self) strokeEllipseInRect:rect];
|
||||
}
|
||||
|
||||
-(void)fillRect:(NSRect)rect {
|
||||
[currentState(self) fillRects:&rect count:1];
|
||||
}
|
||||
|
||||
-(void)fillRects:(const NSRect *)rects count:(unsigned)count {
|
||||
[currentState(self) fillRects:rects count:count];
|
||||
}
|
||||
|
||||
-(void)fillEllipseInRect:(NSRect)rect {
|
||||
[currentState(self) fillEllipseInRect:rect];
|
||||
}
|
||||
|
||||
-(void)drawPath:(int)pathMode {
|
||||
[currentState(self) drawPath:_path mode:pathMode];
|
||||
}
|
||||
|
||||
-(void)strokePath {
|
||||
[currentState(self) drawPath:_path mode:KGPathStroke];
|
||||
}
|
||||
|
||||
-(void)fillPath {
|
||||
[currentState(self) drawPath:_path mode:KGPathFill];
|
||||
}
|
||||
|
||||
-(void)evenOddFillPath {
|
||||
[currentState(self) drawPath:_path mode:KGPathEOFill];
|
||||
}
|
||||
|
||||
-(void)fillAndStrokePath {
|
||||
[currentState(self) drawPath:_path mode:KGPathFillStroke];
|
||||
}
|
||||
|
||||
-(void)evenOddFillAndStrokePath {
|
||||
[currentState(self) drawPath:_path mode:KGPathEOFillStroke];
|
||||
}
|
||||
|
||||
-(void)clearRect:(NSRect)rect {
|
||||
[currentState(self) clearRect:rect];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count {
|
||||
[currentState(self) showGlyphs:glyphs count:count];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count atPoint:(float)x:(float)y {
|
||||
[currentState(self) showGlyphs:glyphs count:count atPoint:x:y];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count advances:(const NSSize *)advances {
|
||||
[currentState(self) showGlyphs:glyphs count:count advances:advances];
|
||||
}
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length {
|
||||
[currentState(self) showText:text length:length];
|
||||
}
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length atPoint:(float)x:(float)y {
|
||||
[currentState(self) showText:text length:length atPoint:x:y];
|
||||
}
|
||||
|
||||
-(void)drawShading:(KGShading *)shading {
|
||||
[currentState(self) drawShading:shading];
|
||||
}
|
||||
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect {
|
||||
[currentState(self) drawImage:image inRect:rect];
|
||||
}
|
||||
|
||||
-(void)drawLayer:(KGLayer *)layer atPoint:(NSPoint)point {
|
||||
NSSize size=[layer size];
|
||||
NSRect rect={point,size};
|
||||
|
||||
[self drawLayer:layer inRect:rect];
|
||||
}
|
||||
|
||||
-(void)drawLayer:(KGLayer *)layer inRect:(NSRect)rect {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)drawPDFPage:(KGPDFPage *)page {
|
||||
NSLog(@"page=%@",page);
|
||||
[page drawInContext:self];
|
||||
}
|
||||
|
||||
-(void)flush {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)synchronize {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)beginPage:(const NSRect *)mediaBox {
|
||||
[[[_stateStack lastObject] renderingContext] beginPage];
|
||||
}
|
||||
|
||||
-(void)endPage {
|
||||
[[[_stateStack lastObject] renderingContext] endPage];
|
||||
}
|
||||
|
||||
// temporary
|
||||
|
||||
-(void)setWordSpacing:(float)spacing {
|
||||
[currentState(self) setWordSpacing:spacing];
|
||||
}
|
||||
|
||||
-(void)setTextLeading:(float)leading {
|
||||
[currentState(self) setTextLeading:leading];
|
||||
}
|
||||
|
||||
-(void)setCalibratedColorWhite:(float)white alpha:(float)alpha {
|
||||
[self setCalibratedColorRed:white green:white blue:white alpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setCalibratedColorRed:(float)r green:(float)g blue:(float)b alpha:(float)alpha {
|
||||
// NeXT gamma is 2.2 I think, my PC card is probably 1.3. This should be
|
||||
// assumed = PC card setting
|
||||
// display = NeXT 2.2
|
||||
// I think.
|
||||
|
||||
const float assumedGamma=1.3;
|
||||
const float displayGamma=2.2;
|
||||
|
||||
r=pow(r,assumedGamma/displayGamma);
|
||||
if(r>1.0)
|
||||
r=1.0;
|
||||
|
||||
g=pow(g,assumedGamma/displayGamma);
|
||||
if(g>1.0)
|
||||
g=1.0;
|
||||
|
||||
b=pow(b,assumedGamma/displayGamma);
|
||||
if(b>1.0)
|
||||
b=1.0;
|
||||
|
||||
[self setRGBStrokeColor:r:g:b:alpha];
|
||||
[self setRGBFillColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point gState:(int)gState {
|
||||
[currentState(self) copyBitsInRect:rect toPoint:point];
|
||||
}
|
||||
|
||||
-(void)beginDocument {
|
||||
[[[_stateStack lastObject] renderingContext] beginDocument];
|
||||
}
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley {
|
||||
[[[_stateStack lastObject] renderingContext] scalePage:scalex:scaley];
|
||||
}
|
||||
|
||||
-(void)endDocument {
|
||||
[[[_stateStack lastObject] renderingContext] endDocument];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -11,9 +11,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@class NSData;
|
||||
|
||||
@interface KGDataProvider : NSObject {
|
||||
NSData *_data;
|
||||
NSData *_data;
|
||||
const void *_bytes;
|
||||
unsigned _length;
|
||||
}
|
||||
|
||||
-initWithData:(NSData *)data;
|
||||
|
||||
-(const void *)bytes;
|
||||
-(unsigned)length;
|
||||
|
||||
@end
|
||||
|
@ -14,6 +14,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
-initWithData:(NSData *)data {
|
||||
_data=[data retain];
|
||||
_bytes=[_data bytes];
|
||||
_length=[_data length];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -22,4 +24,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(const void *)bytes {
|
||||
return _bytes;
|
||||
}
|
||||
|
||||
-(unsigned)length {
|
||||
return _length;
|
||||
}
|
||||
|
||||
@end
|
||||
|
169
AppKit/CoreGraphics.subproj/KGGraphicsState.h
Executable file
169
AppKit/CoreGraphics.subproj/KGGraphicsState.h
Executable file
@ -0,0 +1,169 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
#import <AppKit/CGGeometry.h>
|
||||
|
||||
@class KGRenderingContext,KGImage,KGColorSpace,KGColor,KGPattern,KGShading,KGMutablePath,KGPath;
|
||||
|
||||
@interface KGGraphicsState : NSObject <NSCopying> {
|
||||
KGRenderingContext *_renderingContext;
|
||||
CGAffineTransform _ctm;
|
||||
CGAffineTransform _textTransform;
|
||||
|
||||
id _deviceState;
|
||||
NSRect _clipRect;
|
||||
KGColor *_strokeColor;
|
||||
KGColor *_fillColor;
|
||||
NSSize _patternPhase;
|
||||
float _characterSpacing;
|
||||
int _textDrawingMode;
|
||||
BOOL _shouldSmoothFonts;
|
||||
float _lineWidth;
|
||||
int _lineCap;
|
||||
int _lineJoin;
|
||||
float _miterLimit;
|
||||
float _dashPhase;
|
||||
float _dashLengthsCount;
|
||||
float *_dashLengths;
|
||||
int _renderingIntent;
|
||||
int _blendMode;
|
||||
float _flatness;
|
||||
int _interpolationQuality;
|
||||
NSSize _shadowOffset;
|
||||
float _shadowBlur;
|
||||
KGColor *_shadowColor;
|
||||
BOOL _shouldAntialias;
|
||||
|
||||
float _wordSpacing;
|
||||
float _textLeading;
|
||||
}
|
||||
|
||||
-initWithRenderingContext:(KGRenderingContext *)context transform:(CGAffineTransform)deviceTransform userSpaceSize:(NSSize)userSpaceSize;
|
||||
|
||||
-(KGRenderingContext *)renderingContext;
|
||||
|
||||
-(void)save;
|
||||
-(void)restore;
|
||||
|
||||
-(CGAffineTransform)userSpaceToDeviceSpaceTransform;
|
||||
-(CGAffineTransform)ctm;
|
||||
-(NSRect)clipBoundingBox;
|
||||
-(CGAffineTransform)textMatrix;
|
||||
-(int)interpolationQuality;
|
||||
-(NSPoint)textPosition;
|
||||
-(NSPoint)convertPointToDeviceSpace:(NSPoint)point;
|
||||
-(NSPoint)convertPointToUserSpace:(NSPoint)point;
|
||||
-(NSSize)convertSizeToDeviceSpace:(NSSize)size;
|
||||
-(NSSize)convertSizeToUserSpace:(NSSize)size;
|
||||
-(NSRect)convertRectToDeviceSpace:(NSRect)rect;
|
||||
-(NSRect)convertRectToUserSpace:(NSRect)rect;
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)transform;
|
||||
-(void)translateCTM:(float)tx:(float)ty;
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley;
|
||||
-(void)rotateCTM:(float)radians;
|
||||
|
||||
-(void)clipToPath:(KGPath *)path;
|
||||
-(void)evenOddClipToPath:(KGPath *)path;
|
||||
-(void)clipToMask:(KGImage *)image inRect:(NSRect)rect;
|
||||
-(void)clipToRect:(NSRect)clipRect;
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count;
|
||||
|
||||
-(void)setStrokeColorSpace:(KGColorSpace *)colorSpace;
|
||||
-(void)setFillColorSpace:(KGColorSpace *)colorSpace;
|
||||
|
||||
-(void)setStrokeColorWithComponents:(const float *)components;
|
||||
-(void)setStrokeColor:(KGColor *)color;
|
||||
-(void)setGrayStrokeColor:(float)gray:(float)alpha;
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b:(float)alpha;
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k:(float)alpha;
|
||||
|
||||
-(void)setFillColorWithComponents:(const float *)components;
|
||||
-(void)setFillColor:(KGColor *)color;
|
||||
-(void)setGrayFillColor:(float)gray:(float)alpha;
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b:(float)alpha;
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k:(float)alpha;
|
||||
|
||||
-(void)setStrokeAndFillAlpha:(float)alpha;
|
||||
|
||||
-(void)setStrokeAlpha:(float)alpha;
|
||||
-(void)setGrayStrokeColor:(float)gray;
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b;
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k;
|
||||
|
||||
-(void)setFillAlpha:(float)alpha;
|
||||
-(void)setGrayFillColor:(float)gray;
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b;
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k;
|
||||
|
||||
-(void)setPatternPhase:(NSSize)phase;
|
||||
-(void)setStrokePattern:(KGPattern *)pattern components:(const float *)components;
|
||||
-(void)setFillPattern:(KGPattern *)pattern components:(const float *)components;
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform;
|
||||
-(void)setTextPosition:(float)x:(float)y;
|
||||
-(void)setCharacterSpacing:(float)spacing;
|
||||
-(void)setTextDrawingMode:(int)textMode;
|
||||
-(void)setFont:(KGFont *)font;
|
||||
-(void)setFontSize:(float)size;
|
||||
-(void)selectFontWithName:(const char *)name size:(float)size encoding:(int)encoding;
|
||||
-(void)setShouldSmoothFonts:(BOOL)yesOrNo;
|
||||
|
||||
-(void)setLineWidth:(float)width;
|
||||
-(void)setLineCap:(int)lineCap;
|
||||
-(void)setLineJoin:(int)lineJoin;
|
||||
-(void)setMiterLimit:(float)limit;
|
||||
-(void)setLineDashPhase:(float)phase lengths:(const float *)lengths count:(unsigned)count;
|
||||
|
||||
-(void)setRenderingIntent:(int)intent;
|
||||
-(void)setBlendMode:(int)mode;
|
||||
|
||||
-(void)setFlatness:(float)flatness;
|
||||
-(void)setInterpolationQuality:(int)quality;
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur color:(KGColor *)color;
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur;
|
||||
|
||||
-(void)setShouldAntialias:(BOOL)flag;
|
||||
|
||||
-(void)strokeLineSegmentsWithPoints:(NSPoint *)points count:(unsigned)count;
|
||||
-(void)strokeRect:(NSRect)rect;
|
||||
-(void)strokeRect:(NSRect)rect width:(float)width;
|
||||
-(void)strokeEllipseInRect:(NSRect)rect;
|
||||
|
||||
-(void)fillRects:(const NSRect *)rects count:(unsigned)count;
|
||||
-(void)fillEllipseInRect:(NSRect)rect;
|
||||
|
||||
-(void)drawPath:(KGPath *)path mode:(int)mode;
|
||||
|
||||
-(void)clearRect:(NSRect)rect;
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)numberOfGlyphs atPoint:(float)x:(float)y;
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count advances:(const NSSize *)advances;
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length;
|
||||
-(void)showText:(const char *)text length:(unsigned)length atPoint:(float)x:(float)y;
|
||||
|
||||
-(void)drawShading:(KGShading *)shading;
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect;
|
||||
|
||||
// temporary
|
||||
|
||||
-(void)setWordSpacing:(float)spacing;
|
||||
-(void)setTextLeading:(float)leading;
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point;
|
||||
|
||||
@end
|
||||
|
||||
void CGGraphicsSourceOver_rgba32_onto_bgrx32(unsigned char *sourceRGBA,unsigned char *resultRGBX,int width,int height,float fraction);
|
508
AppKit/CoreGraphics.subproj/KGGraphicsState.m
Executable file
508
AppKit/CoreGraphics.subproj/KGGraphicsState.m
Executable file
@ -0,0 +1,508 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/KGGraphicsState.h>
|
||||
#import <AppKit/KGRenderingContext.h>
|
||||
|
||||
#import <AppKit/CoreGraphics.h>
|
||||
#import "KGColor.h"
|
||||
#import "KGColorSpace.h"
|
||||
#import "KGMutablePath.h"
|
||||
|
||||
@implementation KGGraphicsState
|
||||
|
||||
-initWithRenderingContext:(KGRenderingContext *)context transform:(CGAffineTransform)deviceTransform userSpaceSize:(NSSize)userSpaceSize {
|
||||
_renderingContext=[context retain];
|
||||
_ctm=deviceTransform;
|
||||
_textTransform=CGAffineTransformIdentity;
|
||||
_clipRect=NSMakeRect(0,0,userSpaceSize.width,userSpaceSize.height);
|
||||
_deviceState=nil;
|
||||
_lineWidth=1.0;
|
||||
_strokeColor=[[KGColor alloc] init];
|
||||
_fillColor=[[KGColor alloc] init];
|
||||
_shouldAntialias=NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_renderingContext release];
|
||||
[_deviceState release];
|
||||
if(_dashLengths!=NULL)
|
||||
NSZoneFree(NULL,_dashLengths);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
KGGraphicsState *copy=NSCopyObject(self,0,zone);
|
||||
|
||||
copy->_renderingContext=[_renderingContext retain];
|
||||
copy->_deviceState=nil;
|
||||
copy->_strokeColor=[_strokeColor copyWithZone:zone];
|
||||
copy->_fillColor=[_fillColor copyWithZone:zone];
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
-(KGRenderingContext *)renderingContext {
|
||||
return _renderingContext;
|
||||
}
|
||||
|
||||
-(void)save {
|
||||
_deviceState=[_renderingContext saveCopyOfDeviceState];
|
||||
}
|
||||
|
||||
-(void)restore {
|
||||
[_renderingContext restoreDeviceState:_deviceState];
|
||||
[_deviceState release];
|
||||
_deviceState=nil;
|
||||
}
|
||||
|
||||
-(CGAffineTransform)userSpaceToDeviceSpaceTransform {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(CGAffineTransform)ctm {
|
||||
return _ctm;
|
||||
}
|
||||
|
||||
-(NSRect)clipBoundingBox {
|
||||
NSUnimplementedMethod();
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
-(CGAffineTransform)textMatrix {
|
||||
return _textTransform;
|
||||
}
|
||||
|
||||
-(int)interpolationQuality {
|
||||
}
|
||||
|
||||
-(NSPoint)textPosition {
|
||||
}
|
||||
|
||||
-(NSPoint)convertPointToDeviceSpace:(NSPoint)point {
|
||||
}
|
||||
|
||||
-(NSPoint)convertPointToUserSpace:(NSPoint)point {
|
||||
}
|
||||
|
||||
-(NSSize)convertSizeToDeviceSpace:(NSSize)size {
|
||||
}
|
||||
|
||||
-(NSSize)convertSizeToUserSpace:(NSSize)size {
|
||||
}
|
||||
|
||||
-(NSRect)convertRectToDeviceSpace:(NSRect)rect {
|
||||
}
|
||||
|
||||
-(NSRect)convertRectToUserSpace:(NSRect)rect {
|
||||
}
|
||||
|
||||
-(void)concatCTM:(CGAffineTransform)transform {
|
||||
_ctm=CGAffineTransformConcat(_ctm,transform);
|
||||
}
|
||||
|
||||
-(void)translateCTM:(float)tx:(float)ty {
|
||||
_ctm=CGAffineTransformTranslate(_ctm,tx,ty);
|
||||
}
|
||||
|
||||
-(void)scaleCTM:(float)scalex:(float)scaley {
|
||||
_ctm=CGAffineTransformScale(_ctm,scalex,scaley);
|
||||
}
|
||||
|
||||
-(void)rotateCTM:(float)radians {
|
||||
_ctm=CGAffineTransformRotate(_ctm,radians);
|
||||
}
|
||||
|
||||
-(void)clipToPath:(KGPath *)path {
|
||||
}
|
||||
|
||||
-(void)evenOddClipToPath:(KGPath *)path {
|
||||
}
|
||||
|
||||
-(void)clipToMask:(KGImage *)image inRect:(NSRect)rect {
|
||||
}
|
||||
|
||||
-(void)clipToRect:(NSRect)clipRect {
|
||||
[_renderingContext clipInUserSpace:_ctm rects:&clipRect count:1];
|
||||
}
|
||||
|
||||
-(void)clipToRects:(const NSRect *)rects count:(unsigned)count {
|
||||
[_renderingContext clipInUserSpace:_ctm rects:rects count:count];
|
||||
}
|
||||
|
||||
-(void)setStrokeColorSpace:(KGColorSpace *)colorSpace {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)setFillColorSpace:(KGColorSpace *)colorSpace {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)setStrokeColorWithComponents:(const float *)components {
|
||||
KGColorSpace *colorSpace=[_strokeColor colorSpace];
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setStrokeColor:color];
|
||||
|
||||
[color release];
|
||||
}
|
||||
|
||||
-(void)setStrokeColor:(KGColor *)color {
|
||||
[color retain];
|
||||
[_strokeColor release];
|
||||
_strokeColor=color;
|
||||
}
|
||||
|
||||
-(void)setGrayStrokeColor:(float)gray:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceGray];
|
||||
float components[2]={gray,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setStrokeColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceRGB];
|
||||
float components[4]={r,g,b,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setStrokeColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceCMYK];
|
||||
float components[5]={c,m,y,k,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setStrokeColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setFillColorWithComponents:(const float *)components {
|
||||
KGColorSpace *colorSpace=[_fillColor colorSpace];
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setFillColor:color];
|
||||
|
||||
[color release];
|
||||
}
|
||||
|
||||
-(void)setFillColor:(KGColor *)color {
|
||||
[color retain];
|
||||
[_fillColor release];
|
||||
_fillColor=color;
|
||||
}
|
||||
|
||||
-(void)setGrayFillColor:(float)gray:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceGray];
|
||||
float components[2]={gray,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setFillColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceRGB];
|
||||
float components[4]={r,g,b,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setFillColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k:(float)alpha {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceCMYK];
|
||||
float components[5]={c,m,y,k,alpha};
|
||||
KGColor *color=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
|
||||
[self setFillColor:color];
|
||||
|
||||
[color release];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setStrokeAndFillAlpha:(float)alpha {
|
||||
[self setStrokeAlpha:alpha];
|
||||
[self setFillAlpha:alpha];
|
||||
}
|
||||
|
||||
-(void)setStrokeAlpha:(float)alpha {
|
||||
KGColor *color=[_strokeColor copyWithAlpha:alpha];
|
||||
[self setStrokeColor:color];
|
||||
[color release];
|
||||
}
|
||||
|
||||
-(void)setGrayStrokeColor:(float)gray {
|
||||
float alpha=[_strokeColor alpha];
|
||||
|
||||
[self setGrayStrokeColor:gray:alpha];
|
||||
}
|
||||
|
||||
-(void)setRGBStrokeColor:(float)r:(float)g:(float)b {
|
||||
float alpha=[_strokeColor alpha];
|
||||
[self setRGBStrokeColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
-(void)setCMYKStrokeColor:(float)c:(float)m:(float)y:(float)k {
|
||||
float alpha=[_strokeColor alpha];
|
||||
[self setCMYKStrokeColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
-(void)setFillAlpha:(float)alpha {
|
||||
KGColor *color=[_fillColor copyWithAlpha:alpha];
|
||||
[self setFillColor:color];
|
||||
[color release];
|
||||
}
|
||||
|
||||
-(void)setGrayFillColor:(float)gray {
|
||||
float alpha=[_fillColor alpha];
|
||||
[self setGrayFillColor:gray:alpha];
|
||||
}
|
||||
|
||||
-(void)setRGBFillColor:(float)r:(float)g:(float)b {
|
||||
float alpha=[_fillColor alpha];
|
||||
[self setRGBFillColor:r:g:b:alpha];
|
||||
}
|
||||
|
||||
-(void)setCMYKFillColor:(float)c:(float)m:(float)y:(float)k {
|
||||
float alpha=[_fillColor alpha];
|
||||
[self setCMYKFillColor:c:m:y:k:alpha];
|
||||
}
|
||||
|
||||
-(void)setPatternPhase:(NSSize)phase {
|
||||
_patternPhase=phase;
|
||||
}
|
||||
|
||||
-(void)setStrokePattern:(KGPattern *)pattern components:(const float *)components {
|
||||
}
|
||||
|
||||
-(void)setFillPattern:(KGPattern *)pattern components:(const float *)components {
|
||||
}
|
||||
|
||||
-(void)setTextMatrix:(CGAffineTransform)transform {
|
||||
_textTransform=transform;
|
||||
}
|
||||
|
||||
-(void)setTextPosition:(float)x:(float)y {
|
||||
}
|
||||
|
||||
-(void)setCharacterSpacing:(float)spacing {
|
||||
_characterSpacing=spacing;
|
||||
}
|
||||
|
||||
-(void)setTextDrawingMode:(int)textMode {
|
||||
_textDrawingMode=textMode;
|
||||
}
|
||||
|
||||
-(void)setFont:(KGFont *)font {
|
||||
}
|
||||
|
||||
-(void)setFontSize:(float)size {
|
||||
}
|
||||
|
||||
-(void)selectFontWithName:(const char *)name size:(float)size encoding:(int)encoding {
|
||||
[_renderingContext selectFontWithName:name pointSize:size antialias:_shouldAntialias];
|
||||
}
|
||||
|
||||
-(void)setShouldSmoothFonts:(BOOL)yesOrNo {
|
||||
_shouldSmoothFonts=yesOrNo;
|
||||
}
|
||||
|
||||
-(void)setLineWidth:(float)width {
|
||||
_lineWidth=width;
|
||||
}
|
||||
|
||||
-(void)setLineCap:(int)lineCap {
|
||||
_lineCap=lineCap;
|
||||
}
|
||||
|
||||
-(void)setLineJoin:(int)lineJoin {
|
||||
_lineJoin=lineJoin;
|
||||
}
|
||||
|
||||
-(void)setMiterLimit:(float)limit {
|
||||
_miterLimit=limit;
|
||||
}
|
||||
|
||||
-(void)setLineDashPhase:(float)phase lengths:(const float *)lengths count:(unsigned)count {
|
||||
_dashPhase=phase;
|
||||
_dashLengthsCount=count;
|
||||
|
||||
if(_dashLengths!=NULL)
|
||||
NSZoneFree(NULL,_dashLengths);
|
||||
|
||||
if(lengths==NULL || count==0)
|
||||
_dashLengths=NULL;
|
||||
else {
|
||||
int i;
|
||||
|
||||
_dashLengths=NSZoneMalloc(NULL,sizeof(float)*count);
|
||||
for(i=0;i<count;i++)
|
||||
_dashLengths[i]=lengths[i];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setRenderingIntent:(int)intent {
|
||||
_renderingIntent=intent;
|
||||
}
|
||||
|
||||
-(void)setBlendMode:(int)mode {
|
||||
_blendMode=mode;
|
||||
}
|
||||
|
||||
-(void)setFlatness:(float)flatness {
|
||||
_flatness=flatness;
|
||||
}
|
||||
|
||||
-(void)setInterpolationQuality:(int)quality {
|
||||
_interpolationQuality=quality;
|
||||
}
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur color:(KGColor *)color {
|
||||
_shadowOffset=offset;
|
||||
_shadowBlur=blur;
|
||||
[color retain];
|
||||
[_shadowColor release];
|
||||
_shadowColor=color;
|
||||
}
|
||||
|
||||
-(void)setShadowOffset:(NSSize)offset blur:(float)blur {
|
||||
KGColorSpace *colorSpace=[[KGColorSpace alloc] initWithDeviceRGB];
|
||||
float components[4]={0,0,0,1.0/3.0};
|
||||
|
||||
_shadowOffset=offset;
|
||||
_shadowBlur=blur;
|
||||
[_shadowColor release];
|
||||
_shadowColor=[[KGColor alloc] initWithColorSpace:colorSpace components:components];
|
||||
[colorSpace release];
|
||||
}
|
||||
|
||||
-(void)setShouldAntialias:(BOOL)flag {
|
||||
_shouldAntialias=flag;
|
||||
}
|
||||
|
||||
-(void)strokeLineSegmentsWithPoints:(NSPoint *)points count:(unsigned)count {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)strokeRect:(NSRect)rect {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)strokeRect:(NSRect)rect width:(float)width {
|
||||
[_renderingContext strokeInUserSpace:_ctm rect:rect width:width color:_strokeColor];
|
||||
}
|
||||
|
||||
-(void)strokeEllipseInRect:(NSRect)rect {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)fillRects:(const NSRect *)rects count:(unsigned)count {
|
||||
[_renderingContext fillInUserSpace:_ctm rects:rects count:count color:_fillColor];
|
||||
}
|
||||
|
||||
-(void)fillEllipseInRect:(NSRect)rect {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)drawPath:(KGPath *)path mode:(int)mode {
|
||||
[_renderingContext drawPathInDeviceSpace:path drawingMode:mode ctm:_ctm lineWidth:_lineWidth fillColor:_fillColor strokeColor:_strokeColor];
|
||||
}
|
||||
|
||||
-(void)clearRect:(NSRect)rect {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)numberOfGlyphs atPoint:(float)x:(float)y {
|
||||
[_renderingContext showInUserSpace:_ctm glyphs:glyphs count:numberOfGlyphs atPoint:x:y color:_fillColor];
|
||||
}
|
||||
|
||||
-(void)showGlyphs:(const CGGlyph *)glyphs count:(unsigned)count advances:(const NSSize *)advances {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)showText:(const char *)text length:(unsigned)length atPoint:(float)x:(float)y {
|
||||
[_renderingContext showInUserSpace:_ctm text:text count:length atPoint:x:y color:_fillColor];
|
||||
}
|
||||
|
||||
-(void)drawShading:(KGShading *)shading {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect {
|
||||
[_renderingContext drawImage:image inRect:rect ctm:_ctm fraction:[_fillColor alpha]];
|
||||
}
|
||||
|
||||
// temporary
|
||||
-(void)setWordSpacing:(float)spacing {
|
||||
_wordSpacing=spacing;
|
||||
}
|
||||
|
||||
-(void)setTextLeading:(float)leading {
|
||||
_textLeading=leading;
|
||||
}
|
||||
|
||||
-(void)copyBitsInRect:(NSRect)rect toPoint:(NSPoint)point {
|
||||
[_renderingContext copyBitsInUserSpace:_ctm rect:rect toPoint:point];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void CGGraphicsSourceOver_rgba32_onto_bgrx32(unsigned char *sourceRGBA,unsigned char *resultBGRX,int width,int height,float fraction) {
|
||||
int sourceIndex=0;
|
||||
int sourceLength=width*height*4;
|
||||
int destinationReadIndex=0;
|
||||
int destinationWriteIndex=0;
|
||||
|
||||
while(sourceIndex<sourceLength){
|
||||
unsigned srcr=sourceRGBA[sourceIndex++];
|
||||
unsigned srcg=sourceRGBA[sourceIndex++];
|
||||
unsigned srcb=sourceRGBA[sourceIndex++];
|
||||
unsigned srca=sourceRGBA[sourceIndex++]*fraction;
|
||||
|
||||
unsigned dstb=resultBGRX[destinationReadIndex++];
|
||||
unsigned dstg=resultBGRX[destinationReadIndex++];
|
||||
unsigned dstr=resultBGRX[destinationReadIndex++];
|
||||
unsigned dsta=255-srca;
|
||||
|
||||
destinationReadIndex++;
|
||||
|
||||
dstr=(srcr*srca+dstr*dsta)>>8;
|
||||
dstg=(srcg*srca+dstg*dsta)>>8;
|
||||
dstb=(srcb*srca+dstb*dsta)>>8;
|
||||
|
||||
resultBGRX[destinationWriteIndex++]=dstb;
|
||||
resultBGRX[destinationWriteIndex++]=dstg;
|
||||
resultBGRX[destinationWriteIndex++]=dstr;
|
||||
destinationWriteIndex++; // skip x
|
||||
}
|
||||
}
|
@ -11,24 +11,34 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@class KGColorSpace,KGDataProvider;
|
||||
|
||||
@interface KGImage : NSObject {
|
||||
unsigned _width;
|
||||
unsigned _height;
|
||||
unsigned _bitsPerComponent;
|
||||
unsigned _bitsPerPixel;
|
||||
unsigned _bytesPerRow;
|
||||
KGColorSpace *_colorSpace;
|
||||
unsigned _bitmapInfo;
|
||||
unsigned _width;
|
||||
unsigned _height;
|
||||
unsigned _bitsPerComponent;
|
||||
unsigned _bitsPerPixel;
|
||||
unsigned _bytesPerRow;
|
||||
KGColorSpace *_colorSpace;
|
||||
unsigned _bitmapInfo;
|
||||
KGDataProvider *_provider;
|
||||
float *_decode;
|
||||
BOOL _interpolate;
|
||||
unsigned _intent;
|
||||
KGImage *_mask;
|
||||
float *_decode;
|
||||
BOOL _interpolate;
|
||||
unsigned _intent;
|
||||
KGImage *_mask;
|
||||
}
|
||||
|
||||
-initWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow colorSpace:(KGColorSpace *)colorSpace bitmapInfo:(unsigned)bitmapInfo provider:(KGDataProvider *)provider decode:(float *)decode interpolate:(BOOL)interpolate renderingIntent:(unsigned)renderingIntent;
|
||||
-initWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow colorSpace:(KGColorSpace *)colorSpace bitmapInfo:(unsigned)bitmapInfo provider:(KGDataProvider *)provider decode:(const float *)decode interpolate:(BOOL)interpolate renderingIntent:(unsigned)renderingIntent;
|
||||
|
||||
-initMaskWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow provider:(KGDataProvider *)provider decode:(float *)decode interpolate:(BOOL)interpolate ;
|
||||
-initMaskWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow provider:(KGDataProvider *)provider decode:(const float *)decode interpolate:(BOOL)interpolate ;
|
||||
|
||||
-(void)addMask:(KGImage *)image;
|
||||
|
||||
-(unsigned)width;
|
||||
-(unsigned)height;
|
||||
-(unsigned)bitsPerComponent;
|
||||
-(unsigned)bitsPerPixel;
|
||||
-(KGColorSpace *)colorSpace;
|
||||
-(unsigned)bitmapInfo;
|
||||
|
||||
-(const void *)bytes;
|
||||
-(unsigned)length;
|
||||
|
||||
@end
|
||||
|
@ -13,7 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@implementation KGImage
|
||||
|
||||
-initWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow colorSpace:(KGColorSpace *)colorSpace bitmapInfo:(unsigned)bitmapInfo provider:(KGDataProvider *)provider decode:(float *)decode interpolate:(BOOL)interpolate renderingIntent:(unsigned)renderingIntent {
|
||||
-initWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow colorSpace:(KGColorSpace *)colorSpace bitmapInfo:(unsigned)bitmapInfo provider:(KGDataProvider *)provider decode:(const float *)decode interpolate:(BOOL)interpolate renderingIntent:(unsigned)renderingIntent {
|
||||
_width=width;
|
||||
_height=height;
|
||||
_bitsPerComponent=bitsPerComponent;
|
||||
@ -29,7 +29,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return self;
|
||||
}
|
||||
|
||||
-initMaskWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow provider:(KGDataProvider *)provider decode:(float *)decode interpolate:(BOOL)interpolate {
|
||||
-initMaskWithWidth:(unsigned)width height:(unsigned)height bitsPerComponent:(unsigned)bitsPerComponent bitsPerPixel:(unsigned)bitsPerPixel bytesPerRow:(unsigned)bytesPerRow provider:(KGDataProvider *)provider decode:(const float *)decode interpolate:(BOOL)interpolate {
|
||||
_width=width;
|
||||
_height=height;
|
||||
_bitsPerComponent=bitsPerComponent;
|
||||
@ -45,10 +45,48 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_colorSpace release];
|
||||
[_provider release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)addMask:(KGImage *)image {
|
||||
[image retain];
|
||||
[_mask release];
|
||||
_mask=image;
|
||||
}
|
||||
|
||||
-(unsigned)width {
|
||||
return _width;
|
||||
}
|
||||
|
||||
-(unsigned)height {
|
||||
return _height;
|
||||
}
|
||||
|
||||
-(unsigned)bitsPerComponent {
|
||||
return _bitsPerComponent;
|
||||
}
|
||||
|
||||
-(unsigned)bitsPerPixel {
|
||||
return _bitsPerPixel;
|
||||
}
|
||||
|
||||
-(KGColorSpace *)colorSpace {
|
||||
return _colorSpace;
|
||||
}
|
||||
|
||||
-(unsigned)bitmapInfo {
|
||||
return _bitmapInfo;
|
||||
}
|
||||
|
||||
-(const void *)bytes {
|
||||
return [_provider bytes];
|
||||
}
|
||||
|
||||
-(unsigned)length {
|
||||
return [_provider length];
|
||||
}
|
||||
|
||||
@end
|
||||
|
22
AppKit/CoreGraphics.subproj/KGImage_context.h
Normal file
22
AppKit/CoreGraphics.subproj/KGImage_context.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// it occurs to me that this should be a layer
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class KGRenderingContext;
|
||||
|
||||
@interface KGImage_context : NSObject {
|
||||
KGRenderingContext *_context;
|
||||
}
|
||||
|
||||
-initWithRenderingContext:(KGRenderingContext *)context;
|
||||
|
||||
-(KGRenderingContext *)renderingContext;
|
||||
|
||||
@end
|
29
AppKit/CoreGraphics.subproj/KGImage_context.m
Normal file
29
AppKit/CoreGraphics.subproj/KGImage_context.m
Normal file
@ -0,0 +1,29 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGImage_context.h"
|
||||
#import "KGRenderingContext.h"
|
||||
|
||||
@implementation KGImage_context
|
||||
|
||||
-initWithRenderingContext:(KGRenderingContext *)context {
|
||||
_context=[context retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_context release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(KGRenderingContext *)renderingContext {
|
||||
return _context;
|
||||
}
|
||||
|
||||
@end
|
26
AppKit/CoreGraphics.subproj/CGRenderingContext.h → AppKit/CoreGraphics.subproj/KGLayer.h
Executable file → Normal file
26
AppKit/CoreGraphics.subproj/CGRenderingContext.h → AppKit/CoreGraphics.subproj/KGLayer.h
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
@ -6,22 +6,20 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
|
||||
@class CGContext;
|
||||
@class KGContext,NSDictionary;
|
||||
|
||||
@interface CGRenderingContext : NSObject
|
||||
@interface KGLayer : NSObject {
|
||||
KGContext *_context;
|
||||
NSSize _size;
|
||||
NSDictionary *_unused;
|
||||
}
|
||||
|
||||
-initRelativeToContext:(KGContext *)context size:(NSSize)size unused:(NSDictionary *)unused;
|
||||
|
||||
-(KGContext *)context;
|
||||
-(NSSize)size;
|
||||
|
||||
-(CGContext *)graphicsContextWithTransform:(CGAffineTransform)transform clipRect:(NSRect)clipRect;
|
||||
|
||||
-(void)beginPage;
|
||||
-(void)endPage;
|
||||
-(void)beginDocument;
|
||||
-(void)endDocument;
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley;
|
||||
|
||||
@end
|
18
AppKit/Win32.subproj/Win32Brush.m → AppKit/CoreGraphics.subproj/KGLayer.m
Executable file → Normal file
18
AppKit/Win32.subproj/Win32Brush.m → AppKit/CoreGraphics.subproj/KGLayer.m
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
@ -7,22 +7,20 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/Win32Brush.h>
|
||||
#import "KGLayer.h"
|
||||
|
||||
@implementation Win32Brush
|
||||
@implementation KGLayer
|
||||
|
||||
-initWithCOLORREF:(COLORREF)colorRef {
|
||||
_handle=CreateSolidBrush(colorRef);
|
||||
-initRelativeToContext:(KGContext *)context size:(NSSize)size unused:(NSDictionary *)unused {
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
DeleteObject(_handle);
|
||||
NSDeallocateObject(self);
|
||||
-(KGContext *)context {
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(HBRUSH)brushHandle {
|
||||
return _handle;
|
||||
-(NSSize)size {
|
||||
return _size;
|
||||
}
|
||||
|
||||
@end
|
37
AppKit/CoreGraphics.subproj/KGMutablePath.h
Normal file
37
AppKit/CoreGraphics.subproj/KGMutablePath.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGPath.h"
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
|
||||
@interface KGMutablePath : KGPath <NSCopying> {
|
||||
unsigned _capacityOfOperators;
|
||||
unsigned _capacityOfPoints;
|
||||
}
|
||||
|
||||
-(void)reset;
|
||||
|
||||
-(void)moveToPoint:(NSPoint)point withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)addLineToPoint:(NSPoint)point withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)addCurveToControlPoint:(NSPoint)cp1 controlPoint:(NSPoint)cp2 endPoint:(NSPoint)endPoint withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)addCurveToControlPoint:(NSPoint)cp1 endPoint:(NSPoint)endPoint withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)closeSubpath;
|
||||
|
||||
-(void)addLinesWithPoints:(NSPoint *)points count:(unsigned)count withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
-(void)addRect:(NSRect)rect withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)addRects:(NSRect *)rects count:(unsigned)count withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
-(void)addArcAtPoint:(NSPoint)point radius:(float)radius startAngle:(float)startRadian endAngle:(float)endRadian clockwise:(BOOL)clockwise withTransform:(CGAffineTransform *)matrix;
|
||||
-(void)addArcToPoint:(NSPoint)point1 point:(NSPoint)point2 radius:(float)radius withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
-(void)addEllipseInRect:(NSRect)rect withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
-(void)addPath:(KGPath *)path withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
@end
|
232
AppKit/CoreGraphics.subproj/KGMutablePath.m
Normal file
232
AppKit/CoreGraphics.subproj/KGMutablePath.m
Normal file
@ -0,0 +1,232 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGMutablePath.h"
|
||||
#import "KGPath.h"
|
||||
|
||||
// Bezier and arc to bezier algorithms from: Windows Graphics Programming by Feng Yuan
|
||||
|
||||
@implementation KGMutablePath
|
||||
|
||||
#if 0
|
||||
// this should go in a rendering context
|
||||
static void bezier(KGGraphicsState *self,double x1,double y1,double x2, double y2,double x3,double y3,double x4,double y4){
|
||||
// Ax+By+C=0 is the line (x1,y1) (x4,y4);
|
||||
double A=y4-y1;
|
||||
double B=x1-x4;
|
||||
double C=y1*(x4-x1)-x1*(y4-y1);
|
||||
double AB=A*A+B*B;
|
||||
|
||||
if((A*x2+B*y2+C)*(A*x2+B*y2+C)<AB &&
|
||||
(A*x3+B*y3+C)*(A*x3+B*y3+C)<AB){
|
||||
[self moveToPoint:x1:y1];
|
||||
[self addLineToPoint:x4:y4];
|
||||
return;
|
||||
}
|
||||
else {
|
||||
double x12=x1+x2;
|
||||
double y12=y1+y2;
|
||||
double x23=x2+x3;
|
||||
double y23=y2+y3;
|
||||
double x34=x3+x4;
|
||||
double y34=y3+y4;
|
||||
double x1223=x12+x23;
|
||||
double y1223=y12+y23;
|
||||
double x2334=x23+x34;
|
||||
double y2334=y23+y34;
|
||||
double x=x1223+x2334;
|
||||
double y=y1223+y2334;
|
||||
|
||||
bezier(self,x1,y1,x12/2,y12/2,x1223/4,y1223/4,x/8,y/8);
|
||||
bezier(self,x/8,y/8,x2334/4,y2334/4,x34/2,y34/2,x4,y4);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
-initWithOperators:(unsigned char *)operators numberOfOperators:(unsigned)numberOfOperators points:(NSPoint *)points numberOfPoints:(unsigned)numberOfPoints {
|
||||
[super initWithOperators:operators numberOfOperators:numberOfOperators points:points numberOfPoints:numberOfPoints];
|
||||
_capacityOfOperators=numberOfOperators;
|
||||
_capacityOfPoints=numberOfPoints;
|
||||
return self;
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
return [[KGPath allocWithZone:zone] initWithOperators:_operators numberOfOperators:_numberOfOperators points:_points numberOfPoints:_numberOfPoints];
|
||||
}
|
||||
|
||||
-(void)reset {
|
||||
_numberOfOperators=0;
|
||||
_numberOfPoints=0;
|
||||
}
|
||||
|
||||
static void expandOperatorCapacity(KGMutablePath *self,unsigned delta){
|
||||
if(self->_numberOfOperators+delta>self->_capacityOfOperators){
|
||||
self->_capacityOfOperators=self->_numberOfOperators+delta;
|
||||
self->_capacityOfOperators=(self->_capacityOfOperators/16+1)*16;
|
||||
self->_operators=NSZoneRealloc(NULL,self->_operators,self->_capacityOfOperators);
|
||||
}
|
||||
}
|
||||
|
||||
static void expandPointCapacity(KGMutablePath *self,unsigned delta){
|
||||
if(self->_numberOfPoints+delta>self->_capacityOfPoints){
|
||||
self->_capacityOfPoints=self->_numberOfPoints+delta;
|
||||
self->_capacityOfPoints=(self->_capacityOfPoints/32+1)*32;
|
||||
self->_points=NSZoneRealloc(NULL,self->_points,self->_capacityOfPoints*sizeof(NSPoint));
|
||||
}
|
||||
}
|
||||
|
||||
-(void)moveToPoint:(NSPoint)point withTransform:(CGAffineTransform *)matrix {
|
||||
if(matrix!=NULL)
|
||||
point=CGPointApplyAffineTransform(point,*matrix);
|
||||
|
||||
expandOperatorCapacity(self,1);
|
||||
expandPointCapacity(self,1);
|
||||
_operators[_numberOfOperators++]=KGPathOperatorMoveToPoint;
|
||||
_points[_numberOfPoints++]=point;
|
||||
}
|
||||
|
||||
-(void)addLineToPoint:(NSPoint)point withTransform:(CGAffineTransform *)matrix {
|
||||
if(matrix!=NULL)
|
||||
point=CGPointApplyAffineTransform(point,*matrix);
|
||||
|
||||
expandOperatorCapacity(self,1);
|
||||
expandPointCapacity(self,1);
|
||||
_operators[_numberOfOperators++]=KGPathOperatorLineToPoint;
|
||||
_points[_numberOfPoints++]=point;
|
||||
}
|
||||
|
||||
-(void)addCurveToControlPoint:(NSPoint)cp1 controlPoint:(NSPoint)cp2 endPoint:(NSPoint)endPoint withTransform:(CGAffineTransform *)matrix {
|
||||
if(matrix!=NULL){
|
||||
cp1=CGPointApplyAffineTransform(cp1,*matrix);
|
||||
cp2=CGPointApplyAffineTransform(cp2,*matrix);
|
||||
endPoint=CGPointApplyAffineTransform(endPoint,*matrix);
|
||||
}
|
||||
|
||||
expandOperatorCapacity(self,1);
|
||||
expandPointCapacity(self,3);
|
||||
_operators[_numberOfOperators++]=KGPathOperatorCurveToPoint;
|
||||
_points[_numberOfPoints++]=cp1;
|
||||
_points[_numberOfPoints++]=cp2;
|
||||
_points[_numberOfPoints++]=endPoint;
|
||||
}
|
||||
|
||||
-(void)addCurveToControlPoint:(NSPoint)cp1 endPoint:(NSPoint)endPoint withTransform:(CGAffineTransform *)matrix {
|
||||
if(matrix!=NULL){
|
||||
cp1=CGPointApplyAffineTransform(cp1,*matrix);
|
||||
endPoint=CGPointApplyAffineTransform(endPoint,*matrix);
|
||||
}
|
||||
|
||||
expandOperatorCapacity(self,1);
|
||||
expandPointCapacity(self,2);
|
||||
_operators[_numberOfOperators++]=KGPathOperatorQuadCurveToPoint;
|
||||
_points[_numberOfPoints++]=cp1;
|
||||
_points[_numberOfPoints++]=endPoint;
|
||||
}
|
||||
|
||||
-(void)closeSubpath {
|
||||
expandOperatorCapacity(self,1);
|
||||
_operators[_numberOfOperators++]=KGPathOperatorCloseSubpath;
|
||||
}
|
||||
|
||||
-(void)addLinesWithPoints:(NSPoint *)points count:(unsigned)count withTransform:(CGAffineTransform *)matrix {
|
||||
int i;
|
||||
|
||||
if(count==0)
|
||||
return;
|
||||
|
||||
[self moveToPoint:points[0] withTransform:matrix];
|
||||
for(i=1;i<count;i++)
|
||||
[self addLineToPoint:points[i] withTransform:matrix];
|
||||
}
|
||||
|
||||
-(void)addRect:(NSRect)rect withTransform:(CGAffineTransform *)matrix {
|
||||
[self moveToPoint:NSMakePoint(NSMinX(rect),NSMinY(rect)) withTransform:matrix];
|
||||
[self addLineToPoint:NSMakePoint(NSMaxX(rect),NSMinY(rect)) withTransform:matrix];
|
||||
[self addLineToPoint:NSMakePoint(NSMaxX(rect),NSMaxY(rect)) withTransform:matrix];
|
||||
[self addLineToPoint:NSMakePoint(NSMinX(rect),NSMaxY(rect)) withTransform:matrix];
|
||||
[self closeSubpath];
|
||||
}
|
||||
|
||||
-(void)addRects:(NSRect *)rects count:(unsigned)count withTransform:(CGAffineTransform *)matrix {
|
||||
int i;
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
[self addRect:rects[i] withTransform:matrix];
|
||||
}
|
||||
|
||||
-(void)addArcAtPoint:(NSPoint)point radius:(float)radius startAngle:(float)startRadian endAngle:(float)endRadian clockwise:(BOOL)clockwise withTransform:(CGAffineTransform *)matrix {
|
||||
// This is not complete, doesn't handle clockwise and probably doesn't manipulate the current
|
||||
// point properly
|
||||
float radiusx=radius,radiusy=radius;
|
||||
double remainder=endRadian-startRadian;
|
||||
double delta=3.141592653589793238/2; // 90 degrees
|
||||
int i;
|
||||
|
||||
for(;remainder>0;startRadian+=delta,remainder-=delta){
|
||||
double sweepangle=(remainder>delta)?delta:remainder;
|
||||
double XY[8];
|
||||
NSPoint points[4];
|
||||
double B=sin(sweepangle/2);
|
||||
double C=cos(sweepangle/2);
|
||||
double A=1-C;
|
||||
double X=A*4/3;
|
||||
double Y=B-X*(1-A)/B;
|
||||
double s=sin(startRadian+sweepangle/2);
|
||||
double c=cos(startRadian+sweepangle/2);
|
||||
|
||||
XY[0]= C;
|
||||
XY[1]=-B;
|
||||
XY[2]= C+X;
|
||||
XY[3]=-Y;
|
||||
XY[4]= C+X;
|
||||
XY[5]= Y;
|
||||
XY[6]= C;
|
||||
XY[7]= B;
|
||||
|
||||
for(i=0;i<4;i++){
|
||||
points[i].x=point.x+(XY[i*2]*c-XY[i*2+1]*s)*radiusx;
|
||||
points[i].y=point.y+(XY[i*2]*s+XY[i*2+1]*c)*radiusy;
|
||||
}
|
||||
|
||||
[self moveToPoint:points[0] withTransform:matrix];
|
||||
[self addCurveToControlPoint:points[1] controlPoint:points[2] endPoint:points[3] withTransform:matrix];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)addArcToPoint:(NSPoint)point1 point:(NSPoint)point2 radius:(float)radius withTransform:(CGAffineTransform *)matrix {
|
||||
}
|
||||
|
||||
-(void)addEllipseInRect:(NSRect)rect withTransform:(CGAffineTransform *)matrix {
|
||||
}
|
||||
|
||||
-(void)addPath:(KGPath *)path withTransform:(CGAffineTransform *)matrix {
|
||||
unsigned opsCount=[path numberOfOperators];
|
||||
const unsigned char *ops=[path operators];
|
||||
unsigned pointCount=[path numberOfPoints];
|
||||
const NSPoint *points=[path points];
|
||||
unsigned i;
|
||||
|
||||
expandOperatorCapacity(self,opsCount);
|
||||
expandPointCapacity(self,pointCount);
|
||||
|
||||
for(i=0;i<opsCount;i++)
|
||||
_operators[_numberOfOperators++]=ops[i];
|
||||
|
||||
if(matrix==NULL){
|
||||
for(i=0;i<pointCount;i++)
|
||||
_points[_numberOfPoints++]=points[i];
|
||||
}
|
||||
else {
|
||||
for(i=0;i<pointCount;i++)
|
||||
_points[_numberOfPoints++]=CGPointApplyAffineTransform(points[i],*matrix);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -119,7 +119,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
unsigned i,count=[self count];
|
||||
KGPDFReal *numbers;
|
||||
|
||||
numbers=NSZoneMalloc(NULL,sizeof(float)*count);
|
||||
numbers=NSZoneMalloc(NULL,sizeof(KGPDFReal)*count);
|
||||
for(i=0;i<count;i++){
|
||||
if(![self getNumberAtIndex:i value:numbers+i]){
|
||||
NSZoneFree(NULL,numbers);
|
||||
|
@ -27,7 +27,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
KGPDFDictionary *dictionary=[page dictionary];
|
||||
KGPDFDictionary *resources;
|
||||
KGPDFObject *contents;
|
||||
NSMutableArray *streams=[[[NSMutableArray alloc] init] autorelease];
|
||||
NSMutableArray *streams=[NSMutableArray array];
|
||||
|
||||
if(![dictionary getDictionaryForKey:"Resources" value:&resources])
|
||||
resources=nil;
|
||||
|
@ -6,12 +6,562 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
/* zlib decode is based on the public domain zlib decode v0.2 by Sean Barrett 2006-11-18 http://www.nothings.org/stb_image.c */
|
||||
|
||||
// First revision - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGPDFFilter.h"
|
||||
#import "KGPDFObject.h"
|
||||
#import "KGPDFDictionary.h"
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <assert.h>
|
||||
#import <stdlib.h>
|
||||
#import <memory.h>
|
||||
|
||||
@interface KGPDFFilter : NSObject {
|
||||
KGPDFDictionary *_parameters;
|
||||
}
|
||||
|
||||
+(NSData *)decodeWithName:(const char *)name data:(NSData *)data parameters:(KGPDFDictionary *)parameters;
|
||||
|
||||
@end
|
||||
|
||||
NSData *KGPDFFilterWithName(const char *name,NSData *data,KGPDFDictionary *parameters) {
|
||||
return [KGPDFFilter decodeWithName:name data:data parameters:parameters];
|
||||
}
|
||||
|
||||
@implementation KGPDFFilter
|
||||
|
||||
typedef unsigned short uint16;
|
||||
static int e(const char *str){
|
||||
NSLog(@"STB ERROR %s",str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fast-way is faster to check than jpeg huffman, but slow way is slower
|
||||
#define ZFAST_BITS 9 // accelerate all cases in default tables
|
||||
#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)
|
||||
|
||||
typedef struct {
|
||||
uint16 fast[1 << ZFAST_BITS];
|
||||
uint16 firstcode[16];
|
||||
int maxcode[17];
|
||||
uint16 firstsymbol[16];
|
||||
unsigned char size[288];
|
||||
uint16 value[288];
|
||||
} zhuffman;
|
||||
|
||||
static int bitreverse16(int n) {
|
||||
n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);
|
||||
n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);
|
||||
n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);
|
||||
n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);
|
||||
return n;
|
||||
}
|
||||
|
||||
static int bit_reverse(int v, int bits) {
|
||||
assert(bits <= 16);
|
||||
// to bit reverse n bits, reverse 16 and shift
|
||||
// e.g. 11 bits, bit reverse and shift away 5
|
||||
return bitreverse16(v) >> (16-bits);
|
||||
}
|
||||
|
||||
static int zbuild_huffman(zhuffman *z, const unsigned char *sizelist, int num) {
|
||||
int i,k=0;
|
||||
int code, next_code[16], sizes[17];
|
||||
|
||||
// DEFLATE spec for generating codes
|
||||
memset(sizes, 0, sizeof(sizes));
|
||||
memset(z->fast, 255, sizeof(z->fast));
|
||||
for (i=0; i < num; ++i)
|
||||
++sizes[sizelist[i]];
|
||||
sizes[0] = 0;
|
||||
for (i=1; i < 16; ++i)
|
||||
assert(sizes[i] <= (1 << i));
|
||||
code = 0;
|
||||
for (i=1; i < 16; ++i) {
|
||||
next_code[i] = code;
|
||||
z->firstcode[i] = code;
|
||||
z->firstsymbol[i] = k;
|
||||
code = (code + sizes[i]);
|
||||
if (sizes[i])
|
||||
if (code-1 >= (1 << i)) return e("bad codelengths");
|
||||
z->maxcode[i] = code << (16-i); // preshift for inner loop
|
||||
code <<= 1;
|
||||
k += sizes[i];
|
||||
}
|
||||
z->maxcode[16] = 0x10000; // sentinel
|
||||
for (i=0; i < num; ++i) {
|
||||
int s = sizelist[i];
|
||||
if (s) {
|
||||
int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
|
||||
z->size[c] = s;
|
||||
z->value[c] = i;
|
||||
if (s <= ZFAST_BITS) {
|
||||
int k = bit_reverse(next_code[s],s);
|
||||
while (k < (1 << ZFAST_BITS)) {
|
||||
z->fast[k] = c;
|
||||
k += (1 << s);
|
||||
}
|
||||
}
|
||||
++next_code[s];
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// zlib-from-memory implementation for PNG reading
|
||||
// because PNG allows splitting the zlib stream arbitrarily,
|
||||
// and it's annoying structurally to have PNG call ZLIB call PNG,
|
||||
// we require PNG read all the IDATs and combine them into a single
|
||||
// memory buffer
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *inBytes;
|
||||
unsigned inLength;
|
||||
unsigned inPosition;
|
||||
|
||||
unsigned char *outBytes;
|
||||
unsigned outLength;
|
||||
unsigned outPosition;
|
||||
|
||||
unsigned int code_buffer;
|
||||
int num_bits;
|
||||
zhuffman z_length;
|
||||
zhuffman z_distance;
|
||||
} KGFlateDecode;
|
||||
|
||||
|
||||
static unsigned char KGFlateDecodeNextByte(KGFlateDecode *inflate){
|
||||
if(inflate->inPosition<inflate->inLength)
|
||||
return inflate->inBytes[inflate->inPosition++];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int length_base[31] = {
|
||||
3,4,5,6,7,8,9,10,11,13,
|
||||
15,17,19,23,27,31,35,43,51,59,
|
||||
67,83,99,115,131,163,195,227,258,0,0
|
||||
};
|
||||
|
||||
static int length_extra[31]= {
|
||||
0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0
|
||||
};
|
||||
|
||||
static int dist_base[32] = {
|
||||
1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
|
||||
257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0
|
||||
};
|
||||
|
||||
static int dist_extra[32] = {
|
||||
0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13
|
||||
};
|
||||
|
||||
static void fill_bits(KGFlateDecode *inflate) {
|
||||
do {
|
||||
assert(inflate->code_buffer < (1U << inflate->num_bits));
|
||||
|
||||
inflate->code_buffer |= KGFlateDecodeNextByte(inflate) << inflate->num_bits;
|
||||
inflate->num_bits += 8;
|
||||
} while (inflate->num_bits <= 24);
|
||||
}
|
||||
|
||||
static unsigned int zreceive(KGFlateDecode *inflate,int n) {
|
||||
unsigned int k;
|
||||
|
||||
if (inflate->num_bits < n)
|
||||
fill_bits(inflate);
|
||||
|
||||
k = inflate->code_buffer & ((1 << n) - 1);
|
||||
inflate->code_buffer >>= n;
|
||||
inflate->num_bits -= n;
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
static int zhuffman_decode(KGFlateDecode *inflate,zhuffman *z) {
|
||||
int b,s,k;
|
||||
|
||||
if (inflate->num_bits < 16)
|
||||
fill_bits(inflate);
|
||||
|
||||
b = z->fast[inflate->code_buffer & ZFAST_MASK];
|
||||
if (b < 0xffff) {
|
||||
s = z->size[b];
|
||||
inflate->code_buffer >>= s;
|
||||
inflate->num_bits -= s;
|
||||
|
||||
return z->value[b];
|
||||
}
|
||||
|
||||
// not resolved by fast table, so compute it the slow way
|
||||
// use jpeg approach, which requires MSbits at top
|
||||
k = bit_reverse(inflate->code_buffer, 16);
|
||||
for (s=ZFAST_BITS+1; ; ++s)
|
||||
if (k < z->maxcode[s])
|
||||
break;
|
||||
if (s == 16)
|
||||
return -1; // invalid code!
|
||||
|
||||
// code size is s, so:
|
||||
b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
|
||||
|
||||
assert(z->size[b] == s);
|
||||
|
||||
inflate->code_buffer >>= s;
|
||||
inflate->num_bits -= s;
|
||||
|
||||
return z->value[b];
|
||||
}
|
||||
|
||||
// need to make room for n bytes
|
||||
static void expand(KGFlateDecode *inflate,int n) {
|
||||
if(inflate->outPosition+n>inflate->outLength){
|
||||
do{
|
||||
inflate->outLength*=2;
|
||||
}while (inflate->outPosition + n > inflate->outLength);
|
||||
|
||||
inflate->outBytes = NSZoneRealloc(NULL,inflate->outBytes, inflate->outLength);
|
||||
}
|
||||
}
|
||||
|
||||
static void appendBytes(KGFlateDecode *inflate,const unsigned char *bytes,unsigned length){
|
||||
unsigned i;
|
||||
|
||||
for(i=0;i<length;i++)
|
||||
inflate->outBytes[inflate->outPosition++]=bytes[i];
|
||||
}
|
||||
|
||||
static int parse_huffman_block(KGFlateDecode *inflate) {
|
||||
for(;;) {
|
||||
int z = zhuffman_decode(inflate,&(inflate->z_length));
|
||||
|
||||
if (z < 256) {
|
||||
if (z < 0)
|
||||
return e("bad huffman code"); // error in huffman codes
|
||||
|
||||
expand(inflate,1);
|
||||
inflate->outBytes[inflate->outPosition++] = z;
|
||||
} else {
|
||||
unsigned char *p;
|
||||
int len,dist;
|
||||
|
||||
if (z == 256)
|
||||
return 1;
|
||||
|
||||
z -= 257;
|
||||
len = length_base[z];
|
||||
if (length_extra[z])
|
||||
len += zreceive(inflate,length_extra[z]);
|
||||
|
||||
z = zhuffman_decode(inflate,&(inflate->z_distance));
|
||||
|
||||
if (z < 0)
|
||||
return e("bad huffman code");
|
||||
|
||||
dist = dist_base[z];
|
||||
if (dist_extra[z])
|
||||
dist += zreceive(inflate,dist_extra[z]);
|
||||
|
||||
if (inflate->outPosition < dist)
|
||||
return e("bad dist");
|
||||
|
||||
expand(inflate,len); // we need to pre-expand to make sure outBytes doesn't change
|
||||
appendBytes(inflate,inflate->outBytes+inflate->outPosition-dist,len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int compute_huffman_codes(KGFlateDecode *inflate) {
|
||||
static unsigned char length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
|
||||
zhuffman z_codelength;
|
||||
unsigned char lencodes[286+32+137];//padding for maximum single op
|
||||
unsigned char codelength_sizes[19];
|
||||
int i,n;
|
||||
|
||||
int hlit = zreceive(inflate,5) + 257;
|
||||
int hdist = zreceive(inflate,5) + 1;
|
||||
int hclen = zreceive(inflate,4) + 4;
|
||||
|
||||
memset(codelength_sizes, 0, sizeof(codelength_sizes));
|
||||
for (i=0; i < hclen; ++i) {
|
||||
int s = zreceive(inflate,3);
|
||||
|
||||
codelength_sizes[length_dezigzag[i]] = s;
|
||||
}
|
||||
if (!zbuild_huffman(&z_codelength, codelength_sizes, 19))
|
||||
return 0;
|
||||
|
||||
n = 0;
|
||||
while (n < hlit + hdist) {
|
||||
int c = zhuffman_decode(inflate,&z_codelength);
|
||||
|
||||
assert(c >= 0 && c < 19);
|
||||
|
||||
if (c < 16)
|
||||
lencodes[n++] = c;
|
||||
else if (c == 16) {
|
||||
c = zreceive(inflate,2)+3;
|
||||
memset(lencodes+n, lencodes[n-1], c);
|
||||
n += c;
|
||||
} else if (c == 17) {
|
||||
c = zreceive(inflate,3)+3;
|
||||
memset(lencodes+n, 0, c);
|
||||
n += c;
|
||||
} else {
|
||||
assert(c == 18);
|
||||
c = zreceive(inflate,7)+11;
|
||||
memset(lencodes+n, 0, c);
|
||||
n += c;
|
||||
}
|
||||
}
|
||||
if (n != hlit+hdist)
|
||||
return e("bad codelengths");
|
||||
if (!zbuild_huffman(&(inflate->z_length), lencodes, hlit))
|
||||
return 0;
|
||||
if (!zbuild_huffman(&(inflate->z_distance), lencodes+hlit, hdist))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int parse_uncompressed_block(KGFlateDecode *inflate) {
|
||||
unsigned char header[4];
|
||||
int len,nlen,k;
|
||||
|
||||
if (inflate->num_bits & 7)
|
||||
zreceive(inflate,inflate->num_bits & 7); // discard
|
||||
|
||||
// drain the bit-packed data into header
|
||||
k = 0;
|
||||
while (inflate->num_bits > 0) {
|
||||
header[k++] = (unsigned char) (inflate->code_buffer & 255); // wtf this warns?
|
||||
inflate->code_buffer >>= 8;
|
||||
inflate->num_bits -= 8;
|
||||
}
|
||||
|
||||
assert(inflate->num_bits == 0);
|
||||
|
||||
// now fill header the normal way
|
||||
while (k < 4)
|
||||
header[k++] = KGFlateDecodeNextByte(inflate);
|
||||
|
||||
len = header[0] * 256 + header[1];
|
||||
nlen = header[2] * 256 + header[3];
|
||||
|
||||
if (nlen != ~len)
|
||||
return e("zlib corrupt");
|
||||
if (inflate->inPosition + len > inflate->inLength)
|
||||
return e("read past buffer");
|
||||
|
||||
expand(inflate,len);
|
||||
appendBytes(inflate,inflate->inBytes+inflate->inPosition,len);
|
||||
inflate->inPosition += len;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int parse_zlib_header(KGFlateDecode *inflate) {
|
||||
int cmf = KGFlateDecodeNextByte(inflate);
|
||||
int cm = cmf & 15;
|
||||
// int cinfo = cmf >> 4;
|
||||
int flg = KGFlateDecodeNextByte(inflate);
|
||||
|
||||
if ((cmf*256+flg) % 31 != 0)
|
||||
return e("bad zlib header"); // zlib spec
|
||||
if (flg & 32)
|
||||
return e("no preset dict"); // preset dictionary not allowed in png
|
||||
if (cm != 8)
|
||||
return e("bad compression"); // DEFLATE required for png
|
||||
// window = 1 << (8 + cinfo)... but who cares, we fully buffer output
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const unsigned char default_length[288] = {
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
8,8,8,8,8,8,8,8,8,8,8,8,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
9,9,9,9,
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,
|
||||
8,8,8,8,8,8,8,8,
|
||||
|
||||
};
|
||||
|
||||
static const unsigned char default_distance[32] = {
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
};
|
||||
|
||||
static int parse_zlib(KGFlateDecode *inflate) {
|
||||
int final, type;
|
||||
|
||||
if (!parse_zlib_header(inflate))
|
||||
return 0;
|
||||
inflate->num_bits = 0;
|
||||
inflate->code_buffer = 0;
|
||||
do {
|
||||
final = zreceive(inflate,1);
|
||||
type = zreceive(inflate,2);
|
||||
if (type == 0) {
|
||||
if (!parse_uncompressed_block(inflate))
|
||||
return 0;
|
||||
} else if (type == 3) {
|
||||
return 0;
|
||||
} else {
|
||||
if (type == 1) {
|
||||
if (!zbuild_huffman(&(inflate->z_length) , default_length , 288))
|
||||
return 0;
|
||||
if (!zbuild_huffman(&(inflate->z_distance), default_distance, 32))
|
||||
return 0;
|
||||
} else {
|
||||
if (!compute_huffman_codes(inflate))
|
||||
return 0;
|
||||
}
|
||||
if (!parse_huffman_block(inflate))
|
||||
return 0;
|
||||
}
|
||||
} while (!final);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned char *stbi_zlib_decode_malloc(KGFlateDecode *inflate,const unsigned char *buffer, int len, int *outlen) {
|
||||
int initial_size=8192;
|
||||
unsigned char *p = NSZoneMalloc(NULL,initial_size);
|
||||
|
||||
inflate->inBytes = buffer;
|
||||
inflate->inLength=len;
|
||||
inflate->inPosition=0;
|
||||
|
||||
if (p == NULL) return NULL;
|
||||
|
||||
inflate->outBytes = p;
|
||||
inflate->outPosition=0;
|
||||
inflate->outLength = initial_size;
|
||||
|
||||
if (parse_zlib(inflate)) {
|
||||
*outlen = inflate->outPosition;
|
||||
return inflate->outBytes;
|
||||
} else {
|
||||
free(inflate->outBytes);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
+(NSData *)FlateDecode_data:(NSData *)data parameters:(KGPDFDictionary *)parameters {
|
||||
KGFlateDecode flateDecode;
|
||||
|
||||
int len;
|
||||
unsigned char *result=stbi_zlib_decode_malloc(&flateDecode,[data bytes],[data length],&len);
|
||||
|
||||
if(result==NULL)
|
||||
return nil;
|
||||
|
||||
return [NSData dataWithBytesNoCopy:result length:len];
|
||||
}
|
||||
|
||||
|
||||
+(NSData *)decodeWithName:(const char *)name data:(NSData *)data parameters:(KGPDFDictionary *)parameters {
|
||||
if(strcmp(name,"FlateDecode")==0){
|
||||
KGPDFInteger predictor;
|
||||
|
||||
data=[self FlateDecode_data:data parameters:parameters];
|
||||
|
||||
if([parameters getIntegerForKey:"Predictor" value:&predictor]){
|
||||
if(predictor>1){
|
||||
NSMutableData *mutable=[NSMutableData data];
|
||||
const char *bytes=[data bytes];
|
||||
unsigned length=[data length];
|
||||
KGPDFInteger colors;
|
||||
KGPDFInteger bitsPerComponent;
|
||||
KGPDFInteger columns;
|
||||
int bytesPerRow;
|
||||
int row,rowLength,numberOfRows;
|
||||
|
||||
if(![parameters getIntegerForKey:"Colors" value:&colors])
|
||||
colors=1;
|
||||
if(![parameters getIntegerForKey:"BitsPerComponent" value:&bitsPerComponent])
|
||||
bitsPerComponent=8;
|
||||
if(![parameters getIntegerForKey:"Columns" value:&columns])
|
||||
columns=1;
|
||||
|
||||
//NSLog(@"predictor=%d,colors=%d,bpc=%d,columns=%d,length=%d",predictor,colors,bitsPerComponent,columns,length);
|
||||
|
||||
bytesPerRow=(((colors*bitsPerComponent)*columns)+7)/8;
|
||||
rowLength=bytesPerRow+1;
|
||||
numberOfRows=length/rowLength;
|
||||
|
||||
if((length%rowLength)!=0)
|
||||
;//NSLog(@"length mod rowLength=%d",length%rowLength);
|
||||
|
||||
for(row=0;row<numberOfRows;row++){
|
||||
int i,filter=bytes[0];
|
||||
char change[rowLength];
|
||||
|
||||
for(i=0;i<rowLength-1;i++)
|
||||
change[i]=bytes[1+i];
|
||||
|
||||
if(filter==0){
|
||||
// do nothing
|
||||
}
|
||||
else if(filter==1){
|
||||
int last=change[0];
|
||||
|
||||
for(i=1;i<rowLength-1;i++){
|
||||
last=last+change[i];
|
||||
change[i]=last;
|
||||
}
|
||||
}
|
||||
else if(filter==2){
|
||||
int last=change[0];
|
||||
|
||||
for(i=1;i<rowLength-1;i++){
|
||||
last=last-change[i];
|
||||
change[i]=last;
|
||||
}
|
||||
}
|
||||
else {
|
||||
NSLog(@"unsupported filter %d for predictor %d",filter,predictor);
|
||||
}
|
||||
|
||||
[mutable appendBytes:change length:rowLength-1];
|
||||
bytes+=rowLength;
|
||||
length-=rowLength;
|
||||
}
|
||||
if(length>1)
|
||||
[mutable appendBytes:bytes length:length-1];
|
||||
data=mutable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
NSLog(@"Unknown KGPDFFilter name = %s",name);
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -55,14 +55,14 @@ void KGPDF_render_b_star(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
|
||||
[context closePath];
|
||||
[context eoFillAndStrokePath];
|
||||
[context evenOddFillAndStrokePath];
|
||||
}
|
||||
|
||||
// eofill, stroke
|
||||
void KGPDF_render_B_star(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
|
||||
[context eoFillAndStrokePath];
|
||||
[context evenOddFillAndStrokePath];
|
||||
}
|
||||
|
||||
// Begin marked-content sequence with property list
|
||||
@ -113,23 +113,23 @@ void KGPDF_render_c(KGPDFScanner *scanner,void *info) {
|
||||
|
||||
// concat, Concatenate matrix to current transformation matrix
|
||||
void KGPDF_render_cm(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
KGPDFReal a,b,c,d,tx,ty;
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
CGAffineTransform matrix;
|
||||
|
||||
if(![scanner popNumber:&ty])
|
||||
if(![scanner popNumber:&matrix.ty])
|
||||
return;
|
||||
if(![scanner popNumber:&tx])
|
||||
if(![scanner popNumber:&matrix.tx])
|
||||
return;
|
||||
if(![scanner popNumber:&d])
|
||||
if(![scanner popNumber:&matrix.d])
|
||||
return;
|
||||
if(![scanner popNumber:&c])
|
||||
if(![scanner popNumber:&matrix.c])
|
||||
return;
|
||||
if(![scanner popNumber:&b])
|
||||
if(![scanner popNumber:&matrix.b])
|
||||
return;
|
||||
if(![scanner popNumber:&a])
|
||||
if(![scanner popNumber:&matrix.a])
|
||||
return;
|
||||
|
||||
[context concatCTM:a:b:c:d:tx:ty];
|
||||
[context concatCTM:matrix];
|
||||
}
|
||||
|
||||
KGColorSpace *colorSpaceFromScannerInfo(KGPDFScanner *scanner,void *info,const char *name) {
|
||||
@ -453,7 +453,7 @@ void KGPDF_render_Do(KGPDFScanner *scanner,void *info) {
|
||||
|
||||
if((resource=[content resourceForCategory:"XObject" name:name])==nil)
|
||||
return;
|
||||
NSLog(@"name=%s",name);
|
||||
// NSLog(@"name=%s",name);
|
||||
|
||||
if(![resource checkForType:kKGPDFObjectTypeStream value:&stream])
|
||||
return;
|
||||
@ -500,8 +500,8 @@ if(doIt)
|
||||
KGImage *image=imageFromStream(stream);
|
||||
|
||||
if(image!=NULL)
|
||||
[context drawImage:image inRect:0:0:1:1];
|
||||
|
||||
[context drawImage:image inRect:CGRectMake(0,0,1,1)];
|
||||
|
||||
if(image!=NULL)
|
||||
[image release];
|
||||
}
|
||||
@ -556,7 +556,7 @@ void KGPDF_render_F(KGPDFScanner *scanner,void *info) {
|
||||
void KGPDF_render_f_star(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
|
||||
[context eoFillPath];
|
||||
[context evenOddFillPath];
|
||||
}
|
||||
|
||||
// setgray, set gray level for stroking operations
|
||||
@ -631,6 +631,44 @@ void KGPDF_render_gs(KGPDFScanner *scanner,void *info) {
|
||||
}
|
||||
if([graphicsState getDictionaryForKey:"BG" value:&dictionary]){ // functions are streams too
|
||||
}
|
||||
|
||||
if([graphicsState getNameForKey:"BM" value:&name]){
|
||||
if(strcmp(name,"Normal")==0)
|
||||
[context setBlendMode:KGBlendModeNormal];
|
||||
else if(strcmp(name,"Multiply")==0)
|
||||
[context setBlendMode:KGBlendModeMultiply];
|
||||
else if(strcmp(name,"Screen")==0)
|
||||
[context setBlendMode:KGBlendModeScreen];
|
||||
else if(strcmp(name,"Overlay")==0)
|
||||
[context setBlendMode:KGBlendModeOverlay];
|
||||
else if(strcmp(name,"Darken")==0)
|
||||
[context setBlendMode:KGBlendModeDarken];
|
||||
else if(strcmp(name,"Lighten")==0)
|
||||
[context setBlendMode:KGBlendModeLighten];
|
||||
else if(strcmp(name,"ColorDodge")==0)
|
||||
[context setBlendMode:KGBlendModeColorDodge];
|
||||
else if(strcmp(name,"ColorBurn")==0)
|
||||
[context setBlendMode:KGBlendModeColorBurn];
|
||||
else if(strcmp(name,"HardLight")==0)
|
||||
[context setBlendMode:KGBlendModeHardLight];
|
||||
else if(strcmp(name,"SoftLight")==0)
|
||||
[context setBlendMode:KGBlendModeSoftLight];
|
||||
else if(strcmp(name,"Difference")==0)
|
||||
[context setBlendMode:KGBlendModeDifference];
|
||||
else if(strcmp(name,"Exclusion")==0)
|
||||
[context setBlendMode:KGBlendModeExclusion];
|
||||
else if(strcmp(name,"Hue")==0)
|
||||
[context setBlendMode:KGBlendModeHue];
|
||||
else if(strcmp(name,"Saturation")==0)
|
||||
[context setBlendMode:KGBlendModeSaturation];
|
||||
else if(strcmp(name,"Color")==0)
|
||||
[context setBlendMode:KGBlendModeColor];
|
||||
else if(strcmp(name,"Luminosity")==0)
|
||||
[context setBlendMode:KGBlendModeLuminosity];
|
||||
else
|
||||
NSLog(@"Unknown blend mode %s",name);
|
||||
}
|
||||
|
||||
if([graphicsState getNumberForKey:"FL" value:&number]){
|
||||
}
|
||||
if([graphicsState getNumberForKey:"SM" value:&number]){
|
||||
@ -789,18 +827,18 @@ void KGPDF_render_Q(KGPDFScanner *scanner,void *info) {
|
||||
// Append rectangle to path
|
||||
void KGPDF_render_re(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
float x,y,width,height;
|
||||
NSRect rect;
|
||||
|
||||
if(![scanner popNumber:&height])
|
||||
if(![scanner popNumber:&rect.size.height])
|
||||
return;
|
||||
if(![scanner popNumber:&width])
|
||||
if(![scanner popNumber:&rect.size.width])
|
||||
return;
|
||||
if(![scanner popNumber:&y])
|
||||
if(![scanner popNumber:&rect.origin.y])
|
||||
return;
|
||||
if(![scanner popNumber:&x])
|
||||
if(![scanner popNumber:&rect.origin.x])
|
||||
return;
|
||||
|
||||
[context addRect:x:y:width:height];
|
||||
[context addRect:rect];
|
||||
}
|
||||
|
||||
// setrgbcolor, Set RGB color for stroking operations
|
||||
@ -1203,7 +1241,7 @@ void KGPDF_render_TD(KGPDFScanner *scanner,void *info) {
|
||||
if(![scanner popNumber:&x])
|
||||
return;
|
||||
|
||||
[context setTextLeading:x:-y];
|
||||
[context setTextLeading:-y];
|
||||
[context setTextPosition:x:y];
|
||||
}
|
||||
|
||||
@ -1235,7 +1273,7 @@ void KGPDF_render_Tf(KGPDFScanner *scanner,void *info) {
|
||||
if(![dictionary getNameForKey:"Subtype" value:&subtype])
|
||||
return;
|
||||
|
||||
[context setTextMatrixIdentity];
|
||||
[context setTextMatrix:CGAffineTransformIdentity];
|
||||
|
||||
if(strcmp(subtype,"Type0")==0){
|
||||
}
|
||||
@ -1245,7 +1283,7 @@ void KGPDF_render_Tf(KGPDFScanner *scanner,void *info) {
|
||||
if(![dictionary getNameForKey:"BaseFont" value:&baseFont])
|
||||
return;
|
||||
|
||||
[context selectFont:baseFont scale:scale encoding:0];
|
||||
[context selectFontWithName:baseFont size:scale encoding:0];
|
||||
}
|
||||
else if(strcmp(subtype,"MMType1")==0){
|
||||
}
|
||||
@ -1308,23 +1346,23 @@ void KGPDF_render_TL(KGPDFScanner *scanner,void *info) {
|
||||
|
||||
// Set text matrix and text line matrix
|
||||
void KGPDF_render_Tm(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
KGPDFReal a,b,c,d,tx,ty;
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
CGAffineTransform matrix;
|
||||
|
||||
if(![scanner popNumber:&ty])
|
||||
if(![scanner popNumber:&matrix.ty])
|
||||
return;
|
||||
if(![scanner popNumber:&tx])
|
||||
if(![scanner popNumber:&matrix.tx])
|
||||
return;
|
||||
if(![scanner popNumber:&d])
|
||||
if(![scanner popNumber:&matrix.d])
|
||||
return;
|
||||
if(![scanner popNumber:&c])
|
||||
if(![scanner popNumber:&matrix.c])
|
||||
return;
|
||||
if(![scanner popNumber:&b])
|
||||
if(![scanner popNumber:&matrix.b])
|
||||
return;
|
||||
if(![scanner popNumber:&a])
|
||||
if(![scanner popNumber:&matrix.a])
|
||||
return;
|
||||
|
||||
[context setTextMatrix:a:b:c:d:tx:ty];
|
||||
[context setTextMatrix:matrix];
|
||||
}
|
||||
|
||||
// Set text rendering mode
|
||||
@ -1393,7 +1431,7 @@ void KGPDF_render_W(KGPDFScanner *scanner,void *info) {
|
||||
void KGPDF_render_W_star(KGPDFScanner *scanner,void *info) {
|
||||
KGContext *context=kgContextFromInfo(info);
|
||||
|
||||
[context eoClipToPath];
|
||||
[context evenOddClipToPath];
|
||||
}
|
||||
|
||||
// curveto, Append curved segment to path, final point replicated
|
||||
|
@ -8,6 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
|
||||
@class KGPDFDocument,KGPDFDictionary,KGContext;
|
||||
|
||||
@ -34,6 +35,10 @@ typedef enum {
|
||||
|
||||
-(KGPDFDictionary *)dictionary;
|
||||
|
||||
-(int)rotationAngle;
|
||||
|
||||
-(CGAffineTransform)drawingTransformForBox:(KGPDFBox)box inRect:(NSRect)rect rotate:(int)degrees preserveAspectRatio:(BOOL)preserveAspectRatio;
|
||||
|
||||
-(void)drawInContext:(KGContext *)context;
|
||||
|
||||
@end
|
||||
|
@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import "KGPDFScanner.h"
|
||||
#import "KGPDFDocument.h"
|
||||
#import "KGPDFDictionary.h"
|
||||
#import "KGPDFArray.h"
|
||||
|
||||
@implementation KGPDFPage
|
||||
|
||||
@ -45,11 +46,90 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return _dictionary;
|
||||
}
|
||||
|
||||
BOOL KGPDFGetPageObjectForKey(KGPDFPage *page,const char *key,KGPDFObject **object){
|
||||
KGPDFDictionary *dictionary=[page dictionary];
|
||||
|
||||
do{
|
||||
KGPDFObject *check;
|
||||
|
||||
if([dictionary getObjectForKey:key value:&check]){
|
||||
*object=check;
|
||||
return YES;
|
||||
}
|
||||
|
||||
}while([dictionary getDictionaryForKey:"Parent" value:&dictionary]);
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL KGPDFGetPageArrayForKey(KGPDFPage *page,const char *key,KGPDFArray **arrayp){
|
||||
KGPDFObject *check;
|
||||
|
||||
if(!KGPDFGetPageObjectForKey(page,key,&check))
|
||||
return NO;
|
||||
|
||||
return [check checkForType:kKGPDFObjectTypeArray value:arrayp];
|
||||
}
|
||||
|
||||
-(BOOL)getRect:(NSRect *)rect forBox:(KGPDFBox)box {
|
||||
const char *string=NULL;
|
||||
KGPDFArray *array;
|
||||
KGPDFReal *numbers;
|
||||
unsigned count;
|
||||
|
||||
switch(box){
|
||||
case kKGPDFMediaBox: string="MediaBox"; break;
|
||||
case kKGPDFCropBox: string="CropBox"; break;
|
||||
case kKGPDFBleedBox: string="BleedBox"; break;
|
||||
case kKGPDFTrimBox: string="TrimBox"; break;
|
||||
case kKGPDFArtBox: string="ArtBox"; break;
|
||||
}
|
||||
|
||||
if(string==NULL)
|
||||
return NO;
|
||||
if(!KGPDFGetPageArrayForKey(self,string,&array))
|
||||
return NO;
|
||||
|
||||
if(![array getNumbers:&numbers count:&count])
|
||||
return NO;
|
||||
|
||||
if(count==4){
|
||||
NSZoneFree(NULL,numbers);
|
||||
return NO;
|
||||
}
|
||||
|
||||
rect->origin.x=numbers[0];
|
||||
rect->origin.y=numbers[1];
|
||||
rect->size.width=numbers[2];
|
||||
rect->size.height=numbers[3];
|
||||
|
||||
NSZoneFree(NULL,numbers);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(int)rotationAngle {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
-(CGAffineTransform)drawingTransformForBox:(KGPDFBox)box inRect:(NSRect)rect rotate:(int)degrees preserveAspectRatio:(BOOL)preserveAspectRatio {
|
||||
CGAffineTransform result=CGAffineTransformIdentity;
|
||||
NSRect boxRect;
|
||||
|
||||
if([self getRect:&boxRect forBox:box]){
|
||||
result=CGAffineTransformTranslate(result,-boxRect.origin.x,-boxRect.origin.y);
|
||||
result=CGAffineTransformScale(result,rect.size.width/boxRect.size.width,rect.size.height/boxRect.size.height);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
-(void)drawInContext:(KGContext *)context {
|
||||
KGPDFContentStream *contentStream=[[[KGPDFContentStream alloc] initWithPage:self] autorelease];
|
||||
KGPDFOperatorTable *operatorTable=[KGPDFOperatorTable renderingOperatorTable];
|
||||
KGPDFScanner *scanner=[[[KGPDFScanner alloc] initWithContentStream:contentStream operatorTable:operatorTable info:context] autorelease];
|
||||
|
||||
|
||||
[scanner scan];
|
||||
}
|
||||
|
||||
|
@ -1077,11 +1077,11 @@ BOOL KGPDFParseIndirectObject(NSData *data,KGPDFInteger position,KGPDFObject **o
|
||||
|
||||
if(![object checkForType:kKGPDFObjectTypeStream value:&scan])
|
||||
return NO;
|
||||
|
||||
|
||||
if(![self scanStream:scan])
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
55
AppKit/CoreGraphics.subproj/KGPath.h
Normal file
55
AppKit/CoreGraphics.subproj/KGPath.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
|
||||
enum {
|
||||
KGPathFill,
|
||||
KGPathEOFill,
|
||||
KGPathStroke,
|
||||
KGPathFillStroke,
|
||||
KGPathEOFillStroke
|
||||
};
|
||||
|
||||
enum {
|
||||
KGPathOperatorMoveToPoint,
|
||||
KGPathOperatorLineToPoint,
|
||||
KGPathOperatorCurveToPoint,
|
||||
KGPathOperatorQuadCurveToPoint,
|
||||
KGPathOperatorCloseSubpath
|
||||
};
|
||||
|
||||
@interface KGPath : NSObject <NSCopying,NSMutableCopying> {
|
||||
unsigned _numberOfOperators;
|
||||
unsigned char *_operators;
|
||||
unsigned _numberOfPoints;
|
||||
NSPoint *_points;
|
||||
}
|
||||
|
||||
-initWithOperators:(unsigned char *)operators numberOfOperators:(unsigned)numberOfOperators points:(NSPoint *)points numberOfPoints:(unsigned)numberOfPoints;
|
||||
|
||||
-(unsigned)numberOfOperators;
|
||||
-(const unsigned char *)operators;
|
||||
|
||||
-(unsigned)numberOfPoints;
|
||||
-(const NSPoint *)points;
|
||||
|
||||
-(NSPoint)currentPoint;
|
||||
|
||||
-(BOOL)isEqualToPath:(KGPath *)other;
|
||||
|
||||
-(BOOL)isEmpty;
|
||||
-(BOOL)isRect;
|
||||
|
||||
-(BOOL)containsPoint:(NSPoint)point evenOdd:(BOOL)evenOdd withTransform:(CGAffineTransform *)matrix;
|
||||
|
||||
-(NSRect)boundingBox;
|
||||
|
||||
@end
|
117
AppKit/CoreGraphics.subproj/KGPath.m
Normal file
117
AppKit/CoreGraphics.subproj/KGPath.m
Normal file
@ -0,0 +1,117 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGPath.h"
|
||||
#import "KGMutablePath.h"
|
||||
#import <Foundation/NSRaise.h>
|
||||
|
||||
@implementation KGPath
|
||||
|
||||
-initWithOperators:(unsigned char *)operators numberOfOperators:(unsigned)numberOfOperators points:(NSPoint *)points numberOfPoints:(unsigned)numberOfPoints {
|
||||
int i;
|
||||
|
||||
_numberOfOperators=numberOfOperators;
|
||||
_operators=NSZoneMalloc(NULL,(_numberOfOperators==0)?1:_numberOfOperators);
|
||||
for(i=0;i<numberOfOperators;i++)
|
||||
_operators[i]=operators[i];
|
||||
|
||||
_numberOfPoints=numberOfPoints;
|
||||
_points=NSZoneMalloc(NULL,(_numberOfPoints==0?1:_numberOfPoints)*sizeof(NSPoint));
|
||||
for(i=0;i<numberOfPoints;i++)
|
||||
_points[i]=points[i];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-init {
|
||||
return [self initWithOperators:NULL numberOfOperators:0 points:NULL numberOfPoints:0];
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
NSZoneFree(NULL,_operators);
|
||||
NSZoneFree(NULL,_points);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-copyWithZone:(NSZone *)zone {
|
||||
return [self retain];
|
||||
}
|
||||
|
||||
-mutableCopyWithZone:(NSZone *)zone {
|
||||
return [[KGMutablePath allocWithZone:zone] initWithOperators:_operators numberOfOperators:_numberOfOperators points:_points numberOfPoints:_numberOfPoints];
|
||||
}
|
||||
|
||||
-(unsigned)numberOfOperators {
|
||||
return _numberOfOperators;
|
||||
}
|
||||
|
||||
-(const unsigned char *)operators {
|
||||
return _operators;
|
||||
}
|
||||
|
||||
-(unsigned)numberOfPoints {
|
||||
return _numberOfPoints;
|
||||
}
|
||||
|
||||
-(const NSPoint *)points {
|
||||
return _points;
|
||||
}
|
||||
|
||||
-(NSPoint)currentPoint {
|
||||
// this is wrong w/ closepath last
|
||||
return (_numberOfPoints==0)?NSZeroPoint:_points[_numberOfPoints-1];
|
||||
}
|
||||
|
||||
-(BOOL)isEqualToPath:(KGPath *)other {
|
||||
unsigned otherNumberOfOperators=[other numberOfOperators];
|
||||
|
||||
if(_numberOfOperators==otherNumberOfOperators){
|
||||
unsigned otherNumberOfPoints=[other numberOfPoints];
|
||||
|
||||
if(_numberOfPoints==otherNumberOfPoints){
|
||||
const unsigned char *otherOperators=[other operators];
|
||||
const NSPoint *otherPoints;
|
||||
int i;
|
||||
|
||||
for(i=0;i<_numberOfOperators;i++)
|
||||
if(_operators[i]!=otherOperators[i])
|
||||
return NO;
|
||||
|
||||
otherPoints=[other points];
|
||||
for(i=0;i<_numberOfPoints;i++)
|
||||
if(!NSEqualPoints(_points[i],otherPoints[i]))
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL)isEmpty {
|
||||
return _numberOfOperators==0;
|
||||
}
|
||||
|
||||
-(BOOL)isRect {
|
||||
NSUnimplementedMethod();
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL)containsPoint:(NSPoint)point evenOdd:(BOOL)evenOdd withTransform:(CGAffineTransform *)matrix {
|
||||
NSUnimplementedMethod();
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(NSRect)boundingBox {
|
||||
NSUnimplementedMethod();
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
@end
|
15
AppKit/CoreGraphics.subproj/KGPattern.h
Normal file
15
AppKit/CoreGraphics.subproj/KGPattern.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@interface KGPattern : NSObject {
|
||||
|
||||
}
|
||||
|
||||
@end
|
14
AppKit/Win32.subproj/Win32Brush.h → AppKit/CoreGraphics.subproj/KGPattern.m
Executable file → Normal file
14
AppKit/Win32.subproj/Win32Brush.h → AppKit/CoreGraphics.subproj/KGPattern.m
Executable file → Normal file
@ -6,17 +6,9 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <windows.h>
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import "KGPattern.h"
|
||||
|
||||
// Don't use autorelease, this is a limited resource in the GDI
|
||||
|
||||
@interface Win32Brush : NSObject {
|
||||
HBRUSH _handle;
|
||||
}
|
||||
|
||||
-initWithCOLORREF:(COLORREF)colorRef;
|
||||
|
||||
-(HBRUSH)brushHandle;
|
||||
@implementation KGPattern
|
||||
|
||||
@end
|
48
AppKit/CoreGraphics.subproj/KGRenderingContext.h
Executable file
48
AppKit/CoreGraphics.subproj/KGRenderingContext.h
Executable file
@ -0,0 +1,48 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/CGAffineTransform.h>
|
||||
#import <AppKit/CGFont.h>
|
||||
|
||||
@class KGContext,KGColor,KGPath,KGImage;
|
||||
|
||||
@interface KGRenderingContext : NSObject
|
||||
|
||||
-(NSSize)size;
|
||||
|
||||
-(KGContext *)graphicsContextWithSize:(NSSize)size;
|
||||
|
||||
-(void)beginPage;
|
||||
-(void)endPage;
|
||||
-(void)beginDocument;
|
||||
-(void)endDocument;
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley;
|
||||
|
||||
-(void)selectFontWithName:(const char *)name pointSize:(float)pointSize antialias:(BOOL)antialias;
|
||||
|
||||
-(id)saveCopyOfDeviceState;
|
||||
-(void)restoreDeviceState:(id)state;
|
||||
|
||||
-(void)clipInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rect count:(unsigned)count;
|
||||
|
||||
-(void)fillInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rects count:(unsigned)count color:(KGColor *)color;
|
||||
|
||||
-(void)strokeInUserSpace:(CGAffineTransform)ctm rect:(NSRect)rect width:(float)width color:(KGColor *)color;
|
||||
|
||||
-(void)copyBitsInUserSpace:(CGAffineTransform)ctm rect:(NSRect)rect toPoint:(NSPoint)point;
|
||||
|
||||
-(void)showInUserSpace:(CGAffineTransform)ctm text:(const char *)text count:(unsigned)count atPoint:(float)x:(float)y color:(KGColor *)color;
|
||||
-(void)showInUserSpace:(CGAffineTransform)ctm glyphs:(const CGGlyph *)glyphs count:(unsigned)count atPoint:(float)x:(float)y color:(KGColor *)color;
|
||||
|
||||
-(void)drawPathInDeviceSpace:(KGPath *)path drawingMode:(int)mode ctm:(CGAffineTransform)ctm lineWidth:(float)lineWidth fillColor:(KGColor *)fillColor strokeColor:(KGColor *)strokeColor;
|
||||
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect ctm:(CGAffineTransform)ctm fraction:(float)fraction;
|
||||
|
||||
@end
|
87
AppKit/CoreGraphics.subproj/KGRenderingContext.m
Executable file
87
AppKit/CoreGraphics.subproj/KGRenderingContext.m
Executable file
@ -0,0 +1,87 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/KGRenderingContext.h>
|
||||
|
||||
@implementation KGRenderingContext
|
||||
|
||||
-(NSSize)size {
|
||||
return NSZeroSize;
|
||||
}
|
||||
|
||||
-(KGContext *)graphicsContextWithSize:(NSSize)size {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)beginPage {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)endPage {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)beginDocument {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)endDocument {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)scalePage:(float)scalex:(float)scaley {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)selectFontWithName:(const char *)name pointSize:(float)pointSize antialias:(BOOL)antialias {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(id)saveCopyOfDeviceState {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)restoreDeviceState:(id)state {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)clipInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rect count:(unsigned)count {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)fillInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rects count:(unsigned)count color:(KGColor *)color {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)strokeInUserSpace:(CGAffineTransform)ctm rect:(NSRect)rect width:(float)width color:(KGColor *)color {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)copyBitsInUserSpace:(CGAffineTransform)ctm rect:(NSRect)rect toPoint:(NSPoint)point {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)showInUserSpace:(CGAffineTransform)ctm text:(const char *)text count:(unsigned)count atPoint:(float)x:(float)y color:(KGColor *)color {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)showInUserSpace:(CGAffineTransform)ctm glyphs:(const CGGlyph *)glyphs count:(unsigned)count atPoint:(float)x:(float)y color:(KGColor *)color {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)drawPathInDeviceSpace:(KGPath *)path drawingMode:(int)mode ctm:(CGAffineTransform)ctm lineWidth:(float)lineWidth fillColor:(KGColor *)fillColor strokeColor:(KGColor *)strokeColor {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect ctm:(CGAffineTransform)ctm fraction:(float)fraction {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
@end
|
15
AppKit/ImageIO/KGImageSource.h
Normal file
15
AppKit/ImageIO/KGImageSource.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@interface KGImageSource : NSObject {
|
||||
|
||||
}
|
||||
|
||||
@end
|
13
AppKit/ImageIO/KGImageSource.m
Normal file
13
AppKit/ImageIO/KGImageSource.m
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource.h"
|
||||
|
||||
@implementation KGImageSource
|
||||
|
||||
@end
|
15
AppKit/ImageIO/KGImageSource_JPEG.h
Normal file
15
AppKit/ImageIO/KGImageSource_JPEG.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource.h"
|
||||
|
||||
@interface KGImageSource_JPEG : KGImageSource {
|
||||
|
||||
}
|
||||
|
||||
@end
|
14
AppKit/ImageIO/KGImageSource_JPEG.m
Normal file
14
AppKit/ImageIO/KGImageSource_JPEG.m
Normal file
@ -0,0 +1,14 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource_JPEG.h"
|
||||
|
||||
|
||||
@implementation KGImageSource_JPEG
|
||||
|
||||
@end
|
15
AppKit/ImageIO/KGImageSource_PNG.h
Normal file
15
AppKit/ImageIO/KGImageSource_PNG.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource.h"
|
||||
|
||||
@interface KGImageSource_PNG : KGImageSource {
|
||||
|
||||
}
|
||||
|
||||
@end
|
14
AppKit/ImageIO/KGImageSource_PNG.m
Normal file
14
AppKit/ImageIO/KGImageSource_PNG.m
Normal file
@ -0,0 +1,14 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource_PNG.h"
|
||||
|
||||
|
||||
@implementation KGImageSource_PNG
|
||||
|
||||
@end
|
15
AppKit/ImageIO/KGImageSource_TIFF.h
Normal file
15
AppKit/ImageIO/KGImageSource_TIFF.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource.h"
|
||||
|
||||
@interface KGImageSource_TIFF : KGImageSource {
|
||||
|
||||
}
|
||||
|
||||
@end
|
14
AppKit/ImageIO/KGImageSource_TIFF.m
Normal file
14
AppKit/ImageIO/KGImageSource_TIFF.m
Normal file
@ -0,0 +1,14 @@
|
||||
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KGImageSource_TIFF.h"
|
||||
|
||||
|
||||
@implementation KGImageSource_TIFF
|
||||
|
||||
@end
|
@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@interface NSBitmapImageRep : NSImageRep {
|
||||
unsigned _bitsPerPixel;
|
||||
unsigned _bytesPerRow;
|
||||
unsigned char *_bitmap;
|
||||
NSData *_bitmap;
|
||||
}
|
||||
|
||||
-initWithData:(NSData *)data;
|
||||
|
@ -10,25 +10,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSGraphicsContextFunctions.h>
|
||||
#import <AppKit/NSView.h>
|
||||
#import <AppKit/CoreGraphics.h>
|
||||
#import <AppKit/CGColorSpace.h>
|
||||
#import <AppKit/NSTIFFReader.h>
|
||||
|
||||
@implementation NSBitmapImageRep
|
||||
|
||||
-initWithData:(NSData *)data {
|
||||
NSTIFFReader *reader=[[NSTIFFReader alloc] initWithData:data];
|
||||
int width=[reader pixelsWide];
|
||||
int height=[reader pixelsHigh];
|
||||
int npixels=width*height;
|
||||
|
||||
NSTIFFReader *reader=[[NSTIFFReader alloc] initWithData:data];
|
||||
int width=[reader pixelsWide];
|
||||
int height=[reader pixelsHigh];
|
||||
int npixels=width*height;
|
||||
unsigned char *bytes;
|
||||
|
||||
if(reader==nil){
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
|
||||
npixels=width*height;
|
||||
_bitmap=NSZoneMalloc([self zone],(npixels*4*sizeof(unsigned char)));
|
||||
if(![reader getRGBAImageBytes:_bitmap width:width height:height]){
|
||||
bytes=NSZoneMalloc([self zone],(npixels*4*sizeof(unsigned char)));
|
||||
if(![reader getRGBAImageBytes:bytes width:width height:height]){
|
||||
[reader release];
|
||||
NSZoneFree([self zone],bytes);
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
@ -39,6 +42,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
_bitsPerPixel=32;
|
||||
_bytesPerRow=_bitsPerPixel/sizeof(char)*width;
|
||||
|
||||
_bitmap=[[NSData alloc] initWithBytesNoCopy:bytes length:_bytesPerRow*_size.height];
|
||||
|
||||
[reader release];
|
||||
|
||||
return self;
|
||||
@ -56,10 +61,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
if(_bitmap!=NULL){
|
||||
NSZoneFree([self zone],_bitmap);
|
||||
_bitmap=NULL;
|
||||
}
|
||||
[_bitmap release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@ -68,9 +70,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)compositeToPoint:(NSPoint)point operation:(NSCompositingOperation)operation fraction:(float)fraction {
|
||||
CGContextSourceOverRGBAImage(NSCurrentGraphicsPort(),
|
||||
NSMakeRect(point.x,point.y,_size.width,_size.height),
|
||||
_size.width,_size.height,(void *)_bitmap,fraction);
|
||||
CGContextRef context=NSCurrentGraphicsPort();
|
||||
CGDataProviderRef provider=CGDataProviderCreateWithCFData(_bitmap);
|
||||
CGColorSpaceRef colorSpace=CGColorSpaceCreateDeviceRGB();
|
||||
CGImageRef image=CGImageCreate(_size.width,_size.height,8,_bitsPerPixel,_bytesPerRow,
|
||||
colorSpace,0/*kCGImageAlphaLast|kCGBitmapByteOrder32Little*/,provider,NULL,NO,kCGRenderingIntentDefault);
|
||||
|
||||
CGContextSaveGState(context);
|
||||
CGContextSetAlpha(context,fraction);
|
||||
CGContextDrawImage(context,NSMakeRect(point.x,point.y,_size.width,_size.height),image);
|
||||
CGContextRestoreGState(context);
|
||||
|
||||
CGImageRelease(image);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
CGDataProviderRelease(provider);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -8,14 +8,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <AppKit/NSImageRep.h>
|
||||
|
||||
@class CGRenderingContext;
|
||||
@class KGContext;
|
||||
@class KGRenderingContext;
|
||||
|
||||
@interface NSCachedImageRep : NSImageRep {
|
||||
CGRenderingContext *_renderingContext;
|
||||
KGRenderingContext *_renderingContext;
|
||||
}
|
||||
|
||||
-initWithSize:(NSSize)size;
|
||||
|
||||
-(CGRenderingContext *)renderingContext;
|
||||
-(KGContext *)graphicsContext;
|
||||
|
||||
@end
|
||||
|
@ -8,15 +8,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/NSCachedImageRep.h>
|
||||
#import <AppKit/CGRenderingContext.h>
|
||||
#import <AppKit/NSGraphicsContextFunctions.h>
|
||||
#import <AppKit/NSDisplay.h>
|
||||
#import <AppKit/Win32DeviceContextBitmap.h>
|
||||
#import <AppKit/KGImage_context.h>
|
||||
|
||||
@implementation NSCachedImageRep
|
||||
|
||||
-initWithSize:(NSSize)size {
|
||||
_size=size;
|
||||
_renderingContext=[[[NSDisplay currentDisplay] bitmapRenderingContextWithSize:size] retain];
|
||||
_renderingContext=[[Win32DeviceContextBitmap alloc] initWithSize:size];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -25,12 +26,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(CGRenderingContext *)renderingContext {
|
||||
return _renderingContext;
|
||||
-(KGContext *)graphicsContext {
|
||||
return [_renderingContext graphicsContextWithSize:[self size]];
|
||||
}
|
||||
|
||||
-(BOOL)drawAtPoint:(NSPoint)point {
|
||||
CGContextBitCopy(NSCurrentGraphicsPort(),point,_renderingContext,NSMakePoint(0,0),_size);
|
||||
KGImage *image=[[KGImage_context alloc] initWithRenderingContext:_renderingContext];
|
||||
NSRect rect={point,_size};
|
||||
|
||||
CGContextDrawImage(NSCurrentGraphicsPort(),rect,image);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Original - Christopher Lloyd <cjwl@objc.net>
|
||||
// Original - David Young <daver@geeks.org>, Christopher Lloyd <cjwl@objc.net>
|
||||
#import <AppKit/NSColor_cmykDevice.h>
|
||||
#import <AppKit/NSGraphics.h>
|
||||
#import <AppKit/NSGraphicsContextFunctions.h>
|
||||
@ -74,7 +74,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return _alpha;
|
||||
}
|
||||
|
||||
// ahh, subtractive color space.
|
||||
-(NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace device:(NSDictionary *)device {
|
||||
if([colorSpace isEqualToString:[self colorSpaceName]])
|
||||
return self;
|
||||
@ -99,12 +98,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
// temporary fix
|
||||
NSColor *convertedColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
|
||||
|
||||
CGContextSetCalibratedRGBColor(NSCurrentGraphicsPort(),
|
||||
CGContextSetRGBStrokeColor(NSCurrentGraphicsPort(),
|
||||
[convertedColor redComponent],
|
||||
[convertedColor greenComponent],
|
||||
[convertedColor blueComponent], _alpha);
|
||||
CGContextSetRGBFillColor(NSCurrentGraphicsPort(),
|
||||
[convertedColor redComponent],
|
||||
[convertedColor greenComponent],
|
||||
[convertedColor blueComponent], _alpha);
|
||||
|
||||
// CGContextSetDeviceCMYKColor(NSCurrentGraphicsPort(),_cyan,_magenta,_yellow,_black,_alpha);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -109,7 +109,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)set {
|
||||
CGContextSetDeviceRGBColor(NSCurrentGraphicsPort(),_red,_green,_blue,_alpha);
|
||||
CGContextSetRGBStrokeColor(NSCurrentGraphicsPort(),_red,_green,_blue,_alpha);
|
||||
CGContextSetRGBFillColor(NSCurrentGraphicsPort(),_red,_green,_blue,_alpha);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -64,7 +64,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)set {
|
||||
CGContextSetDeviceGrayColor(NSCurrentGraphicsPort(),_white,_alpha);
|
||||
CGContextSetGrayStrokeColor(NSCurrentGraphicsPort(),_white,_alpha);
|
||||
CGContextSetGrayFillColor(NSCurrentGraphicsPort(),_white,_alpha);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -9,7 +9,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/NSFont.h>
|
||||
|
||||
@class NSEvent,NSColor, NSPasteboard,NSDraggingManager,NSPrintInfo, CGContext, NSView, NSSavePanel, NSOpenPanel, CGWindow;
|
||||
@class NSEvent,NSColor, NSPasteboard,NSDraggingManager,NSPrintInfo, KGContext, NSView, NSSavePanel, NSOpenPanel, CGWindow;
|
||||
|
||||
typedef struct NSGlyphRange {
|
||||
NSGlyph glyphs[256];
|
||||
@ -73,8 +73,6 @@ typedef struct NSFontMetrics {
|
||||
-(CGWindow *)windowWithFrame:(NSRect)frame styleMask:(unsigned)styleMask backingType:(unsigned)backingType;
|
||||
-(CGWindow *)panelWithFrame:(NSRect)frame styleMask:(unsigned)styleMask backingType:(unsigned)backingType;
|
||||
|
||||
-(CGRenderingContext *)bitmapRenderingContextWithSize:(NSSize)size;
|
||||
|
||||
-(NSColor *)colorWithName:(NSString *)colorName;
|
||||
-(NSString *)menuFontNameAndSize:(float *)pointSize;
|
||||
|
||||
@ -112,7 +110,7 @@ typedef struct NSFontMetrics {
|
||||
|
||||
-(float)scrollerWidth;
|
||||
|
||||
-(void)metricsForFontWithName:(NSString *)name pointSize:(float)pointSize metrics:(NSFontMetrics *)metrics;
|
||||
-(void)metricsForFontWithName:(const char *)name pointSize:(float)pointSize metrics:(NSFontMetrics *)metrics;
|
||||
|
||||
-(void)loadGlyphRangeTable:(NSGlyphRangeTable *)table fontName:(NSString *)name range:(NSRange)range;
|
||||
|
||||
@ -121,7 +119,7 @@ typedef struct NSFontMetrics {
|
||||
|
||||
-(void)runModalWithPrintInfo:(NSPrintInfo *)printInfo;
|
||||
|
||||
-(CGContext *)graphicsPortForPrintOperationWithView:(NSView *)view printInfo:(NSPrintInfo *)printInfo pageRange:(NSRange)pageRange;
|
||||
-(KGContext *)graphicsPortForPrintOperationWithView:(NSView *)view printInfo:(NSPrintInfo *)printInfo pageRange:(NSRange)pageRange;
|
||||
|
||||
-(int)savePanel:(NSSavePanel *)savePanel runModalForDirectory:(NSString *)directory file:(NSString *)file;
|
||||
-(int)openPanel:(NSOpenPanel *)openPanel runModalForDirectory:(NSString *)directory file:(NSString *)file types:(NSArray *)types;
|
||||
|
@ -76,11 +76,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(CGRenderingContext *)bitmapRenderingContextWithSize:(NSSize)size {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSColor *)colorWithName:(NSString *)colorName {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
@ -289,7 +284,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(void)metricsForFontWithName:(NSString *)name pointSize:(float)pointSize metrics:(NSFontMetrics *)metrics {
|
||||
-(void)metricsForFontWithName:(const char *)name pointSize:(float)pointSize metrics:(NSFontMetrics *)metrics {
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
@ -309,7 +304,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
|
||||
-(CGContext *)graphicsPortForPrintOperationWithView:(NSView *)view printInfo:(NSPrintInfo *)printInfo pageRange:(NSRange)pageRange {
|
||||
-(KGContext *)graphicsPortForPrintOperationWithView:(NSView *)view printInfo:(NSPrintInfo *)printInfo pageRange:(NSRange)pageRange {
|
||||
NSInvalidAbstractInvocation();
|
||||
return nil;
|
||||
}
|
||||
|
@ -44,9 +44,11 @@ APPKIT_EXPORT NSString *NSDrawerDidCloseNotification;
|
||||
|
||||
+ (NSRectEdge)visibleEdgeWithPreferredEdge:(NSRectEdge)preferredEdge parentWindow:(NSWindow *)parentWindow drawerWindow:(NSWindow *)drawerWindow;
|
||||
|
||||
-initWithContentSize:(NSSize)contentSize preferredEdge:(NSRectEdge)edge;
|
||||
-(id)initWithCoder:(NSCoder *)coder;
|
||||
|
||||
-delegate;
|
||||
-(id)initWithContentSize:(NSSize)contentSize preferredEdge:(NSRectEdge)edge;
|
||||
|
||||
-(id)delegate;
|
||||
-(NSWindow *)parentWindow;
|
||||
-(NSView *)contentView;
|
||||
-(NSSize)contentSize;
|
||||
@ -77,10 +79,12 @@ APPKIT_EXPORT NSString *NSDrawerDidCloseNotification;
|
||||
-(void)toggle:sender;
|
||||
|
||||
-(void)parentWindowDidActivate:(NSWindow *)window;
|
||||
-(void)parentWindowDidDeactivate:(NSWindow *)window;
|
||||
-(void)parentWindowDidChangeFrame:(NSWindow *)window;
|
||||
-(void)parentWindowDidExitMove:(NSWindow *)window;
|
||||
-(void)parentWindowDidMiniaturize:(NSWindow *)window;
|
||||
-(void)parentWindowDidDeminiaturize:(NSWindow *)window;
|
||||
-(void)parentWindowDidClose:(NSWindow *)window;
|
||||
|
||||
-(void)drawerWindowDidActivate:(NSDrawerWindow *)window;
|
||||
-(NSSize)drawerWindow:(NSDrawerWindow *)window constrainSize:(NSSize)size edge:(NSRectEdge)edge;
|
||||
|
@ -12,6 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSWindow-Private.h>
|
||||
#import <AppKit/NSScreen.h>
|
||||
#import <AppKit/NSDrawerWindow.h>
|
||||
#import <AppKit/NSNibKeyedUnarchiver.h>
|
||||
|
||||
NSString *NSDrawerWillOpenNotification = @"NSDrawerWillOpenNotification";
|
||||
NSString *NSDrawerDidOpenNotification = @"NSDrawerDidOpenNotification";
|
||||
@ -113,25 +114,80 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
}
|
||||
}
|
||||
|
||||
- initWithContentSize:(NSSize)contentSize preferredEdge:(NSRectEdge)edge {
|
||||
_contentSize = contentSize;
|
||||
_drawerWindow = [[NSDrawerWindow alloc] initWithContentRect:NSMakeRect(0, 0, _contentSize.width, _contentSize.height) styleMask:NSDrawerWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||
- (id)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
|
||||
if (self && [coder isKindOfClass:[NSNibKeyedUnarchiver class]])
|
||||
{
|
||||
NSNibKeyedUnarchiver *keyed = (NSNibKeyedUnarchiver *)coder;
|
||||
|
||||
if([keyed containsValueForKey:@"NSContentSize"])
|
||||
_contentSize = [keyed decodeSizeForKey:@"NSContentSize"];
|
||||
else
|
||||
_contentSize = NSZeroSize;
|
||||
|
||||
_state = 0;
|
||||
_edge = 0;
|
||||
if([keyed containsValueForKey:@"NSPreferredEdge"])
|
||||
[self setPreferredEdge:[keyed decodeIntForKey:@"NSPreferredEdge"]];
|
||||
else
|
||||
_preferredEdge = 0;
|
||||
|
||||
if([keyed containsValueForKey:@"NSLeadingOffset"])
|
||||
[self setLeadingOffset:[keyed decodeFloatForKey:@"NSLeadingOffset"]];
|
||||
else
|
||||
_leadingOffset = 0;
|
||||
|
||||
if([keyed containsValueForKey:@"NSTrailingOffset"])
|
||||
[self setTrailingOffset:[keyed decodeFloatForKey:@"NSTrailingOffset"]];
|
||||
else
|
||||
_trailingOffset = 0;
|
||||
|
||||
_drawerWindow = [[[NSDrawerWindow alloc] initWithContentRect:NSMakeRect(0, 0, _contentSize.width, _contentSize.height) styleMask:NSDrawerWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
|
||||
[_drawerWindow setDrawer:self];
|
||||
[self setContentSize:_contentSize];
|
||||
|
||||
_parentWindow = _nextParentWindow = nil;
|
||||
if([keyed containsValueForKey:@"NSParentWindow"])
|
||||
[self setParentWindow:[keyed decodeObjectForKey:@"NSParentWindow"]];
|
||||
|
||||
if([keyed containsValueForKey:@"NSDelegate"])
|
||||
[self setDelegate:[keyed decodeObjectForKey:@"NSDelegate"]];
|
||||
else
|
||||
_delegate = nil;
|
||||
|
||||
if([keyed containsValueForKey:@"NSMinContentSize"])
|
||||
[self setMinContentSize:[keyed decodeSizeForKey:@"NSMinContentSize"]];
|
||||
else
|
||||
_minContentSize = NSZeroSize;
|
||||
|
||||
if([keyed containsValueForKey:@"NSMaxContentSize"])
|
||||
[self setMaxContentSize:[keyed decodeSizeForKey:@"NSMaxContentSize"]];
|
||||
else
|
||||
_maxContentSize = NSZeroSize;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (id)initWithContentSize:(NSSize)contentSize preferredEdge:(NSRectEdge)edge {
|
||||
_drawerWindow = [[NSDrawerWindow alloc] initWithContentRect:NSMakeRect(0, 0, contentSize.width, contentSize.height) styleMask:NSDrawerWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||
[_drawerWindow setDrawer:self];
|
||||
|
||||
[self setContentSize:contentSize]; // maybe not
|
||||
[self setContentSize:contentSize];
|
||||
[self setPreferredEdge:edge];
|
||||
_parentWindow = _nextParentWindow = nil;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_drawerWindow release];
|
||||
[_parentWindow release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- delegate {
|
||||
- (id)delegate {
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
@ -200,33 +256,38 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
}
|
||||
|
||||
- (void)setNextParentWindow {
|
||||
if (_nextParentWindow == (NSWindow *)-1)
|
||||
_nextParentWindow = nil;
|
||||
|
||||
[_parentWindow _detachDrawer:self];
|
||||
[_parentWindow release];
|
||||
_parentWindow = [_nextParentWindow retain];
|
||||
[_parentWindow _attachDrawer:self];
|
||||
|
||||
if ((_parentWindow = [_nextParentWindow retain]))
|
||||
[_parentWindow _attachDrawer:self];
|
||||
|
||||
_nextParentWindow = nil;
|
||||
}
|
||||
|
||||
- (void)setParentWindow:(NSWindow *)window {
|
||||
_nextParentWindow = window;
|
||||
|
||||
if (_state == NSDrawerClosedState)
|
||||
[self setNextParentWindow];
|
||||
if (window != _parentWindow)
|
||||
{
|
||||
_nextParentWindow = window;
|
||||
|
||||
if (_state == NSDrawerClosedState)
|
||||
[self setNextParentWindow];
|
||||
// otherwise postpone action until drawer is closed
|
||||
else if (_nextParentWindow == nil) // for the postponed action case make
|
||||
_nextParentWindow = (NSWindow *)-1; // _nextParentWindow != nil so that setNextParentWindow
|
||||
} // eventually becomes called later
|
||||
}
|
||||
|
||||
- (void)setContentView:(NSView *)view {
|
||||
NSArray *subviews = [[_drawerWindow contentView] subviews];
|
||||
|
||||
if ([subviews count] > 0)
|
||||
[[subviews objectAtIndex:0] removeFromSuperview];
|
||||
|
||||
if (view != nil)
|
||||
[[_drawerWindow contentView] addSubview:view];
|
||||
[_drawerWindow setContentView:view];
|
||||
}
|
||||
|
||||
- (void)setContentSize:(NSSize)size {
|
||||
[[self contentView] setFrameSize:size];
|
||||
[[self contentView] setFrameSize:size];
|
||||
_contentSize = size;
|
||||
}
|
||||
|
||||
- (void)setMinContentSize:(NSSize)size {
|
||||
@ -266,17 +327,17 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
|
||||
// if we've moved to a different edge, recompute...
|
||||
if (_edge != edge)
|
||||
_contentSize = [self drawerWindow:_drawerWindow constrainSize:_contentSize edge:edge];
|
||||
[self setContentSize:[self drawerWindow:_drawerWindow constrainSize:[self contentSize] edge:edge]];
|
||||
|
||||
_edge = edge;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NSDrawerWillOpenNotification object:self];
|
||||
|
||||
frame = [[self class] drawerFrameWithContentSize:_contentSize parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerOpenState];
|
||||
_contentSize = frame.size;
|
||||
frame = [[self class] drawerFrameWithContentSize:[self contentSize] parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerOpenState];
|
||||
[self setContentSize:frame.size];
|
||||
|
||||
// OK. setup and slide the drawer out
|
||||
start = [[self class] drawerFrameWithContentSize:_contentSize parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerClosedState];
|
||||
start = [[self class] drawerFrameWithContentSize:[self contentSize] parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerClosedState];
|
||||
|
||||
frame.size = start.size = [self drawerWindow:_drawerWindow constrainSize:frame.size edge:_edge];
|
||||
// frame.size = [self drawerWindow:_drawerWindow constrainSize:frame.size];
|
||||
@ -297,7 +358,7 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
if ([self state] != NSDrawerOpenState)
|
||||
return;
|
||||
|
||||
frame = [[self class] drawerFrameWithContentSize:_contentSize parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerClosedState];
|
||||
frame = [[self class] drawerFrameWithContentSize:[self contentSize] parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerClosedState];
|
||||
frame.size = [self drawerWindow:_drawerWindow constrainSize:frame.size edge:_edge];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NSDrawerWillCloseNotification object:self];
|
||||
@ -342,9 +403,14 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
[self _resetWindowOrdering:nil];
|
||||
}
|
||||
|
||||
- (void)parentWindowDidDeactivate:(NSWindow *)window {
|
||||
if (_state == NSDrawerOpenState && ![_parentWindow isMiniaturized])
|
||||
[self _resetWindowOrdering:nil];
|
||||
}
|
||||
|
||||
- (void)parentWindowDidChangeFrame:(NSWindow *)window {
|
||||
if (_state == NSDrawerOpenState) {
|
||||
NSRect frame = [[self class] drawerFrameWithContentSize:_contentSize parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:_state];
|
||||
NSRect frame = [[self class] drawerFrameWithContentSize:[self contentSize] parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:_state];
|
||||
|
||||
if (_edge == NSMinXEdge || _edge == NSMaxXEdge) {
|
||||
if (frame.size.width > _maxContentSize.width && _maxContentSize.width > 0)
|
||||
@ -370,12 +436,17 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
}
|
||||
|
||||
- (void)parentWindowDidDeminiaturize:(NSWindow *)window {
|
||||
// ... otherwise the drawer is visible before Windows finishes its animation, heh
|
||||
[self performSelector:@selector(_resetWindowOrdering:) withObject:window afterDelay:0.5];
|
||||
}
|
||||
|
||||
- (void)parentWindowDidClose:(NSWindow *)window {
|
||||
if (_state == NSDrawerOpenState)
|
||||
[_drawerWindow orderOut:nil];
|
||||
[self dealloc];
|
||||
}
|
||||
|
||||
- (void)drawerWindowDidActivate:(NSDrawerWindow *)window {
|
||||
[self _resetWindowOrdering:nil];
|
||||
if (_state == NSDrawerOpenState && ![_parentWindow isMiniaturized])
|
||||
[self _resetWindowOrdering:nil];
|
||||
}
|
||||
|
||||
- (NSSize)drawerWindow:(NSDrawerWindow *)window constrainSize:(NSSize)size edge:(NSRectEdge)edge {
|
||||
@ -383,16 +454,16 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
if (size.width > _maxContentSize.width && _maxContentSize.width > 0)
|
||||
size.width = _maxContentSize.width;
|
||||
|
||||
size.height = _contentSize.height;
|
||||
size.height = [self contentSize].height;
|
||||
}
|
||||
else {
|
||||
if (size.height > _maxContentSize.height && _maxContentSize.height > 0)
|
||||
size.height = _maxContentSize.height;
|
||||
|
||||
size.width = _contentSize.width;
|
||||
size.width = [self contentSize].width;
|
||||
}
|
||||
|
||||
_contentSize = size;
|
||||
[self setContentSize:size];
|
||||
|
||||
return size;
|
||||
}
|
||||
@ -407,6 +478,7 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
if (size.width < _minContentSize.width) {
|
||||
[self close];
|
||||
_contentSize.width = _minContentSize.width;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -415,6 +487,8 @@ NSString *NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
_contentSize.height = _minContentSize.height;
|
||||
}
|
||||
}
|
||||
|
||||
[self setContentSize:_contentSize];
|
||||
}
|
||||
|
||||
// ?
|
||||
|
@ -8,17 +8,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef enum {
|
||||
NSFileWrapperDirectoryType,
|
||||
NSFileWrapperRegularFileType,
|
||||
NSFileWrapperSymbolicLinkType
|
||||
} NSFileWrapperType;
|
||||
@class NSImage;
|
||||
|
||||
@interface NSFileWrapper : NSObject {
|
||||
@private
|
||||
id _content;
|
||||
NSMutableDictionary* _fileAttributes;
|
||||
NSFileWrapperType _contentType;
|
||||
NSString* _filename;
|
||||
NSString* _preferredFilename;
|
||||
NSImage * _icon;
|
||||
}
|
||||
|
||||
|
||||
@ -34,18 +31,36 @@ typedef enum {
|
||||
- (id)initWithPath:(NSString *)path;
|
||||
// Designated initializer.
|
||||
|
||||
- (NSDictionary*) fileWrappers;
|
||||
- (NSString *)addFileWrapper:(NSFileWrapper *)wrapper;
|
||||
|
||||
|
||||
- (NSString *)filename;
|
||||
-(void)setFilename:(NSString *)filename;
|
||||
|
||||
- (NSString *)preferredFilename;
|
||||
-(void)setPreferredFilename:(NSString *)filename;
|
||||
|
||||
- (void) setFileAttributes: (NSDictionary*) attributes;
|
||||
|
||||
- (void) setFileAttributes: (NSDictionary *)attributes;
|
||||
- (NSDictionary*) fileAttributes;
|
||||
|
||||
- (BOOL) isRegularFile;
|
||||
- (BOOL) isDirectory;
|
||||
- (BOOL) isSymbolicLink;
|
||||
|
||||
- (NSData*) regularFileContent;
|
||||
- (NSData*) regularFileContents;
|
||||
- (NSString*) symbolicLinkDestination;
|
||||
|
||||
- (NSImage *)icon;
|
||||
- (void)setIcon:(NSImage *)anImage;
|
||||
|
||||
// Write instace to disk at path. if directory type, this method is recursive
|
||||
// if flag is YES, the wrapper will be updated with the name used in writing the file
|
||||
- (BOOL)writeToFile:(NSString *)path
|
||||
atomically:(BOOL)atomicFlag
|
||||
updateFilenames:(BOOL)updateFilenamesFlag;
|
||||
|
||||
- (BOOL)needsToBeUpdatedFromPath:(NSString *)path;
|
||||
- (BOOL)updateFromPath:(NSString *)path;
|
||||
|
||||
@end
|
||||
|
@ -7,13 +7,57 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// 01/08/2007 original - Dirk Theisen
|
||||
#import <AppKit/NSFileWrapper.h>
|
||||
|
||||
|
||||
#import "NSFileWrapper.h"
|
||||
#import <Foundation/NSDebug.h>
|
||||
|
||||
|
||||
@interface NSFileWrapperFile : NSFileWrapper {
|
||||
NSData* contentData;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NSFileWrapperDirectory : NSFileWrapper {
|
||||
NSMutableDictionary* contentDictionary;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NSFileWrapperLink : NSFileWrapper {
|
||||
NSString* linkDestination;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSFileWrapper
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
static NSFileWrapper* sharedInstance = nil;
|
||||
if (!sharedInstance) sharedInstance = [super alloc];
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (BOOL) updateFromPath: (NSString*) path attributes: (NSDictionary*) attrs
|
||||
{
|
||||
_fileAttributes = [attrs retain];
|
||||
return attrs != nil;
|
||||
}
|
||||
|
||||
- (BOOL) updateFromPath: (NSString*) path
|
||||
{
|
||||
if ([self needsToBeUpdatedFromPath: path]) {
|
||||
[_fileAttributes release]; _fileAttributes = nil;
|
||||
NSDictionary* attrs = [[NSFileManager defaultManager] fileAttributesAtPath: path traverseLink: NO];
|
||||
return [self updateFromPath: path attributes: attrs];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init an instance from the file, directory, or symbolic link at the given path.<br />
|
||||
* Init an instance from the file, directory, or symbolic link at the given absolute path.<br />
|
||||
*/
|
||||
- (id) initWithPath: (NSString*)path
|
||||
{
|
||||
@ -21,71 +65,103 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
NSFileManager* fm = [NSFileManager defaultManager];
|
||||
|
||||
if (NSDebugEnabled) NSLog(@"NSFileWrapper", @"initWithPath: %@", path);
|
||||
NSDictionary* attrs = [[fm fileAttributesAtPath: path traverseLink: NO] retain];
|
||||
|
||||
// Store the full path in filename, the specification is unclear in this point
|
||||
[self setFilename: path];
|
||||
[self setPreferredFilename: [path lastPathComponent]];
|
||||
[self setFileAttributes: [fm fileAttributesAtPath: path traverseLink: NO]];
|
||||
|
||||
NSString* fileType = [[self fileAttributes] fileType];
|
||||
if ([fileType isEqualToString: @"NSFileTypeDirectory"]) {
|
||||
NSMutableDictionary* fileWrappers = [NSMutableDictionary dictionary];
|
||||
NSEnumerator* enumerator = [fm enumeratorAtPath: path];
|
||||
NSString* filename;
|
||||
|
||||
while ((filename = [enumerator nextObject]) != nil) {
|
||||
NSFileWrapper* wrapper = [[NSFileWrapper alloc] initWithPath:
|
||||
[path stringByAppendingPathComponent: filename]];
|
||||
[fileWrappers setObject: wrapper forKey: filename];
|
||||
[wrapper release];
|
||||
}
|
||||
self = [self initDirectoryWithFileWrappers: fileWrappers];
|
||||
} else if ([fileType isEqualToString: @"NSFileTypeRegular"]) {
|
||||
self = [self initRegularFileWithContents: [[[NSData alloc] initWithContentsOfFile: path] autorelease]];
|
||||
} else if ([fileType isEqualToString: @"NSFileTypeSymbolicLink"]) {
|
||||
NSString* fileType = [attrs fileType];
|
||||
if ([fileType isEqualToString: NSFileTypeDirectory]) {
|
||||
self = [self initDirectoryWithFileWrappers: nil];
|
||||
} else if ([fileType isEqualToString: NSFileTypeRegular]) {
|
||||
self = [self initRegularFileWithContents: nil];
|
||||
} else if ([fileType isEqualToString: NSFileTypeSymbolicLink]) {
|
||||
self = [self initSymbolicLinkWithDestination:
|
||||
[fm pathContentOfSymbolicLinkAtPath: path]];
|
||||
}
|
||||
nil];
|
||||
} else {
|
||||
self = nil; // should never happen
|
||||
}
|
||||
[self updateFromPath: path attributes: attrs];
|
||||
|
||||
// Store the full path in filename, the specification is unclear in this point
|
||||
[self setFilename: [path lastPathComponent]];
|
||||
[self setPreferredFilename: [self filename]];
|
||||
|
||||
[pool release];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSData*) regularFileContent
|
||||
- (NSData*) regularFileContents
|
||||
{
|
||||
if (_contentType != NSFileWrapperRegularFileType) {
|
||||
[NSException raise: NSInternalInconsistencyException format: @"Try to access regular file content of something not regular file."];
|
||||
}
|
||||
return _content;
|
||||
[NSException raise: NSInternalInconsistencyException format: @"Try to access regular file content of something not regular file."];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Init instance of regular file type
|
||||
- (NSString*) symbolicLinkDestination
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException format: @"Try to access symbolic link destination of something not a link wrapper."];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
// Init and return an instance for a regular file type
|
||||
- (id) initRegularFileWithContents: (NSData*) data
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_content = [data copy];
|
||||
_contentType = NSFileWrapperRegularFileType;
|
||||
}
|
||||
return self;
|
||||
return [[NSFileWrapperFile alloc] initRegularFileWithContents: data];
|
||||
}
|
||||
|
||||
- (id)initDirectoryWithFileWrappers:(NSDictionary *)docs;
|
||||
// Init and return an instance for a directory type
|
||||
- (id) initDirectoryWithFileWrappers: (NSDictionary*) docs;
|
||||
{
|
||||
return [[NSFileWrapperDirectory alloc] initDirectoryWithFileWrappers: docs];
|
||||
}
|
||||
|
||||
// Init and return an instance for a symbolic link type
|
||||
- (id) initSymbolicLinkWithDestination: (NSString*) path
|
||||
{
|
||||
NSParameterAssert(NO); // Not implemented yet
|
||||
return nil;
|
||||
return [[NSFileWrapperLink alloc] initSymbolicLinkWithDestination: path];
|
||||
}
|
||||
|
||||
- (id)initSymbolicLinkWithDestination:(NSString *)path
|
||||
- (NSString *)filename
|
||||
{
|
||||
NSParameterAssert(NO); // Not implemented yet
|
||||
return nil;
|
||||
return _filename;
|
||||
}
|
||||
|
||||
-(void)setFilename:(NSString *)filename {
|
||||
NSParameterAssert(NO); // Not implemented yet
|
||||
- (void) setFilename: (NSString*) filename
|
||||
{
|
||||
if ([filename length]) {
|
||||
if (filename != _filename) {
|
||||
[_filename autorelease];
|
||||
_filename = [filename retain];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[NSException raise: NSInternalInconsistencyException format: @"-[NSFileWrapper setFilename:] filename may not be nil or empty."];
|
||||
}
|
||||
|
||||
-(void)setPreferredFilename:(NSString *)filename {
|
||||
NSParameterAssert(NO); // Not implemented yet
|
||||
- (void) setIcon: (NSImage*) anImage
|
||||
{
|
||||
// Do we need it at all?
|
||||
}
|
||||
|
||||
- (NSImage*) icon
|
||||
{
|
||||
return nil; // Do we need it at all?
|
||||
}
|
||||
|
||||
- (NSString*) preferredFilename
|
||||
{
|
||||
return _preferredFilename;
|
||||
}
|
||||
|
||||
|
||||
- (void) setPreferredFilename: (NSString*) preferredFilename
|
||||
{
|
||||
if ([preferredFilename length]) {
|
||||
if (preferredFilename != _preferredFilename) {
|
||||
[_preferredFilename autorelease];
|
||||
_preferredFilename = [preferredFilename retain];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[NSException raise: NSInternalInconsistencyException format: @"-[NSFileWrapper setPreferredFilename:] preferredFilename may not be nil or empty."];
|
||||
}
|
||||
|
||||
- (void) setFileAttributes: (NSDictionary*) attributes
|
||||
@ -104,11 +180,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
- (BOOL) isRegularFile
|
||||
{
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) isDirectory
|
||||
{
|
||||
return NO; // implement
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) isSymbolicLink
|
||||
@ -116,11 +193,298 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)removeFileWrapper: (NSFileWrapper *)wrapper
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException format: @"-[NSFileWrapper %@] sent to a non directory file wrapper.", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
|
||||
|
||||
- (NSString*) addFileWrapper: (NSFileWrapper*) wrapper
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException format: @"-[NSFileWrapper %@] sent to a non directory file wrapper.", NSStringFromSelector(_cmd)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSDictionary*) fileWrappers
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException format: @"-[NSFileWrapper %@] sent to a non directory file wrapper.", NSStringFromSelector(_cmd)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString*) path
|
||||
atomically: (BOOL) atomicFlag
|
||||
updateFilenames: (BOOL) updateFilenamesFlag
|
||||
{
|
||||
NSAssert(NO, @"Implemented in concrete subclasses.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) needsToBeUpdatedFromPath: (NSString*) path
|
||||
{
|
||||
NSDate* changeDateSelf = [[self fileAttributes] fileModificationDate];
|
||||
NSDate* changeDatePath = [[[NSFileManager defaultManager] fileAttributesAtPath: path
|
||||
traverseLink: NO] fileModificationDate];
|
||||
return [changeDatePath compare: changeDateSelf] > 0;
|
||||
}
|
||||
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_content release];
|
||||
[_fileAttributes release];
|
||||
[_preferredFilename release];
|
||||
[_filename release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSFileWrapperFile
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject(self, 0, NULL);
|
||||
}
|
||||
|
||||
// Init instance of regular file type
|
||||
- (id) initRegularFileWithContents: (NSData*) data
|
||||
{
|
||||
if (self = [self init]) {
|
||||
contentData = [data copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) updateFromPath: (NSString*) path attributes: (NSDictionary*) attrs
|
||||
{
|
||||
if ([super updateFromPath: path attributes: attrs]) {
|
||||
[contentData release];
|
||||
unsigned long long length = [attrs fileSize];
|
||||
|
||||
contentData = length < 8192*160 ? [[NSData alloc] initWithContentsOfFile: path] : [[NSData alloc] initWithContentsOfMappedFile: path]; // use some treshhold to not thrash for big files - can we run out of file handles here?
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) isRegularFile
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSData*) regularFileContents
|
||||
{
|
||||
return contentData;
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString*) path
|
||||
atomically: (BOOL) atomicFlag
|
||||
updateFilenames: (BOOL) updateFilenamesFlag
|
||||
{
|
||||
BOOL result = [[self regularFileContents] writeToFile: path
|
||||
atomically: atomicFlag];
|
||||
if ([self fileAttributes]) {
|
||||
[[NSFileManager defaultManager] changeFileAttributes: [self fileAttributes]
|
||||
atPath: path];
|
||||
}
|
||||
if (updateFilenamesFlag) {
|
||||
[self setFilename: [path lastPathComponent]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[contentData release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSFileWrapperDirectory
|
||||
|
||||
- (id) initDirectoryWithFileWrappers: (NSDictionary*) docs;
|
||||
{
|
||||
if (self = [self init]) {
|
||||
contentDictionary = [docs mutableCopy];
|
||||
|
||||
NSEnumerator* ke = [contentDictionary keyEnumerator];
|
||||
NSString* name;
|
||||
while (name = [ke nextObject]) {
|
||||
NSFileWrapper* wrapper = [contentDictionary objectForKey: name];
|
||||
if ([[wrapper preferredFilename] length] == 0) {
|
||||
[wrapper setPreferredFilename: name];
|
||||
}
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isDirectory
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSDictionary*) fileWrappers
|
||||
{
|
||||
return contentDictionary;
|
||||
}
|
||||
|
||||
- (NSString*) addFileWrapper: (NSFileWrapper*) wrapper
|
||||
{
|
||||
if (!contentDictionary) {
|
||||
contentDictionary = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
NSParameterAssert([[wrapper preferredFilename] length]>0);
|
||||
NSString* name = [wrapper preferredFilename];
|
||||
while ([contentDictionary objectForKey: name]) {
|
||||
// append random number to prefered name:
|
||||
name = [NSString stringWithFormat: @"%@-%x", [wrapper preferredFilename], rand()];
|
||||
}
|
||||
[contentDictionary setObject: wrapper forKey: name];
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) writeToFile: (NSString*) path
|
||||
atomically: (BOOL) atomicFlag
|
||||
updateFilenames: (BOOL) updateFilenamesFlag
|
||||
{
|
||||
NSFileManager* fm = [NSFileManager defaultManager];
|
||||
NSDictionary* wrappers = [self fileWrappers];
|
||||
NSEnumerator* enumerator = [wrappers keyEnumerator];
|
||||
NSString* key;
|
||||
BOOL result = YES;
|
||||
|
||||
[fm createDirectoryAtPath: path attributes: [self fileAttributes]];
|
||||
if ([self fileAttributes]) {
|
||||
[[NSFileManager defaultManager] changeFileAttributes: [self fileAttributes]
|
||||
atPath: path];
|
||||
}
|
||||
while ((key = [enumerator nextObject])) {
|
||||
NSString* newPath = [path stringByAppendingPathComponent: key];
|
||||
result &= [[wrappers objectForKey: key] writeToFile: newPath
|
||||
atomically: atomicFlag
|
||||
updateFilenames: updateFilenamesFlag];
|
||||
}
|
||||
|
||||
if (updateFilenamesFlag) {
|
||||
[self setFilename: [path lastPathComponent]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
- (void) removeFileWrapper: (NSFileWrapper*) wrapper
|
||||
{
|
||||
NSArray* keys = [contentDictionary allKeysForObject: wrapper];
|
||||
if ([keys count]) {
|
||||
[contentDictionary removeObjectsForKeys: keys];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) updateFromPath: (NSString*) path attributes: (NSDictionary*) attrs
|
||||
{
|
||||
if ([super updateFromPath: path attributes: attrs]) {
|
||||
|
||||
NSMutableDictionary* newContentDictionary = [[NSMutableDictionary alloc] init];
|
||||
NSDirectoryEnumerator* enumerator = [[NSFileManager defaultManager] enumeratorAtPath: path];
|
||||
NSString* filename;
|
||||
|
||||
while ((filename = [enumerator nextObject]) != nil) {
|
||||
[enumerator skipDescendents];
|
||||
NSString* absolutePath = [path stringByAppendingPathComponent: filename];
|
||||
// Try to recycle an old wrapper (and data!)
|
||||
NSFileWrapper* wrapper = [contentDictionary objectForKey: filename];
|
||||
if (wrapper) {
|
||||
// Update recycled wrapper:
|
||||
[wrapper updateFromPath: absolutePath];
|
||||
} else {
|
||||
// Create new one:
|
||||
wrapper = [[[NSFileWrapper class] alloc] initWithPath: absolutePath];
|
||||
}
|
||||
[newContentDictionary setObject: wrapper forKey: filename];
|
||||
[wrapper release];
|
||||
}
|
||||
|
||||
[contentDictionary release];
|
||||
contentDictionary = newContentDictionary;
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject(self, 0, NULL);
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[contentDictionary release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSFileWrapperLink
|
||||
|
||||
- (id) initSymbolicLinkWithDestination: (NSString*) path
|
||||
{
|
||||
if (self = [self init]) {
|
||||
linkDestination = [path copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isSymbolicLink
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString*) symbolicLinkDestination
|
||||
{
|
||||
return linkDestination;
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString*) path
|
||||
atomically: (BOOL) atomicFlag
|
||||
updateFilenames: (BOOL) updateFilenamesFlag
|
||||
{
|
||||
BOOL result = [[NSFileManager defaultManager] createSymbolicLinkAtPath: path
|
||||
pathContent: [self symbolicLinkDestination]];
|
||||
if ([self fileAttributes]) {
|
||||
[[NSFileManager defaultManager] changeFileAttributes: [self fileAttributes]
|
||||
atPath: path];
|
||||
}
|
||||
if (updateFilenamesFlag) {
|
||||
[self setFilename: [path lastPathComponent]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (BOOL) updateFromPath: (NSString*) path attributes: (NSDictionary*) attrs
|
||||
{
|
||||
if ([super updateFromPath: path attributes: attrs]) {
|
||||
[linkDestination release];
|
||||
linkDestination = [[[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath: path] copy];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject(self, 0, NULL);
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[linkDestination release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ static inline NSGlyphMetrics *fetchGlyphAdvancementIfNeeded(NSFont *self,NSGlyph
|
||||
-(void)fetchMetrics {
|
||||
NSFontMetrics metrics;
|
||||
|
||||
[[NSDisplay currentDisplay] metricsForFontWithName:_name pointSize:_pointSize metrics:&metrics];
|
||||
[[NSDisplay currentDisplay] metricsForFontWithName:[_name cString] pointSize:_pointSize metrics:&metrics];
|
||||
|
||||
_boundingRect=metrics.boundingRect;
|
||||
|
||||
|
@ -30,13 +30,13 @@ NSString *NSCalibratedRGBColorSpace=@"NSCalibratedRGBColorSpace";
|
||||
NSString *NSNamedColorSpace=@"NSNamedColorSpace";
|
||||
|
||||
void NSRectClipList(const NSRect *rects, int count) {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
CGContextRef graphicsPort=NSCurrentGraphicsPort();
|
||||
|
||||
CGContextClipToRects(graphicsPort,rects,count);
|
||||
}
|
||||
|
||||
void NSRectClip(NSRect rect) {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
CGContextRef graphicsPort=NSCurrentGraphicsPort();
|
||||
|
||||
CGContextClipToRect(graphicsPort,rect);
|
||||
}
|
||||
@ -55,7 +55,7 @@ void NSRectFillListWithColors(const NSRect *rects,NSColor **colors,int count) {
|
||||
}
|
||||
|
||||
void NSRectFillListWithGrays(const NSRect *rects,const float *grays,int count) {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
CGContextRef graphicsPort=NSCurrentGraphicsPort();
|
||||
int i;
|
||||
|
||||
for(i=0;i<count;i++){
|
||||
@ -80,7 +80,7 @@ void NSFrameRectWithWidth(NSRect rect,float width) {
|
||||
}
|
||||
|
||||
void NSFrameRect(NSRect rect) {
|
||||
CGContextStrokeRect(NSCurrentGraphicsPort(),rect);
|
||||
CGContextStrokeRectWithWidth(NSCurrentGraphicsPort(),rect,1);
|
||||
}
|
||||
|
||||
void NSDottedFrameRect(NSRect rect) {
|
||||
@ -123,7 +123,7 @@ void NSDottedFrameRect(NSRect rect) {
|
||||
|
||||
|
||||
static NSRect NSDrawColorRects(NSRect boundsRect,NSRect clipRect,const NSRect *sides,NSColor **colors,int count) {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
CGContextRef graphicsPort=NSCurrentGraphicsPort();
|
||||
|
||||
CGContextSaveGState(graphicsPort);
|
||||
CGContextClipToRect(graphicsPort,clipRect);
|
||||
|
@ -12,13 +12,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@class NSWindow, NSCachedImageRep;
|
||||
|
||||
@interface NSGraphicsContext : NSObject {
|
||||
CGContext *_graphicsPort;
|
||||
KGContext *_graphicsPort;
|
||||
BOOL _isDrawingToScreen;
|
||||
}
|
||||
|
||||
+(NSGraphicsContext *)graphicsContextWithWindow:(NSWindow *)window;
|
||||
+(NSGraphicsContext *)graphicsContextWithCachedImageRep:(NSCachedImageRep *)imageRep;
|
||||
+(NSGraphicsContext *)graphicsContextWithPrintingContext:(CGContext *)context;
|
||||
+(NSGraphicsContext *)graphicsContextWithPrintingContext:(KGContext *)context;
|
||||
|
||||
+(NSGraphicsContext *)currentContext;
|
||||
+(void)setCurrentContext:(NSGraphicsContext *)context;
|
||||
@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
+(BOOL)currentContextDrawingToScreen;
|
||||
|
||||
-(CGContext *)graphicsPort;
|
||||
-(KGContext *)graphicsPort;
|
||||
|
||||
-(BOOL)isDrawingToScreen;
|
||||
|
||||
|
@ -10,7 +10,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
#import <AppKit/NSWindow-Private.h>
|
||||
#import <AppKit/NSCachedImageRep.h>
|
||||
#import <AppKit/CGRenderingContext.h>
|
||||
#import <AppKit/CGContext.h>
|
||||
|
||||
@class NSColor;
|
||||
@ -18,24 +17,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@implementation NSGraphicsContext
|
||||
|
||||
-initWithWindow:(NSWindow *)window {
|
||||
CGAffineTransform flip={1,0,0,-1,0,[window frame].size.height};
|
||||
|
||||
_graphicsPort=[[[window _renderingContext] graphicsContextWithTransform:flip clipRect:NSMakeRect(0,0,[window frame].size.width,[window frame].size.height)] retain];
|
||||
_graphicsPort=CGContextRetain([window graphicsContext]);
|
||||
_isDrawingToScreen=YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-initWithWithCachedImageRep:(NSCachedImageRep *)imageRep {
|
||||
CGAffineTransform flip={1,0,0,-1,0,[imageRep size].height};
|
||||
|
||||
_graphicsPort=[[[imageRep renderingContext] graphicsContextWithTransform:flip clipRect: NSMakeRect(0,0,[imageRep size].width,[imageRep size].height)] retain];
|
||||
_graphicsPort=CGContextRetain([imageRep graphicsContext]);
|
||||
_isDrawingToScreen=YES;
|
||||
return self;
|
||||
}
|
||||
|
||||
-initWithPrintingContext:(CGContext *)context {
|
||||
_graphicsPort=[context retain];
|
||||
-initWithPrintingContext:(KGContext *)context {
|
||||
_graphicsPort=CGContextRetain(context);
|
||||
_isDrawingToScreen=NO;
|
||||
return self;
|
||||
}
|
||||
@ -48,7 +42,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return [[[self alloc] initWithWithCachedImageRep:imageRep] autorelease];
|
||||
}
|
||||
|
||||
+(NSGraphicsContext *)graphicsContextWithPrintingContext:(CGContext *)context {
|
||||
+(NSGraphicsContext *)graphicsContextWithPrintingContext:(KGContext *)context {
|
||||
return [[[self alloc] initWithPrintingContext:context] autorelease];
|
||||
}
|
||||
|
||||
@ -68,7 +62,7 @@ static NSGraphicsContext *_currentContext() {
|
||||
return NSThreadSharedInstanceDoNotCreate(@"NSGraphicsContext");
|
||||
}
|
||||
|
||||
CGContext *NSCurrentGraphicsPort() {
|
||||
KGContext *NSCurrentGraphicsPort() {
|
||||
return _currentContext()->_graphicsPort;
|
||||
}
|
||||
|
||||
@ -107,11 +101,11 @@ CGContext *NSCurrentGraphicsPort() {
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_graphicsPort release];
|
||||
CGContextRelease(_graphicsPort);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(CGContext *)graphicsPort {
|
||||
-(KGContext *)graphicsPort {
|
||||
return _graphicsPort;
|
||||
}
|
||||
|
||||
|
@ -8,4 +8,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
|
||||
CGContext *NSCurrentGraphicsPort();
|
||||
KGContext *NSCurrentGraphicsPort();
|
||||
|
@ -178,7 +178,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(void)lockFocus {
|
||||
NSCachedImageRep *cached=[self _cachedImageRep];
|
||||
NSGraphicsContext *context;
|
||||
CGContext *graphicsPort;
|
||||
KGContext *graphicsPort;
|
||||
|
||||
if(cached==nil){
|
||||
cached=[[[NSCachedImageRep alloc] initWithSize:_size] autorelease];
|
||||
@ -196,7 +196,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
|
||||
-(void)unlockFocus {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
KGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
|
||||
CGContextRestoreGState(graphicsPort);
|
||||
|
||||
|
@ -26,5 +26,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(NSSize)size;
|
||||
|
||||
-(BOOL)drawAtPoint:(NSPoint)point;
|
||||
-(BOOL)drawInRect:(NSRect)rect;
|
||||
|
||||
@end
|
||||
|
@ -38,6 +38,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL)drawInRect:(NSRect)rect {
|
||||
NSInvalidAbstractInvocation();
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(NSString *)description {
|
||||
return [NSString stringWithFormat:@"<%@[0x%lx] size: { %f, %f } colorSpace: %@ (%dx%d @ %d bps) alpha: %@ opaque: %@>",
|
||||
[self class], self, _size.width, _size.height, _colorSpaceName, _pixelsWide, _pixelsHigh, _bitsPerSample,
|
||||
|
@ -8,7 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <AppKit/NSGraphics.h>
|
||||
|
||||
@class CGContext;
|
||||
@class KGContext;
|
||||
|
||||
void NSInterfaceDrawButton(NSRect rect,NSRect clipRect);
|
||||
void NSInterfaceDrawHighlightedButton(NSRect rect,NSRect clipRect);
|
||||
@ -22,4 +22,4 @@ void NSInterfaceDrawBrowserHeader(NSRect rect,NSRect clipRect);
|
||||
void NSInterfaceDrawProgressIndicatorBezel(NSRect rect,NSRect clipRect);
|
||||
|
||||
void NSInterfaceDrawOutlineMarker(NSRect rect,NSRect clipRect, BOOL state);
|
||||
void NSInterfaceDrawOutlineGrid(NSRect rect,CGContext *context);
|
||||
void NSInterfaceDrawOutlineGrid(NSRect rect,KGContext *context);
|
||||
|
@ -14,7 +14,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSView.h>
|
||||
|
||||
static NSRect NSInterfaceDrawRects(NSRect boundsRect,NSRect clipRect,const NSRect *sides,NSColor **colors,int count) {
|
||||
CGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
KGContext *graphicsPort=NSCurrentGraphicsPort();
|
||||
|
||||
CGContextSaveGState(graphicsPort);
|
||||
CGContextClipToRect(graphicsPort,clipRect);
|
||||
@ -237,7 +237,7 @@ void NSInterfaceDrawOutlineMarker(NSRect rect,NSRect clipRect, BOOL state) {
|
||||
NSInterfaceDrawRects(rect,clipRect,rects,colors,numDrawnRects);
|
||||
}
|
||||
|
||||
void NSInterfaceDrawOutlineGrid(NSRect rect,CGContext *context) {
|
||||
void NSInterfaceDrawOutlineGrid(NSRect rect,KGContext *context) {
|
||||
/* Win32 has poor dashed line support...
|
||||
*/
|
||||
if(rect.size.width<0)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user