Skip to content

Commit

Permalink
Original
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwl committed Dec 22, 2006
1 parent 675207e commit 30916ff
Show file tree
Hide file tree
Showing 948 changed files with 118,896 additions and 0 deletions.
110 changes: 110 additions & 0 deletions AppKit/AppKit.h
@@ -0,0 +1,110 @@
/* Copyright (c) 2006 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/NSActionCell.h>
#import <AppKit/NSAffineTransform.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSAttributedString.h>
#import <AppKit/NSBitmapImageRep.h>
#import <AppKit/NSBox.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSButtonCell.h>
#import <AppKit/NSBrowser.h>
#import <AppKit/NSBrowserCell.h>
#import <AppKit/NSCachedImageRep.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSClipView.h>
#import <AppKit/NSColor.h>
#import <AppKit/NSColorList.h>
#import <AppKit/NSColorPanel.h>
#import <AppKit/NSColorPicker.h>
#import <AppKit/NSColorWell.h>
#import <AppKit/NSComboBox.h>
#import <AppKit/NSComboBoxCell.h>
#import <AppKit/NSControl.h>
#import <AppKit/NSCursor.h>
#import <AppKit/NSCustomImageRep.h>
#import <AppKit/NSDocument.h>
#import <AppKit/NSDocumentController.h>
#import <AppKit/NSDragging.h>
#import <AppKit/NSDrawer.h>
#import <AppKit/NSEPSImageRep.h>
#import <AppKit/NSEvent.h>
#import <AppKit/NSFileWrapper.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSFontManager.h>
#import <AppKit/NSFontPanel.h>
#import <AppKit/NSForm.h>
#import <AppKit/NSFormCell.h>
#import <AppKit/NSGraphics.h>
#import <AppKit/NSGraphicsContext.h>
#import <AppKit/NSImage.h>
#import <AppKit/NSImageCell.h>
#import <AppKit/NSImageRep.h>
#import <AppKit/NSInterfaceStyle.h>
#import <AppKit/NSLayoutManager.h>
#import <AppKit/NSMatrix.h>
#import <AppKit/NSMenu.h>
#import <AppKit/NSMenuItem.h>
#import <AppKit/NSMutableParagraphStyle.h>
#import <AppKit/NSNibLoading.h>
#import <AppKit/NSNibConnector.h>
#import <AppKit/NSNibControlConnector.h>
#import <AppKit/NSNibOutletConnector.h>
#import <AppKit/NSOpenPanel.h>
#import <AppKit/NSOutlineView.h>
#import <AppKit/NSPageLayout.h>
#import <AppKit/NSPanel.h>
#import <AppKit/NSParagraphStyle.h>
#import <AppKit/NSPasteboard.h>
#import <AppKit/NSPopUpButton.h>
#import <AppKit/NSPopUpButtonCell.h>
#import <AppKit/NSPrintOperation.h>
#import <AppKit/NSPrintInfo.h>
#import <AppKit/NSProgressIndicator.h>
#import <AppKit/NSResponder.h>
#import <AppKit/NSRulerMarker.h>
#import <AppKit/NSRulerView.h>
#import <AppKit/NSSavePanel.h>
#import <AppKit/NSScreen.h>
#import <AppKit/NSScroller.h>
#import <AppKit/NSScrollView.h>
#import <AppKit/NSSlider.h>
#import <AppKit/NSSliderCell.h>
#import <AppKit/NSSplitView.h>
#import <AppKit/NSStepper.h>
#import <AppKit/NSStepperCell.h>
#import <AppKit/NSStringDrawing.h>
#import <AppKit/NSSecureTextField.h>
#import <AppKit/NSSecureTextFieldCell.h>
#import <AppKit/NSTableColumn.h>
#import <AppKit/NSTableHeaderCell.h>
#import <AppKit/NSTableHeaderView.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSTabView.h>
#import <AppKit/NSTabViewItem.h>
#import <AppKit/NSText.h>
#import <AppKit/NSTextAttachment.h>
#import <AppKit/NSTextContainer.h>
#import <AppKit/NSTextField.h>
#import <AppKit/NSTextFieldCell.h>
#import <AppKit/NSTextStorage.h>
#import <AppKit/NSTextTab.h>
#import <AppKit/NSTextView.h>
#import <AppKit/NSToolbar.h>
#import <AppKit/NSToolbarItem.h>
#import <AppKit/NSView.h>
#import <AppKit/NSWindow.h>
#import <AppKit/NSWindowController.h>
#import <AppKit/NSWorkspace.h>

#import <AppKit/CoreGraphics.h>

#define IBOutlet
2,467 changes: 2,467 additions & 0 deletions AppKit/AppKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions AppKit/AppKitExport.h
@@ -0,0 +1,15 @@
/* Copyright (c) 2006 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. */

#if defined(__WIN32__)
#if defined(APPKIT_INSIDE_BUILD)
#define APPKIT_EXPORT __declspec(dllexport) extern
#else
#define APPKIT_EXPORT __declspec(dllimport) extern
#endif
#endif
40 changes: 40 additions & 0 deletions AppKit/CoreGraphics.subproj/CGAffineTransform.h
@@ -0,0 +1,40 @@
/* Copyright (c) 2006 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/AppKitExport.h>

#import <AppKit/CGGeometry.h>

typedef struct {
float a;
float b;
float c;
float d;
float tx;
float ty;
} CGAffineTransform;

APPKIT_EXPORT const CGAffineTransform CGAffineTransformIdentity;

APPKIT_EXPORT CGAffineTransform CGAffineTransformMake(float a,float b,float c,float d,float tx,float ty);
APPKIT_EXPORT CGAffineTransform CGAffineTransformMakeRotation(float radians);
APPKIT_EXPORT CGAffineTransform CGAffineTransformMakeScale(float scalex,float scaley);
APPKIT_EXPORT CGAffineTransform CGAffineTransformMakeTranslation(float tx,float ty);

APPKIT_EXPORT CGAffineTransform CGAffineTransformConcat(CGAffineTransform xform,CGAffineTransform append);
APPKIT_EXPORT CGAffineTransform CGAffineTransformInvert(CGAffineTransform xform);

APPKIT_EXPORT CGAffineTransform CGAffineTransformRotate(CGAffineTransform xform,float radians);
APPKIT_EXPORT CGAffineTransform CGAffineTransformScale(CGAffineTransform xform,float scalex,float scaley);
APPKIT_EXPORT CGAffineTransform CGAffineTransformTranslate(CGAffineTransform xform,float tx,float ty);

APPKIT_EXPORT CGPoint CGPointApplyAffineTransform(CGPoint point, CGAffineTransform xform);
APPKIT_EXPORT CGSize CGSizeApplyAffineTransform(CGSize size, CGAffineTransform xform);


96 changes: 96 additions & 0 deletions AppKit/CoreGraphics.subproj/CGAffineTransform.m
@@ -0,0 +1,96 @@
/* Copyright (c) 2006 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/CGAffineTransform.h>

const CGAffineTransform CGAffineTransformIdentity={1,0,0,1,0,0};

CGAffineTransform CGAffineTransformMake(float a,float b,float c,float d,float tx,float ty){
CGAffineTransform xform={a,b,c,d,tx,ty};
return xform;
}

CGAffineTransform CGAffineTransformMakeRotation(float radians){
CGAffineTransform xform={cos(radians),sin(radians),-sin(radians),cos(radians),0,0};
return xform;
}

CGAffineTransform CGAffineTransformMakeScale(float scalex,float scaley){
CGAffineTransform xform={scalex,0,0,scaley,0,0};
return xform;
}

CGAffineTransform CGAffineTransformMakeTranslation(float tx,float ty){
CGAffineTransform xform={1,0,0,1,tx,ty};
return xform;
}

CGAffineTransform CGAffineTransformConcat(CGAffineTransform xform,CGAffineTransform append){
CGAffineTransform result;

result.a=append.a*xform.a+append.b*xform.c;
result.b=append.a*xform.b+append.b*xform.d;
result.c=append.c*xform.a+append.d*xform.c;
result.d=append.c*xform.b+append.d*xform.d;
result.tx=append.tx*xform.a+append.ty*xform.c+xform.tx;
result.ty=append.tx*xform.b+append.ty*xform.d+xform.ty;

return result;
}

CGAffineTransform CGAffineTransformInvert(CGAffineTransform xform){
CGAffineTransform result;
float determinant;

determinant=xform.a*xform.d-xform.c*xform.b;
if(determinant==0)
return xform;

result.a=xform.d/determinant;
result.b=-xform.b/determinant;
result.c=-xform.c/determinant;
result.d=xform.a/determinant;
result.tx=(-xform.d*xform.tx+xform.c*xform.ty)/determinant;
result.ty=(xform.b*xform.tx-xform.a*xform.ty)/determinant;

return result;
}

CGAffineTransform CGAffineTransformRotate(CGAffineTransform xform,float radians){
CGAffineTransform rotate=CGAffineTransformMakeRotation(radians);
return CGAffineTransformConcat(xform,rotate);
}

CGAffineTransform CGAffineTransformScale(CGAffineTransform xform,float scalex,float scaley){
CGAffineTransform scale=CGAffineTransformMakeScale(scalex,scaley);
return CGAffineTransformConcat(xform,scale);
}

CGAffineTransform CGAffineTransformTranslate(CGAffineTransform xform,float tx,float ty){
CGAffineTransform translate=CGAffineTransformMakeTranslation(tx,ty);
return CGAffineTransformConcat(xform,translate);
}

CGPoint CGPointApplyAffineTransform(CGPoint point,CGAffineTransform xform){
CGPoint p;

p.x=xform.a*point.x+xform.c*point.y+xform.tx;
p.y=xform.b*point.x+xform.d*point.y+xform.ty;

return p;
}

CGSize CGSizeApplyAffineTransform(CGSize size,CGAffineTransform xform){
CGSize s;

s.width=xform.a*size.width+xform.c*size.height;
s.height=xform.b*size.width+xform.d*size.height;

return s;
}
85 changes: 85 additions & 0 deletions AppKit/CoreGraphics.subproj/CGContext.h
@@ -0,0 +1,85 @@
/* Copyright (c) 2006 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/CGFont.h>
#import <AppKit/CGGeometry.h>
#import <AppKit/CGAffineTransform.h>
#import <AppKit/AppKitExport.h>

@class CGRenderingContext;

@interface CGContext : NSObject

@end

typedef enum {
kCGEncodingFontSpecific
} CGTextEncoding;

typedef CGContext *CGContextRef;

APPKIT_EXPORT void CGContextSaveGState(CGContextRef context);
APPKIT_EXPORT void CGContextRestoreGState(CGContextRef context);

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);

APPKIT_EXPORT CGAffineTransform CGContextGetTextMatrix(CGContextRef context);
APPKIT_EXPORT void CGContextSetTextMatrix(CGContextRef context, CGAffineTransform transform);

APPKIT_EXPORT void CGContextClipToRect(CGContextRef context,CGRect rect);
APPKIT_EXPORT void CGContextClipToRects(CGContextRef context,const CGRect *rects,unsigned count);

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 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 CGContextSetLineWidth(CGContextRef context,float width);

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 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 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 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);

0 comments on commit 30916ff

Please sign in to comment.