DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | List of all members
DKImageShape Class Reference

DKImageShape is a drawable shape that displays an image. More...

Inheritance diagram for DKImageShape:
Inheritance graph
[legend]

Instance Methods

(NSCompositingOperation) - compositingOperation
 Get the Quartz composition mode to use when compositing the image. More...
 
(IBAction) - copyImage:
 Copy the image directly to the pasteboard. More...
 
(IBAction) - fitToImage:
 Resizes the shape to exactly fit the image at its original size. More...
 
(NSImage *) - image
 Get the object's image. More...
 
(NSImage *) - imageAtRenderedSize
 Get a copy of the object's image scaled to the same size, angle and aspect ratio as the image drawn. More...
 
(DKImageCroppingOptions) - imageCroppingOptions
 Get the display mode for the object - crop image or scale it. More...
 
(NSData *) - imageData
 Returns the image original data. More...
 
(BOOL- imageDrawsOnTop
 Whether the image draws above or below the rendering done by the style. More...
 
(NSString *) - imageKey
 Return the object's image key. More...
 
(NSPoint) - imageOffset
 Get the offset position for the image. More...
 
(CGFloat- imageOpacity
 Get the image's opacity. More...
 
(CGFloat- imageScale
 Get the scale factor for the image. More...
 
(id- initWithContentsOfFile:
 Initializes the image shape from an image file given by the path. More...
 
(id- initWithImage:
 Initializes the image shape from an image. More...
 
(id- initWithImageData:
 Initializes the image shape from image data. More...
 
(IBAction) - pasteImage:
 Replace the shape's image with one from the pasteboard if possible. More...
 
(IBAction) - selectCropOrScaleAction:
 Select whether the object displays using crop or scale modes. More...
 
(void) - setCompositingOperation:
 Set the Quartz composition mode to use when compositing the image. More...
 
(void) - setImage:
 Sets the object's image. More...
 
(void) - setImageCroppingOptions:
 Set the display mode for the object - crop image or scale it. More...
 
(void) - setImageData:
 Sets the image from data. More...
 
(void) - setImageDrawsOnTop:
 Set whether the image draws above or below the rendering done by the style. More...
 
(void) - setImageKey:
 Set the object's image key. More...
 
(void) - setImageOffset:
 Set the offset position for the image. More...
 
(void) - setImageOpacity:
 Set the image's opacity. More...
 
(void) - setImageScale:
 Set the scale factor for the image. More...
 
(void) - setImageWithKey:coder:
 Set the object's image from image data in the drawing's image data manager. More...
 
(BOOL- setImageWithPasteboard:
 Set the object's image from image data on the pasteboard. More...
 
(IBAction) - toggleImageAboveAction:
 Toggle between image drawn on top and image drawn below the rest of the style. More...
 
(void) - transferImageKeyToNewContainer:
 Transfer the image key when the object is added to a new container. More...
 
(BOOL- writeImageToPasteboard:
 Place the object's image data on the pasteboard. More...
 
- Instance Methods inherited from DKDrawableShape
(NSInteger- addHotspot:
 
(void) - adjustToFitGrid:
 
(void) - adoptPath:
 
(BOOL- allowSizeKnobsToRotateShape
 
(NSArray *) - breakApart
 
(BOOL- canPastePathWithPasteboard:
 
(NSPoint) - convertPointFromRelativeLocation:
 
(IBAction) - convertToPath:
 
(DKDistortionTransform *) - distortionTransform
 
(void) - drawHotspotAtPoint:inState:
 
(void) - drawHotspotsInState:
 
(void) - drawKnob:
 
(void) - flipHorizontally
 
(void) - flipVertically
 
(DKHotspot *) - hotspotForPartCode:
 
(NSPoint) - hotspotPointForPartcode:
 
(NSRect- hotspotRect:
 
(NSArray *) - hotspots
 
(DKHotspot *) - hotspotUnderMouse:
 
(id- initWithBezierPath:
 
(id- initWithBezierPath:rotatedToAngle:
 
(id- initWithBezierPath:rotatedToAngle:style:
 
(id- initWithBezierPath:style:
 
(id- initWithCanonicalBezierPath:
 
(id- initWithCanonicalBezierPath:style:
 
(id- initWithOvalInRect:
 
(id- initWithOvalInRect:style:
 
(id- initWithRect:
 
(id- initWithRect:style:
 
(NSAffineTransform *) - inverseTransform
 
(NSPoint) - knobPoint:
 
(NSPoint) - locationIgnoringOffset
 
(DKDrawablePath *) - makePath
 
(void) - moveKnob:toPoint:allowRotate:constrain:
 
(NSInteger- operationMode
 
(IBAction) - pastePath:
 
(NSBezierPath *) - path
 
(NSBezierPath *) - path:withFinalSize:offsetBy:fromPartcode:
 Transforms a path to the final size and position relative to a partcode. More...
 
(NSBezierPath *) - pathWithFinalSize:offsetBy:fromPartcode:
 Return a rectangular path offset from a given partcode. More...
 
(NSBezierPath *) - pathWithRelativePosition:finalSize:
 Return a rectangular path with given relative origin but absolute final size. More...
 
(NSBezierPath *) - pathWithRelativeRect:
 Return a rectangular path with given size and origin. More...
 
(NSPoint) - pointForRelativeLocation:
 Convert a point from relative coordinates to absolute coordinates. More...
 
(void) - removeHotspot:
 
(void) - resetBoundingBox
 
(IBAction) - resetBoundingBox:
 
(void) - resetBoundingBoxAndRotation
 
(void) - reshapePath
 
(IBAction) - rotate:
 
(void) - rotateUsingReferencePoint:constrain:
 
(NSPoint) - rotationKnobPoint
 
(void) - setDistortionTransform:
 
(IBAction) - setDistortMode:
 
(void) - setDragAnchorToPart:
 
(void) - setHotspots:
 
(void) - setOperationMode:
 
(void) - setPath:
 
(IBAction) - toggleHorizontalFlip:
 
(IBAction) - toggleVerticalFlip:
 
(NSAffineTransform *) - transform
 Return a transform that maps the object's stored path to its true location in the drawing. More...
 
(NSBezierPath *) - transformedPath
 
(NSAffineTransform *) - transformIncludingParent
 
(NSString *) - undoActionNameForPartCode:
 
(IBAction) - unrotate:
 
- Instance Methods inherited from DKDrawableObject
(void) - addMetadata:
 
(void) - addUserInfo:
 
(NSSet *) - allRegisteredStyles
 
(NSSet *) - allStyles
 
(CGFloat- angle
 
(CGFloat- angleInDegrees
 Return the shape's current rotation angle. More...
 
(NSRect- apparentBounds
 
(void) - applyTransform:
 Apply the transform to the object. More...
 
(NSRect- bounds
 
(NSImage *) - cachedImage
 Returns an image of the object representing its current appearance at 100% scale. More...
 
(NSColor *) - colourForKey:
 
(id< DKDrawableContainer >) - container
 Returns the immediate parent of this object. More...
 
(NSAffineTransform *) - containerTransform
 Return the container's transform. More...
 
(CGFloat- convertLength:
 
(NSPoint) - convertPointToDrawing:
 
(IBAction) - copyDrawingStyle:
 
(void) - creationTool:willBeginCreationAtPoint:
 
(void) - creationTool:willEndCreationAtPoint:
 
(NSView *) - currentView
 
(NSCursor *) - cursorForPartcode:mouseButtonDown:
 
(void) - detachStyle
 If the object's style is currently sharable, copy it and make it non-sharable. More...
 
(void) - drawContent
 
(void) - drawContentInRect:fromRect:withStyle:
 
(void) - drawContentWithSelectedState:
 
(void) - drawContentWithStyle:
 
(void) - drawGhostedContent
 
(DKDrawing *) - drawing
 
(void) - drawSelectedState
 
(void) - drawSelectionPath:
 
(NSSize) - extraSpaceNeeded
 
(CGFloat- floatValueForKey:
 
(NSUInteger- geometryChecksum
 
(void) - group:willUngroupObjectWithTransform:
 This object is being ungrouped from a group. More...
 
(void) - groupWillAddObject:
 This object is being added to a group. More...
 
(BOOL- hasMetadataForKey:
 
(NSInteger- hitPart:
 
(NSInteger- hitSelectedPart:forSnapDetection:
 
(NSUInteger- indexInContainer
 Returns the index position of this object in its container layer. More...
 
(id- initWithStyle:
 Initializes the drawable to have the style given. More...
 
(BOOL- intersectsRect:
 
(NSInteger- intValueForKey:
 
(void) - invalidateRenderingCache
 Discard all cached rendering information. More...
 
(BOOL- isBeingHitTested
 Is a hit-test in progress. More...
 
(BOOL- isGhosted
 Retuirn whether the object is ghosted rather than with its full style. More...
 
(BOOL- isKeyObject
 Is the object currently the layer's key object? More...
 
(BOOL- isPendingObject
 Is the object currently a pending object? More...
 
(BOOL- isSelected
 
(BOOL- isTrackingMouse
 
(DKKnobType) - knobTypeForPartCode:
 
(DKObjectOwnerLayer *) - layer
 Returns the layer that this object ultimately belongs to. More...
 
(NSPoint) - location
 
(BOOL- locationLocked
 Whether the object's location is locked or not. More...
 
(IBAction) - lock:
 
(BOOL- locked
 
(IBAction) - lockLocation:
 
(NSRect- logicalBounds
 
(NSMenu *) - menu
 Reurn the menu to use as the object's contextual menu. More...
 
(NSMutableDictionary *) - metadata
 
(NSUInteger- metadataChecksum
 
(void) - metadataDidChangeKey:
 
(DKMetadataItem *) - metadataItemForKey:
 
(DKMetadataItem *) - metadataItemForKey:limitToLocalSearch:
 
(NSArray *) - metadataItemsForKeysInArray:
 
(NSArray *) - metadataItemsForKeysInArray:limitToLocalSearch:
 
(NSArray *) - metadataKeys
 
(id- metadataObjectForKey:
 
(void) - metadataWillChangeKey:
 
(void) - mouseDoubleClickedAtPoint:inPart:event:
 
(void) - mouseDownAtPoint:inPart:event:
 
(void) - mouseDraggedAtPoint:inPart:event:
 
(NSSize) - mouseDragOffset
 
(BOOL- mouseHasMovedSinceStartOfTracking
 
(NSSize) - mouseOffset
 
(BOOL- mouseSnappingEnabled
 
(void) - mouseUpAtPoint:inPart:event:
 
(void) - notifyGeometryChange:
 
(void) - notifyStatusChange
 
(void) - notifyVisualChange
 
(void) - objectDidBecomeSelected
 
(void) - objectIsNoLongerSelected
 
(BOOL- objectIsValid
 
(BOOL- objectMayBecomeSelected
 Is the object able to be selected? More...
 
(void) - objectWasAddedToLayer:
 The object was added to a layer. More...
 
(void) - objectWasRemovedFromLayer:
 The object was removed from the layer. More...
 
(void) - objectWasUngrouped
 This object was ungrouped from a group. More...
 
(NSSize) - offset
 
(void) - offsetLocationByX:byY:
 
(NSAttributedString *) - originalText
 
(IBAction) - pasteDrawingStyle:
 
(NSData *) - pdf
 Returns the single object rendered as a PDF image. More...
 
(NSPoint) - pointForPartcode:
 
(BOOL- pointHitsPath:
 Test a point against the offscreen bitmap representation of the shape. More...
 
(BOOL- populateContextualMenu:
 
(BOOL- populateContextualMenu:atPoint:
 
(void) - readSupplementaryDataFromPasteboard:
 Read additional data from the pasteboard specific to the object. More...
 
(BOOL- rectHitsPath:
 Test if a rect encloses any of the shape's actual pixels. More...
 
(void) - removeMetadataForKey:
 
(NSBezierPath *) - renderingPath
 
(void) - replaceMatchingStylesFromSet:
 
(void) - resetOffset
 
(void) - resizeWidthBy:heightBy:
 
(void) - rotateByAngle:
 Rotate the shape by adding a delta angle to the current angle. More...
 
(DKMetadataSchema) - schema
 
(void) - setAngle:
 Set the object's current angle in radians. More...
 
(void) - setBeingHitTested:
 Set whether a hit-test in progress. More...
 
(void) - setColour:forKey:
 
(void) - setContainer:
 
(void) - setFloatValue:forKey:
 
(void) - setGhosted:
 Set whether the object is ghosted rather than with its full style. More...
 
(void) - setIntValue:forKey:
 
(void) - setLocation:
 
(void) - setLocationLocked:
 Sets whether the object's location is locked or not. More...
 
(void) - setLocked:
 
(void) - setMetadata:
 
(void) - setMetadataItem:forKey:
 
(void) - setMetadataItemType:forKey:
 
(void) - setMetadataItemValue:forKey:
 
(void) - setMetadataObject:forKey:
 
(void) - setMouseDragOffset:
 
(void) - setMouseHasMovedSinceStartOfTracking:
 
(void) - setMouseSnappingEnabled:
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsDisplayInRects:
 
(void) - setNeedsDisplayInRects:withExtraPadding:
 
(void) - setOffset:
 
(void) - setOriginalText:
 
(void) - setSize:
 
(void) - setSize:forKey:
 
(void) - setString:forKey:
 
(void) - setStyle:
 
(void) - setTrackingMouse:
 
(void) - setupMetadata
 
(void) - setUserInfo:
 
(void) - setUserInfoObject:forKey:
 Set an item of user info. More...
 
(void) - setVisible:
 
(NSSize) - size
 
(NSSize) - sizeForKey:
 
(NSPoint) - snappedMousePoint:forSnappingPointsWithControlFlag:
 
(NSPoint) - snappedMousePoint:withControlFlag:
 Offset the point to cause snap to grid + guides accoding to the drawing's settings. More...
 
(NSArray *) - snappingPoints
 
(NSArray *) - snappingPointsWithOffset:
 
(NSString *) - stringForKey:
 
(DKStyle *) - style
 
(void) - styleDidChange:
 
(void) - styleWillChange:
 
(NSSet *) - subSelection
 Return the subselection of the object. More...
 
(NSImage *) - swatchImageWithSize:
 
(NSUndoManager *) - undoManager
 
(IBAction) - unlock:
 
(IBAction) - unlockLocation:
 
(void) - updateMetadataKeys
 
(void) - updateRulerMarkers
 
(BOOL- useLowQualityDrawing
 
(NSMutableDictionary *) - userInfo
 Return the attached user info. More...
 
(id- userInfoObjectForKey:
 Return an item of user info. More...
 
(BOOL- visible
 
(void) - willBeAddedAsSubstituteFor:toLayer:
 Some high-level operations substitute a new object in place of an existing one (or several). More...
 
(void) - writeSupplementaryDataToPasteboard:
 Write additional data to the pasteboard specific to the object. More...
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(NSColor *) - colourValue
 
(id- copy
 
(void) - dealloc
 
(id- deepCopy
 
(NSDictionary *) - dimensionValuesForArrowStroke:
 
(CGFloat- drawing:convertDistanceToExternalCoordinates:
 
(NSPoint) - drawing:convertLocationToExternalCoordinates:
 
(void) - drawing:didDrawRect:inView:
 
(void) - drawing:willDrawRect:inView:
 
(NSString *) - drawing:willReturnAbbreviationForUnit:
 
(NSString *) - drawing:willReturnFormattedCoordinateForDistance:
 
(CGFloat- drawingWillReturnUnitToPointsConversonFactor:
 
(void) - finalize
 
(NSString *) - hexString
 
(void) - hotspot:didEndTrackingWithEvent:inView:
 
(void) - hotspot:isTrackingWithEvent:inView:
 
(void) - hotspot:willBeginTrackingWithEvent:inView:
 
(NSImage *) - imageResourceNamed:
 
(id- init
 
(id- initWithExpression:
 
(id- instantiateObjectWithShortName:parameters:
 
(BOOL- isLiteralValue
 
(void) - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset:
 
(void) - menuItem:wasAddedForObject:inCategory:
 
(BOOL- moveObjectTo:position:slope:userInfo:
 
(id- mutableCopy
 
(void) - oneShotComplete
 
(void) - oneShotHasReached:
 
(void) - oneShotWillBegin
 
(void) - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo:
 
(id- placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo:
 
(id- placeObjectAtPoint:onPath:position:slope:userInfo:
 
(NSPoint) - point
 
(NSPoint) - pointForTextLayout
 
(DKStyle *) - registry:shouldReplaceStyle:withStyle:
 
(NSBezierPath *) - renderer:willRenderPath:
 
(void) - routeFinder:progressHasReached:
 
(void) - setValue:forNumericParameter:
 
(NSString *) - stringValue
 
(CGFloat- taperFactorAtDistance:onPath:ofLength:
 
(void) - toolDidPerformUndoableAction:
 
(void) - toolWillPerformUndoableAction:
 
(NSURL *) - url
 
- Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Instance Methods inherited from <NSKeyValueBindingCreation>
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - exposedBindings
 
(NSDictionary *) - infoForBinding:
 
(NSArray *) - optionDescriptionsForBinding:
 
(void) - unbind:
 
(Class- valueClassForBinding:
 
- Instance Methods inherited from <DKStorableObject>
(NSUInteger- index
 
(BOOL- isMarked
 
(void) - setIndex:
 
(void) - setMarked:
 
(void) - setStorage:
 
(id< DKObjectStorage >) - storage
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 
- Instance Methods inherited from <NSCopying>
(id- copyWithZone:
 
- Instance Methods inherited from <DKRenderable>
(NSMutableDictionary *) - renderingCache
 

Class Methods

(DKStyle *) + imageShapeDefaultStyle
 
- Class Methods inherited from DKDrawableShape
(NSCursor *) + cursorForShapePartcode:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:rotatedToAngle:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:rotatedToAngle:withStyle:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:withStyle:
 
(DKDrawableShape *) + drawableShapeWithCanonicalBezierPath:
 
(DKDrawableShape *) + drawableShapeWithOvalInRect:
 
(DKDrawableShape *) + drawableShapeWithRect:
 
(NSInteger+ knobMask
 Return which particular knobs are used by instances of this class. More...
 
(void) + setAngularConstraintAngle:
 
(void) + setInfoWindowBackgroundColour:
 
(void) + setKnobMask:
 
(NSRect+ unitRectAtOrigin
 
- Class Methods inherited from DKDrawableObject
(Class+ classForConversionRequestFor:
 Return the class to use in place of the given class when performing a conversion. More...
 
(NSUInteger+ countOfNativeObjectsOnPasteboard:
 Return the number of native objects held by the pasteboard. More...
 
(BOOL+ displaysSizeInfoWhenDragging
 Return whether an info floater is displayed when resizing an object. More...
 
(NSColor *) + ghostColour
 Return the outline colour to use when drawing objects in their ghosted state. More...
 
(NSInteger+ initialPartcodeForObjectCreation
 
(NSDictionary *) + interconversionTable
 Return the interconversion table. More...
 
(BOOL+ isGroupable
 Return whether obejcts of this class can be grouped. More...
 
(BOOL+ metadataChangesAreUndoable
 
(NSArray *) + nativeObjectsFromPasteboard:
 
(NSArray *) + pasteboardTypesForOperation:
 
(void) + setDisplaysSizeInfoWhenDragging:
 Set whether an info floater is displayed when resizing an object. More...
 
(void) + setGhostColour:
 Set the outline colour to use when drawing objects in their ghosted state. More...
 
(void) + setInterconversionTable:
 Return the interconversion table. More...
 
(void) + setMetadataChangesAreUndoable:
 
(void) + substituteClass:forClass:
 Sets the class to use in place of the a base class when performing a conversion. More...
 
(NSRect+ unionOfBoundsOfDrawablesInArray:
 Returns the union of the bounds of the objects in the array. More...
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Additional Inherited Members

- Protected Attributes inherited from DKDrawableShape
BOOL m_inRotateOp
 
NSRect mBoundsCache
 
- Protected Attributes inherited from DKDrawableObject
BOOL m_clipToBBox: 1
 
BOOL m_showBBox: 1
 
BOOL m_showPartcodes: 1
 
BOOL m_showTargets: 1
 
BOOL m_unused_padding: 4
 

Detailed Description

DKImageShape is a drawable shape that displays an image.

DKImageShape is a drawable shape that displays an image. The image is scaled and rotated to the path bounds and clipped to the path. The opacity of the image can be set, and whether the image is drawn before or after the normal path rendering.

This object is quite flexible - by changing the path clipping and drawing styles, a very wide range of different effects are possible. (n.b. if you don't attach a style, the path is not drawn at all [the default], but still clips the image. The default path is a rect so that the entire image is drawn.

There are two basic modes of operation - scaling and cropping. Scaling fills the shape's bounds with the image. Cropping keeps the image at its original size and allows the path to clip it as it is resized. In both cases the image offset can be used to position the image within the bounds. A hotspot is added to allow the user to drag the image offset position around.

Image shapes automatically manage image data efficiently, such that if there is more than one shape with the same image, only one copy of the data is maintained, and that data is the original compressed data from the file (if it did come from a file). This data sharing is facilitated by a central DKImageDataManager object, which is managed by the drawing. Note that using certian operations, such as creating the shape with an NSImage will bypass this benefit.

Method Documentation

- (NSCompositingOperation) compositingOperation

Get the Quartz composition mode to use when compositing the image.

Default is NSCompositeSourceAtop

Returns
an NSCompositingOperation constant
- (IBAction) copyImage: (id sender

Copy the image directly to the pasteboard.

A normal "Copy" does place an image of the object on the pb, but that is the whole object with all style elements based on the bounds. For some work, such as uing images for pattern fills, that's not appropriate, so this action allows you to extract the internal image.

Parameters
senderthe message sender
- (IBAction) fitToImage: (id sender

Resizes the shape to exactly fit the image at its original size.

Cropped images remain in the same visual location that they are currently at, with the shape's frame moved to fit around it exactly. Scaled images are resized to the original size and the object's location remains the same. A side effect is to reset any offset, image offset, but not the angle.

Parameters
senderthe message sender
- (NSImage*) image

Get the object's image.

Returns
the image
- (NSImage*) imageAtRenderedSize

Get a copy of the object's image scaled to the same size, angle and aspect ratio as the image drawn.

This also applies the path clipping, if any

Returns
the image
- (DKImageCroppingOptions) imageCroppingOptions

Get the display mode for the object - crop image or scale it.

The default is scale.

Returns
a mode value
- (NSData*) imageData

Returns the image original data.

This returns either the locally retained original data, or the data held by the image manager. In either case the data returned is the original data from which the image was created. If the image was set directly and not from data, and the key is unknown to the image manager, returns nil.

Returns
data containing image data

Reimplemented from NSObject.

- (BOOL) imageDrawsOnTop

Whether the image draws above or below the rendering done by the style.

Default is NO

Returns
YES to draw on top (after) the style, NO to draw below (before)
- (NSString*) imageKey

Return the object's image key.

Returns
the image's key
- (NSPoint) imageOffset

Get the offset position for the image.

The default is 0,0. The value is the distance in points from the top, left corner of the shape's bounds to the top, left corner of the image

Returns
the image offset
- (CGFloat) imageOpacity

Get the image's opacity.

Default is 1.0

Returns
<opacity> an opacity value from 0.0 (fully transparent) to 1.0 (fully opaque)
- (CGFloat) imageScale

Get the scale factor for the image.

This is not currently implemented - images scale to fit the bounds when in scale mode, and are drawn at their native size in crop mode.

Returns
the scale
+ (DKStyle*) imageShapeDefaultStyle
- (id) initWithContentsOfFile: (NSString *)  filepath

Initializes the image shape from an image file given by the path.

The original name and path of the image is recorded in the object's metadata. This extracts the original data which allows the image to be efficiently stored.

Parameters
filepaththe path to an image file on disk
Returns
the object if it was successfully initialized, or nil
- (id) initWithImage: (NSImage *)  anImage

Initializes the image shape from an image.

The object's metdata also record's the image's original size

Parameters
anImagea valid image object
Returns
the object if it was successfully initialized, or nil
- (id) initWithImageData: (NSData *)  imageData

Initializes the image shape from image data.

This method is preferred where data is available as it allows the original data to be cached very efficiently by the document's image data manager. This maintains quality and keeps file sizes to a minimum.

Parameters
imageDataimage data of some kind
Returns
the object if it was successfully initialized, or nil
- (IBAction) pasteImage: (id sender

Replace the shape's image with one from the pasteboard if possible.

Parameters
senderthe message sender
- (IBAction) selectCropOrScaleAction: (id sender

Select whether the object displays using crop or scale modes.

This action method uses the sender's tag value as the cropping mode to set. It can be connected directly to a menu item with a suitable tag set for example.

Parameters
senderthe message sender
- (void) setCompositingOperation: (NSCompositingOperation)  op

Set the Quartz composition mode to use when compositing the image.

Default is NSCompositeSourceAtop

Parameters
opan NSCompositingOperation constant
- (void) setImage: (NSImage *)  anImage

Sets the object's image.

The shape's path, size, angle, etc. are not changed by this method

Parameters
anImagean image to display in this shape.
- (void) setImageCroppingOptions: (DKImageCroppingOptions)  crop

Set the display mode for the object - crop image or scale it.

The default is scale.

Parameters
cropa mode value
- (void) setImageData: (NSData *)  data

Sets the image from data.

This method liases with the image manager so that the image key is correctly recorded or assigned as needed.

Parameters
datadata containing image data
- (void) setImageDrawsOnTop: (BOOL onTop

Set whether the image draws above or below the rendering done by the style.

Default is NO

Parameters
onTopYES to draw on top (after) the style, NO to draw below (before)
- (void) setImageKey: (NSString *)  key

Set the object's image key.

This is called by other methods as necessary. It currently simply retains the key.

Parameters
keythe image's key
- (void) setImageOffset: (NSPoint)  imgoff

Set the offset position for the image.

The default is 0,0. The value is the distance in points from the top, left corner of the shape's bounds to the top, left corner of the image

Parameters
imgoffthe offset position
- (void) setImageOpacity: (CGFloat opacity

Set the image's opacity.

The default is 1.0

Parameters
opacityan opacity value from 0.0 (fully transparent) to 1.0 (fully opaque)
- (void) setImageScale: (CGFloat scale

Set the scale factor for the image.

This is not currently implemented - images scale to fit the bounds when in scale mode, and are drawn at their native size in crop mode.

Parameters
scalea scaling value, 1.0 = 100%
- (void) setImageWithKey: (NSString *)  key
coder: (NSCoder *)  coder 

Set the object's image from image data in the drawing's image data manager.

The object must usually have been added to a drawing before this is called, so that it can locate the image data manager to use. However, during dearchiving this isn't the case so the coder itself can return a reference to the image manager.

Parameters
keythe image's key
coderthe dearchiver in use, if any.
- (BOOL) setImageWithPasteboard: (NSPasteboard *)  pb

Set the object's image from image data on the pasteboard.

This first tries to use the image data manager to handle the pasteboard, so that the image is efficiently cached. If that doesn't work, falls back to the original direct approach.

Parameters
pbthe pasteboard
Returns
YES if the operation succeeded, NO otherwise
- (IBAction) toggleImageAboveAction: (id sender

Toggle between image drawn on top and image drawn below the rest of the style.

Parameters
senderthe message sender
- (void) transferImageKeyToNewContainer: (id< DKDrawableContainer >)  container

Transfer the image key when the object is added to a new container.

Called as necessary by other methods

Parameters
containerthe new container
- (BOOL) writeImageToPasteboard: (NSPasteboard *)  pb

Place the object's image data on the pasteboard.

Adds the image data in a variety of forms to the pasteboard - raw data (as file content type) TIFF and PDF formats.

Parameters
pbthe pasteboard
Returns
YES if the operation succeeded, NO otherwise