- The manufacturer also assigns a unique hexadecimal value in the remaining bytes. 6 bytes MAC address = 3 bytes OUI number obtained from the IEEE + 3 bytes unique number assigned by the manufacturer. MAC addresses of all NICs or onboard NIC devices manufactured by the same manufacturer always start with the same 3-bytes OUI numbers.
- An interesting article in the design process of Windows Vista and Mac OS X. One of the comments had a link to a video superimposing a presentation about Windows Vista’s upcoming features with all the features that Mac OS X has right now.
A graphics context represents a drawing destination. It contains drawing parameters and all device-specific information that the drawing system needs to perform any subsequent drawing commands. A graphics context defines basic drawing attributes such as the colors to use when drawing, the clipping area, line width and style information, font information, compositing options, and several others.
Latest Mac OS posts from Bytes community of Mac OS developers and programmers. Last reply: Jul 20 '14 by hbbauer2 macos. Web.config on Mac Safari. Sysintegrity Anti-malware 1.3.1 Mac OS 10.11 El Capitan crack: Emsisoft Anti-malware 6.0.0.31 Mac OS El Capitan keymaker: A Squared Anti Malware 4.0.0.73 Mac OS 10.10 cracks: Free Anti Malware Programs/nelly OS X serial keygen: Emsisoft Anti-malware 6.0.0.35 Mac OS 10 serial keygen: C O.m O.d O Bo Clean Anti-malware Mac OS 10.11 serial keygen.
You can obtain a graphics context by using Quartz context creation functions or by using higher-level functions provided by one of the Mac OS X frameworks or the UIKit framework in iOS. Quartz provides functions for various flavors of Quartz graphics contexts including bitmap and PDF, which you can use to create custom content.
This chapter shows you how to create a graphics context for a variety of drawing destinations. A graphics context is represented in your code by the data type
CGContextRef
, which is an opaque data type. After you obtain a graphics context, you can use Quartz 2D functions to draw to the context, perform operations (such as translations) on the context, and change graphics state parameters, such as line width and fill color.Drawing to a View Graphics Context in iOS
To draw to the screen in an iOS application, you set up a
UIView
object and implement its drawRect:
method to perform drawing. The view’s drawRect:
method is called when the view is visible onscreen and its contents need updating. Before calling your custom drawRect:
method, the view object automatically configures its drawing environment so that your code can start drawing immediately. As part of this configuration, the UIView
object creates a graphics context (a CGContextRef
opaque type) for the current drawing environment. You obtain this graphics context in your drawRect:
method by calling the UIKit function UIGraphicsGetCurrentContext
.The default coordinate system used throughout UIKit is different from the coordinate system used by Quartz. In UIKit, the origin is in the upper-left corner, with the positive-y value pointing downward. The
UIView
object modifies the CTM of the Quartz graphics context to match the UIKit conventions by translating the origin to the upper left corner of the view and inverting the y-axis by multiplying it by -1
. For more information on modified-coordinate systems and the implications in your own drawing code, see Quartz 2D Coordinate Systems.UIView
objects are described in detail in View Programming Guide for iOS.Creating a Window Graphics Context in Mac OS X
When drawing in Mac OS X, you need to create a window graphics context that’s appropriate for the framework you are using. The Quartz 2D API itself provides no functions to obtain a windows graphics context. Instead, you use the Cocoa framework to obtain a context for a window created in Cocoa.
You obtain a Quartz graphics context from within the
drawRect:
routine of a Cocoa application using the following line of code:The method
currentContext
returns the NSGraphicsContext
instance of the current thread. The method graphicsPort
returns the low-level, platform-specific graphics context represented by the receiver, which is a Quartz graphics context. (Don’t get confused by the method names; they are historical.) For more information see NSGraphicsContext Class Reference.After you obtain the graphics context, you can call any of the Quartz 2D drawing functions in your Cocoa application. You can also mix Quartz 2D calls with Cocoa drawing calls. You can see an example of Quartz 2D drawing to a Cocoa view by looking at Figure 2-1. The drawing consists of two overlapping rectangles, an opaque red one and a partially transparent blue one. You’ll learn more about transparency in Color and Color Spaces. The ability to control how much you can “see through” colors is one of the hallmark features of Quartz 2D.
To create the drawing in Figure 2-1, you first create a Cocoa application Xcode project. In Interface Builder, drag a Custom View to the window and subclass it. Then write an implementation for the subclassed view, similar to what Listing 2-1 shows. For this example, the subclassed view is named
MyQuartzView
. The drawRect:
method for the view contains all the Quartz drawing code. A detailed explanation for each numbered line of code appears following the listing. Note: The
drawRect:
method of the NSView
class is invoked automatically each time the view needs to be drawn. To find out more about overriding the drawRect:
method, see NSView Class Reference.Listing 2-1 Drawing to a window graphics context
Here’s what the code does:
- Obtains a graphics context for the view.
- This is where you insert your drawing code. The four lines of code that follow are examples of using Quartz 2D functions.
- Sets a red fill color that’s fully opaque. For information on colors and alpha (which sets opacity), see Color and Color Spaces.
- Fills a rectangle whose origin is (
0,0
) and whose width is200
and height is100
. For information on drawing rectangles, see Paths. - Sets a blue fill color that’s partially transparent.
- Fills a rectangle whose origin is (
0,0
) and whose width is100
and height is200
.
Creating a PDF Graphics Context
When you create a PDF graphics context and draw to that context, Quartz records your drawing as a series of PDF drawing commands written to a file. You supply a location for the PDF output and a default media box—a rectangle that specifies bounds of the page. Figure 2-2 shows the result of drawing to a PDF graphics context and then opening the resulting PDF in Preview.
The Quartz 2D API provides two functions that create a PDF graphics context:
CGPDFContextCreateWithURL
, which you use when you want to specify the location for the PDF output as a Core Foundation URL. Listing 2-2 shows how to use this function to create a PDF graphics context.CGPDFContextCreate
, which you use when you want the PDF output sent to a data consumer. (For more information see Data Management in Quartz 2D.) Listing 2-3 shows how to use this function to create a PDF graphics context.
A detailed explanation for each numbered line of code follows each listing.
iOS Note: A PDF graphics context in iOS uses the default coordinate system provided by Quartz, without applying a transform to match the UIKit coordinate system. If your application plans on sharing drawing code between your PDF graphics context and the graphics context provided by
UIView
object, your application should modify the CTM of the PDF graphics context to modify the coordinate system. See Quartz 2D Coordinate Systems.Listing 2-2 Calling
CGPDFContextCreateWithURL
to create a PDF graphics contextHere’s what the code does:
- Calls the Core Foundation function to create a CFURL object from the CFString object supplied to the
MyPDFContextCreate
function. You passNULL
as the first parameter to use the default allocator. You also need to specify a path style, which for this example is a POSIX-style pathname. - Calls the Quartz 2D function to create a PDF graphics context using the PDF location just created (as a CFURL object) and a rectangle that specifies the bounds of the PDF. The rectangle (
CGRect
) was passed to theMyPDFContextCreate
function and is the default page media bounding box for the PDF. - Releases the CFURL object.
- Returns the PDF graphics context. The caller must release the graphics context when it is no longer needed.
Listing 2-3 Calling
CGPDFContextCreate
to create a PDF graphics context Here’s what the code does:
- Calls the Core Foundation function to create a CFURL object from the CFString object supplied to the
MyPDFContextCreate
function. You passNULL
as the first parameter to use the default allocator. You also need to specify a path style, which for this example is a POSIX-style pathname. - Creates a Quartz data consumer object using the CFURL object. If you don’t want to use a CFURL object (for example, you want to place the PDF data in a location that can’t be specified by a CFURL object), you can instead create a data consumer from a set of callback functions that you implement in your application. For more information, see Data Management in Quartz 2D.
- Calls the Quartz 2D function to create a PDF graphics context passing as parameters the data consumer and the rectangle (of type
CGRect
) that was passed to theMyPDFContextCreate
function. This rectangle is the default page media bounding box for the PDF. - Releases the data consumer.
- Releases the CFURL object.
- Returns the PDF graphics context. The caller must release the graphics context when it is no longer needed.
Listing 2-4 shows how to call the
MyPDFContextCreate
routine and draw to it. A detailed explanation for each numbered line of code appears following the listing.Listing 2-4 Drawing to a PDF graphics context
Here’s what the code does:
- Declares a variable for the rectangle that you use to define the PDF media box.
- Sets the origin of the media box to
(0,0)
and the width and height to variables supplied by the application. - Calls the function
MyPDFContextCreate
(See Listing 2-3) to obtain a PDF graphics context, supplying a media box and a pathname. The macroCFSTR
converts a string to aCFStringRef
data type. - Sets up a dictionary with the page options. In this example, only the media box is specified. You don’t have to pass the same rectangle you used to set up the PDF graphics context. The media box you add here supersedes the rectangle you pass to set up the PDF graphics context.
- Signals the start of a page. This function is used for page-oriented graphics, which is what PDF drawing is.
- Calls Quartz 2D drawing functions. You replace this and the following four lines of code with the drawing code appropriate for your application.
- Signals the end of the PDF page.
- Releases the dictionary and the PDF graphics context when they are no longer needed.
You can write any content to a PDF that’s appropriate for your application—images, text, path drawing—and you can add links and encryption. For more information see PDF Document Creation, Viewing, and Transforming.
Creating a Bitmap Graphics Context
A bitmap graphics context accepts a pointer to a memory buffer that contains storage space for the bitmap. When you paint into the bitmap graphics context, the buffer is updated. After you release the graphics context, you have a fully updated bitmap in the pixel format you specify.
Note: Bitmap graphics contexts are sometimes used for drawing offscreen. Before you decide to use a bitmap graphics context for this purpose, see Core Graphics Layer Drawing. CGLayer objects (
CGLayerRef
) are optimized for offscreen drawing because, whenever possible, Quartz caches layers on the video card. iOS Note: iOS applications should use the function
UIGraphicsBeginImageContextWithOptions
instead of using the low-level Quartz functions described here. If your application creates an offscreen bitmap using Quartz, the coordinate system used by bitmap graphics context is the default Quartz coordinate system. In contrast, if your application creates an image context by calling the function UIGraphicsBeginImageContextWithOptions
, UIKit applies the same transformation to the context’s coordinate system as it does to a UIView
object’s graphics context. This allows your application to use the same drawing code for either without having to worry about different coordinate systems. Although your application can manually adjust the coordinate transformation matrix to achieve the correct results, in practice, there is no performance benefit to doing so.You use the function
CGBitmapContextCreate
to create a bitmap graphics context. This function takes the following parameters:data
. Supply a pointer to the destination in memory where you want the drawing rendered. The size of this memory block should be at least (bytesPerRow
*height
) bytes.width
. Specify the width, in pixels, of the bitmap.height
. Specify the height, in pixels, of the bitmap.bitsPerComponent
. Specify the number of bits to use for each component of a pixel in memory. For example, for a 32-bit pixel format and an RGB color space, you would specify a value of 8 bits per component. See Supported Pixel Formats.bytesPerRow
. Specify the number of bytes of memory to use per row of the bitmap.Tip: When you create a bitmap graphics context, you’ll get the best performance if you make sure the data andbytesPerRow
are 16-byte aligned.colorspace
. The color space to use for the bitmap context. You can provide a Gray, RGB, CMYK, or NULL color space when you create a bitmap graphics context. For detailed information on color spaces and color management principles, see Color Management Overview. For information on creating and using color spaces in Quartz, see Color and Color Spaces. For information about supported color spaces, see Color Spaces and Bitmap Layout in the Bitmap Images and Image Masks chapter.bitmapInfo
. Bitmap layout information, expressed as aCGBitmapInfo
constant, that specifies whether the bitmap should contain an alpha component, the relative location of the alpha component (if there is one) in a pixel, whether the alpha component is premultiplied, and whether the color components are integer or floating-point values. For detailed information on what these constants are, when each is used, and Quartz-supported pixel formats for bitmap graphics contexts and images, see Color Spaces and Bitmap Layout in the Bitmap Images and Image Masks chapter.
Listing 2-5 shows how to create a bitmap graphics context. When you draw into the resulting bitmap graphics context, Quartz records your drawing as bitmap data in the specified block of memory. A detailed explanation for each numbered line of code follows the listing.
Listing 2-5 Creating a bitmap graphics context
Here’s what the code does:
- Declares a variable to represent the number of bytes per row. Each pixel in the bitmap in this example is represented by 4 bytes; 8 bits each of red, green, blue, and alpha.
- Creates a generic RGB color space. You can also create a CMYK color space. See Color and Color Spaces for more information and for a discussion of generic color spaces versus device dependent ones.
- Calls the
calloc
function to create and clear a block of memory in which to store the bitmap data. This example creates a 32-bit RGBA bitmap (that is, an array with 32 bits per pixel, each pixel containing 8 bits each of red, green, blue, and alpha information). Each pixel in the bitmap occupies 4 bytes of memory. In Mac OS X 10.6 and iOS 4, this step can be omitted—if you passNULL
as bitmap data, Quartz automatically allocates space for the bitmap. - Creates a bitmap graphics context, supplying the bitmap data, the width and height of the bitmap, the number of bits per component, the bytes per row, the color space, and a constant that specifies whether the bitmap should contain an alpha channel and its relative location in a pixel. The constant
kCGImageAlphaPremultipliedLast
indicates that the alpha component is stored in the last byte of each pixel and that the color components have already been multiplied by this alpha value. See The Alpha Value for more information on premultiplied alpha. - If the context isn’t created for some reason, frees the memory allocated for the bitmap data.
- Releases the color space.
- Returns the bitmap graphics context. The caller must release the graphics context when it is no longer needed.
Listing 2-6 shows code that calls
MyCreateBitmapContext
to create a bitmap graphics context, uses the bitmap graphics context to create a CGImage
object, then draws the resulting image to a window graphics context. Figure 2-3 shows the image drawn to the window. A detailed explanation for each numbered line of code follows the listing. Listing 2-6 Drawing to a bitmap graphics context
Here’s what the code does:
- Declares a variable to store the origin and dimensions of the bounding box into which Quartz will draw an image created from the bitmap graphics context.
- Sets the origin of the bounding box to
(0,0)
and the width and height to variables previously declared, but whose declaration are not shown in this code. - Calls the application-supplied function
MyCreateBitmapContext
(see Listing 2-5) to create a bitmap context that is 400 pixels wide and 300 pixels high. You can create a bitmap graphics context using any dimensions that are appropriate for your application. - Calls Quartz 2D functions to draw into the bitmap graphics context. You would replace this and the next four lines of code with drawing code appropriate for your application.
- Creates a Quartz 2D image (
CGImageRef
) from the bitmap graphics context. - Draws the image into the location in the window graphics context that is specified by the bounding box. The bounding box specifies the location and dimensions in user space in which to draw the image.This example does not show the creation of the window graphics context. See Creating a Window Graphics Context in Mac OS X for information on how to create one.
- Gets the bitmap data associated with the bitmap graphics context.
- Releases the bitmap graphics context when it is no longer needed.
- Free the bitmap data if it exists.
- Releases the image when it is no longer needed.
Supported Pixel Formats
Table 2-1 summarizes the pixel formats that are supported for bitmap graphics context, the associated color space (
cs
), and the version of Mac OS X in which the format was first available. The pixel format is specified as bits per pixel (bpp) and bits per component (bpc). The table also includes the bitmap information constant associated with that pixel format. See CGImage Reference for details on what each of the bitmap information format constants represent.CS | Pixel format and bitmap information constant | Availability |
---|---|---|
Null | 8 bpp, 8 bpc, kCGImageAlphaOnly | Mac OS X, iOS |
Gray | 8 bpp, 8 bpc, kCGImageAlphaNone | Mac OS X, iOS |
Gray | 8 bpp, 8 bpc, kCGImageAlphaOnly | Mac OS X, iOS |
Gray | 16 bpp, 16 bpc, kCGImageAlphaNone | Mac OS X |
Gray | 32 bpp, 32 bpc, kCGImageAlphaNone |kCGBitmapFloatComponents | Mac OS X |
RGB | 16 bpp, 5 bpc, kCGImageAlphaNoneSkipFirst | Mac OS X, iOS |
RGB | 32 bpp, 8 bpc, kCGImageAlphaNoneSkipFirst | Mac OS X, iOS |
RGB | 32 bpp, 8 bpc, kCGImageAlphaNoneSkipLast | Mac OS X, iOS |
RGB | 32 bpp, 8 bpc, kCGImageAlphaPremultipliedFirst | Mac OS X, iOS |
RGB | 32 bpp, 8 bpc, kCGImageAlphaPremultipliedLast | Mac OS X, iOS |
RGB | 64 bpp, 16 bpc, kCGImageAlphaPremultipliedLast | Mac OS X |
RGB | 64 bpp, 16 bpc, kCGImageAlphaNoneSkipLast | Mac OS X |
RGB | 128 bpp, 32 bpc, kCGImageAlphaNoneSkipLast |kCGBitmapFloatComponents | Mac OS X |
RGB | 128 bpp, 32 bpc, kCGImageAlphaPremultipliedLast |kCGBitmapFloatComponents | Mac OS X |
CMYK | 32 bpp, 8 bpc, kCGImageAlphaNone | Mac OS X |
CMYK | 64 bpp, 16 bpc, kCGImageAlphaNone | Mac OS X |
CMYK | 128 bpp, 32 bpc, kCGImageAlphaNone |kCGBitmapFloatComponents | Mac OS X |
Anti-Aliasing
Bitmap graphics contexts support anti-aliasing, which is the process of artificially correcting the jagged (or aliased) edges you sometimes see in bitmap images when text or shapes are drawn. These jagged edges occur when the resolution of the bitmap is significantly lower than the resolution of your eyes. To make objects appear smooth in the bitmap, Quartz uses different colors for the pixels that surround the outline of the shape. By blending the colors in this way, the shape appears smooth. You can see the effect of using anti-aliasing in Figure 2-4. You can turn anti-aliasing off for a particular bitmap graphics context by calling the function
CGContextSetShouldAntialias
. The anti-aliasing setting is part of the graphics state.You can control whether to allow anti-aliasing for a particular graphics context by using the function
CGContextSetAllowsAntialiasing
. Pass true
to this function to allow anti-aliasing; false
not to allow it. This setting is not part of the graphics state. Quartz performs anti-aliasing when the context and the graphic state settings are set to true
.Obtaining a Graphics Context for Printing
Cocoa applications in Mac OS X implement printing through custom
NSView
subclasses. A view is told to print by invoking its print:
method. The view then creates a graphics context that targets a printer and calls its drawRect:
method. Your application uses the same drawing code to draw to the printer that it uses to draw to the screen. It can also customize the drawRect:
call to an image to the printer that is different from the one sent to the screen.For a detailed discussion of printing in Cocoa, see Printing Programming Guide for Mac.
Copyright © 2001, 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-03-21
Type code | alis |
---|---|
Uniform Type Identifier (UTI) | com.apple.alias-file |
Magic number | 'book0000mark0000' |
Developed by | Apple, Inc. |
Type of format | shortcut |
In classic Mac OSSystem 7 and later, and in macOS, an alias is a small file that represents another object in a local, remote, or removable[1]file system and provides a dynamic link to it; the target object may be moved or renamed, and the alias will still link to it (unless the original file is recreated; such an alias is ambiguous and how it is resolved depends on the version of macOS). In Windows, a 'shortcut', a file with a .lnk extension, performs a similar function.
It is similar to the Unixsymbolic link, but with the distinction of working even if the target file moves to another location on the same disk (in this case it acts like a hard link, but the source and target of the link may be on different filesystems, and the target of the link may be a directory). As a descendant of BSD, macOS supports Unix symbolic (and hard) links as well.
Function[edit]
An alias acts as a stand-in for any object in the file system, such as a document, an application, a folder, a hard disk, a network share or removable medium or a printer. When double-clicked, the computer will act the same way as if the original file had been double-clicked. Likewise, choosing an alias file from within a 'File Open' dialog box would open the original file. The purpose of an alias is to assist the user in managing large numbers of files by providing alternative ways to access them without having to copy the files themselves. While a typical alias under the classic Mac OS was small, between 1 and 5 KB, under macOS it can be fairly large, more than 5 MB (5000 KB) for the alias to a folder.
Preventing alias failure[edit]
An alias is a dynamic reference to an object. The original may be moved to another place within the same filesystem, without breaking the link. The operating system stores several pieces of information about the original in the resource fork of the alias file. Examples of the information used to locate the original are:
- path
- file ID (inode number)
- directory ID (inode number)
- name
- file size
Since any of these properties can change without the computer's knowledge, as a result of user activity, various search algorithms are used to find the most plausible target. This fault-tolerance sets the alias apart from similar functions in some other operating systems, such as the Unixsymbolic link or the Microsoft Windowsshortcut, at the expense of increased complexity and unpredictability. For example, an application can be moved from one directory to another within the same filesystem, but an existing alias would still launch the same application when double-clicked.
The question can arise of how an alias should work if a file is moved, and then a file is created with the same name as the original moved file, since the alias can be used to locate both the original name and the new location of the original file. With symbolic links the reference is unambiguous (soft links refer to the new file, hard links to the original). Before Mac OS X 10.2, however, such an ambiguous alias would consistently find the original moved file, rather than the recreated file. In Mac OS X 10.2 and later releases, the new file is found, matching the behaviour of symbolic links [1]. macOS applications can programmatically use the old behavior if required.
Aliases are similar in operation to shadows in the graphical Workplace Shell of the OS/2 operating system.
Distinguishing marks[edit]
In System 7 through Mac OS 9, aliases distinguished themselves visually to the user by the fact that their file names were in italics. To accommodate languages that don't have italics (such as Japanese), in Mac OS 8.5 another distinguishing mark was added, badging with an 'alias arrow'—a black arrow with a small white border—similar to that used for shortcuts in Microsoft Windows.
In macOS, the filenames of aliases are not italicized, but the arrow badge remains.
File structure[edit]
The alias files in macOS start by the magic number
62 6F 6F 6B 00 00 00 00 6D 61 72 6B 00 00 00 00
which is in ASCIIbook␀␀␀␀mark␀␀␀␀
(␀ representing the Null character).Following the magic number, it has been reported that an alias has a set of records inside it, each record is 150 bytes long and consists of the fields shown below (all integers are big endian).[2] However, alias files are far larger than this would explain, and include other information at least including icons.[3][4]
- 4 bytes user type name/app creator code = long ASCII text string (none = 0)
- 2 bytes record size = short unsigned total length
- 2 bytes record version = short integer version (current version = 2)
- 2 bytes alias kind = short integer value (file = 0; directory = 1)
- 1 byte volume name string length = byte unsigned length
- 27 bytes volume name string (if volume name string < 27 chars then pad with zeros)
- 4 bytes volume created mac date = long unsigned value in seconds since beginning 1904 to 2040
- 2 bytes volume signature = short unsigned HFS value
- 2 bytes volume type = short integer mac os value (types are Fixed HD = 0; Network Disk = 1; 400kB FD = 2;800kB FD = 3; 1.4MB FD = 4; Other Ejectable Media = 5 )
- 4 bytes parent directory id = long unsigned HFS value
- 1 bytes file name string length = byte unsigned length
- 63 bytes file name string (if file name string < 63 chars then pad with zeros)
- 4 bytes file number = long unsigned HFS value
- 4 bytes file created mac date = long unsigned value in seconds since beginning 1904 to 2040
- 4 bytes file type name = long ASCII text string
- 4 bytes file creator name = long ASCII text string
- 2 bytes nlvl From (directories from alias thru to root) = short integer range
- 2 bytes nlvl To (directories from root thru to source) = short integer range (if alias on different volume then set above to -1)
- 4 bytes volume attributes = long hex flags
- 2 bytes volume file system id = short integer HFS value
- 10 bytes reserved = 80-bit value set to zero
- 4+ bytes optional extra data strings = short integer type + short unsigned string length (types are Extended Info End = -1; Directory Name = 0; Directory IDs = 1; Absolute Path = 2; AppleShare Zone Name = 3; AppleShare Server Name = 4; AppleShare User Name = 5; Driver Name = 6; Revised AppleShare info = 9; AppleRemoteAccess dialup info = 10)
- string data = hex dump
- odd lengths have a 1 byte odd string length pad = byte value set to zero
Alias record structure outside of size length[edit]
The following is for use with the Apple's Alias Resource Manager.
- 4 bytes resource type name = long ASCII text string
- 2 bytes resource ID = short integer value
- 2 bytes resource end pad = short value set to zero
Java code to flag an alias file
There is a github repo with working C++ code here.
Managing aliases[edit]
User interface[edit]
![Last Byte Mac OS Last Byte Mac OS](https://static01.nyt.com/images/2018/07/07/technology/personaltech/07techtipwebART/07techtipwebART-superJumbo.jpg)
In System 7, the only way to create an alias was to select the original and choose 'Make Alias' from the 'File' menu. An alias, with the same name and ' alias' appended would then be created in the same folder. In later versions, it became possible to create aliases by drag-and-drop, while holding down the command and option modifier keys.
Mac OS 8.5 added a feature for re-connecting aliases that had been broken for one reason or another (when the simple search algorithms failed to find a reliable replacement). This was done by selecting a new target through the standard Open File dialog.
In Mac OS 8.5 options were added for command-optiondragging an object in the Finder to create an alias at that location. This is where the alias cursor was added to the system. The cursor mirrors the appearance of the 'create shortcut' cursor on Windows systems.
Programming API[edit]
The Alias Manager API is part of Carbon. It is unknown whether it was present in Mac OS Classic.[5]
Mac OS X 10.6 introduced some alias-related APIs to Cocoa, as a part of
NSURL
.[6]Last Byte Mac Os Catalina
Relation to BSD symbolic and hard links[edit]
Unix and similar operating systems provide 2 features very similar to macOS aliases: symbolic links and hard links. When using the macOS Finder, links are displayed and treated largely like macOS aliases, and even carry an identical 'Kind' attribute. However, when using the shell command line, macOS aliases are not recognized: for example, you cannot use the cd command with the name of an alias file. This is because an alias is implemented as a file on the disk that must be interpreted by an API while links are implemented within the filesystem and are thus functional at any level of the OS.
There is currently no pre-installed command to resolve an alias to the path of the file or directory it refers to. However, a freely available C program makes use of the Mac Carbon APIs to perform this task.[7] Given that, commands such as cd can be set up to check for aliases and treat them just like symbolic or hard links.
References[edit]
- ^Files: Chapter 4 - Alias Manager; Search Strategies — Inside Macintosh developer documentation
- ^Some information about MacOS aliases collected from the web. (reverse engineering effort)
- ^Forum discussion of the large size of aliases.
- ^'Further details, including changes with various Mac OS versions'. Archived from the original on 2013-04-30. Retrieved 2018-10-11.
- ^'Alias Manager'. Apple Developer Documentation.
- ^https://github.com/nathanday/ndalias/issues/3
- ^Davis, Thos. 'getTrueName.c'. Mac OS X Hints. IDG. Retrieved 24 October 2016.
External links[edit]
- System 7 aliases — Article about System 7 aliases, from 1992
Last Byte Mac Os X
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Alias_(Mac_OS)&oldid=1003002174'