Programming with Quartz: 2D and PDF Graphics in Mac OS X
暫譯: 使用 Quartz 編程:在 Mac OS X 中的 2D 和 PDF 圖形

David Gelphman, Bunny Laden

  • 出版商: Morgan Kaufmann
  • 出版日期: 2005-12-14
  • 售價: $3,840
  • 貴賓價: 9.5$3,648
  • 語言: 英文
  • 頁數: 704
  • 裝訂: Paperback
  • ISBN: 0123694736
  • ISBN-13: 9780123694737
  • 相關分類: MAC OS 蘋果電腦
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

相關主題

商品描述

Description

Written by members of the development team at Apple, Programming with Quartz is the first book to describe the sophisticated graphics system of Mac OS X. By using the methods described in this book, developers will be able to fully exploit the state-of-the-art graphics capabilities of Mac OS X in their applications, whether for Cocoa or Carbon development. This book also serves as an introduction to 2D graphics concepts, including how images are drawn and how color is rendered. It includes guidance for working with PDF documents, drawing bitmap graphics, using Quartz built-in color management, and drawing text. Programming with Quartz is a rich resource for new and experienced Mac OS X developers, Cocoa and Carbon programmers, UNIX developers who are migrating to Mac OS X, and anyone interested in powerful 2D graphics systems.

 

Table Of Contents

    Foreword by Philip Schneider

    Preface
    Our Objective
    Outline
    Source Code
    Header Files
    Conventions and Assumptions
    Quartz Technologies
    Acknowledgements

    Chapter 1 Introducing Quartz 2D
    A Bit of History
    Quartz 2D Overview
    What Software Can Use Quartz 2D?
    Summary
    See Also

    Chapter 2 Quartz 2D Drawing Basics
    Quartz Graphics Contexts
    Filling a Rectangle
    Stroking a Rectangle
    The Order of Fill and Stroke Operations
    Transforming the Coordinate System
    Constructing Quartz Paths
    Painting with Alpha
    Making Dashed Lines
    Clipping a Drawing
    Drawing PDF Content
    More About Graphics Contexts
    Summary
    See Also

    Chapter 3 Using Quartz 2D in Cocoa
    Xcode Overview
    Creating a Cocoa Xcode Project in Tiger
    Creating a View in Interface Builder
    Connecting the Interface to the Code
    Obtaining a Graphics Context in Cocoa
    Writing the Drawing Code
    Examining the Drawing Output
    Cocoa Framework Drawing and Quartz
    Summary
    See Also

    Chapter 4 Using Quartz 2D in Carbon
    Creating a Carbon Xcode Project
    Setting Up a Carbon Window
    Creating an Event Handler
    Examining the Drawing Output
    Using QDBeginCGContext
    Summary
    See Also

    Chapter 5 The Quartz Coordinate System and Coordinate Transformations
    User Space and Device Space
    Coordinate Transformations
    The Current Transformation Matrix
    The Mathematics of Affine Transforms
    Saving and Restoring a Coordinate System
    Affine Transform Convenience Functions
    Summary
    See Also

    Chapter 6 Drawing with Paths
    Properties of Paths
      Path Construction Primitives
      Cubic Bézier Curves
      Quadratic Bézier Curves
    Closing Subpaths
    Path Construction Convenience Functions
      Additional Path Convenience Functions (Tiger)
    Stroking Paths
      Line Width
      Line Joins
      Line Caps
      Line Dash
    Filling Paths
    Clipping With Paths
    CGPath Objects (Jaguar and later only)
    Anti-aliasing
    Path Utility Functions
      Aligning User Space Coordinates on Pixel Boundaries
    Summary
    See Also

    Chapter 7 Color, Alpha Transparency, and the Quartz Graphics State
    Color and Color Spaces
      A General Approach to Setting Color
      Calibrated Color Spaces
      Device Color Spaces
      Special Color Spaces
      Creating Color Spaces by Name
      Rendering Intents
    Alpha Transparency
      Blend Modes (Tiger)
    CGColorRef Objects (Panther and later)
    Graphics State Parameters
    Summary
    See Also

    Chapter 8 Data Providers and Data Consumers
    Data Providers
      CGDataProviderCreateWithURL
      CGDataProviderCreateWithData
      CGDataProviderCreate
      CGDataProviderCreateDirectAccess
      CGDataProviderCreateWithCFData (Tiger and later)
    Guidelines for Using Data Providers
    Data Consumers
    Summary

    Chapter 9 Drawing Images
    Creating CGImage Objects
      Specialized Functions for JPEG and PNG
      Drawing Images into a Flipped Coordinate System
      A General Function for Uncompressed Data
      Generalized Functions for Compressed Image Data (Tiger and later)
      Importing Image Data With QuickTime
      Guidelines for Image Creation
    Best Practices for Working With Images
    Image Utility Functions
      Getting Image Dimensions
      Getting the Pixel Format
      Creating an Image from a Bitmap Context
      Working With Color Spaces
      Creating Subimages
    Writing Image Data using CGImageDestination (Tiger)
    Exporting to JPEG Using a QuickTime Exporter
    Summary
    See Also

    Chapter 10 Image Masking
    Creating an Image Mask
      Drawing and Inverting a 1-Bit Image Mask
      Drawing an 8-Bit Deep Mask
    Masking an Image (Tiger)
      Masking an Image with an Image Mask
      Masking an Image with an Image
      Masking Guidelines
    Using Color as a Mask (Tiger)
    Clipping to a Mask (Tiger)
    Summary
    See Also

    Chapter 11 Text
    Text Drawing Parameters
      Font and Font Size
      Text Matrix and Text Position
      Text Drawing Modes
      Font Smoothing (Jaguar)
      Character Spacing
    Drawing Text Using Quartz
      Drawing with Characters
      Drawing with Glyphs
    Drawing Text Using Cocoa
      Using NSString
      Using NSLayoutManager
      Subclassing to Get Additional Control
    Drawing Text Using Carbon
      Using HIThemeDrawTextBox (Panther)
      Using Multilingual Text Engine
      Using Apple Type Services for Unicode Imaging
    Drawing Text in a Flipped Coordinate System
    Summary
    See Also

    Chapter 12 Creating Bits
    Bitmap Graphics Context
      Supported Pixel Formats
      Creating a Bitmap Graphics Context
      Getting Information About a Bitmap Context
      Using the Bitmap Data from a Bitmap Context
    CGLayers (Tiger)
      Creating a CGLayer Object
      Drawing to a CGLayer
      Drawing the Contents of a CGLayer
      Using a CGLayer to Draw a Checkerboard
    Caching Drawing Offscreen
      Drawing Repeatedly Without Caching
      Drawing Repeatedly With Bitmap Context Caching
      Drawing Repeatedly With CGLayer Caching
      Display Profile Issues
    Replacing CopyBits
    Summary
    See Also

    Chapter 13 Opening and Drawing PDF Documents
    PDF Document Properties
    Opening a PDF Document
    Using PDF as a Graphical Interchange
      Creating PDF Data From the Pasteboard: Cocoa
      Creating PDF from the Pasteboard: Carbon
    Drawing PDF Pages
      Drawing With CGContextDrawPDFDocument
      Drawing PDF Documents in a Flipped Coordinate System
      Using CGPDFPage Objects (Panther)
      Drawing with PDF Rotation on Jaguar and Earlier
    Handling Protected PDF Documents (Jaguar)
    PDF Document Utility Functions
    Summary
    See Also

    Chapter 14 Creating and Examining PDF Documents
    Creating New PDF Documents
      Using CGPDFContextCreateWithURL
      Using the Auxiliary Information Dictionary
    Copying PDF Content to the Pasteboard
    Adding Content to Existing PDF Documents
    Adding Links to PDF Documents (Tiger)
      Creating a Link to a URL
      Creating a Link to Another Page in the Document
    Creating Encrypted PDF Output (Tiger)
    PDF Document Generation Issues
    Examining PDF Document Content (Panther, Tiger)
      Quartz PDF Introspection
      Scanning the PDF Content Stream (Tiger)
    Summary
    See Also

    Chapter 15 Advanced Drawing Features
    Drawing with Patterns
      Creating Patterns
      Creating and Drawing Colored Patterns
      Base Space, the Pattern Matrix, and Transforming Patterns
      Pattern Phase
      Creating and Drawing Stencil Patterns
      Drawing Complex Patterns
      Pattern Issues
    Drawing with Shadows (Panther)
      Shadow Attributes
      Creating and Drawing With Shadows
      Shadow Offset and Quartz Base Space
      Shadows and Grouped Objects
      Shadows and PDF Documents
    Drawing with Transparency Layers (Panther)
      Using Transparency Layers
      Alpha Compositing and Transparency Layers
      Transparency Layers and PDF Documents
      Transparency Layers Compared to CGLayers
    Drawing With Shadings (Jaguar)
      Shading Concepts and the CGFunction
      Axial Shadings
      Radial Shadings
      Radial Shading Geometries
      Transforming Shadings
    Summary
    See Also

    Chapter 16 Supporting PostScript and EPS Data
    Overview of the Conversion Process
    Quartz Conversion Functions and Callbacks (Panther)
    Creating a PDF Data File From PostScript Data
    Using Converted PostScript Data in Your Application
    PSConverter Advanced Issues
    Printing Source EPS Data
    Guidelines for Supporting EPS Data in Your Application
    Summary
    See Also

    Chapter 17 Performance and Debugging
    Optimizing Performance
      The Quartz Compositor
      Quartz Object and Memory Model
      Improving Performance
      Measuring Performance
    Debugging Your Drawing
      Examining the Coordinate System
      Checking the Clipping Area
      Drawing a Debugging Rectangle
      Looking for Console Messages
      Checking for Data Provider Integrity
      Checking for Immutability Violations
      Checking for Improperly Initialized Contexts
      Checking for Out-of-Sync Color Setting
      Drawing Images to a PDF Context
      Releasing a CGPDFContext Object
      Checking Pattern Color Space Usage
      Using PDF Generation as a Debugging Aid
    Summary
    See Also

    Chapter 18 Creating Quartz Tools and Python Scripts
    Python Scripting with Quartz (Panther)
      Getting Started
    Creating Bits with Python
    Using Quartz in UNIX Tools
      Security Issues
    The PDF Workflow in Printing (Jaguar)
    Summary
    See Also

    Index

商品描述(中文翻譯)

書籍描述



《Programming with Quartz》是由Apple開發團隊成員撰寫的第一本書,描述了Mac OS X的先進圖形系統。通過本書中描述的方法,開發人員將能夠充分利用Mac OS X在其應用程序中的尖端圖形能力,無論是用於Cocoa還是Carbon開發。本書還作為2D圖形概念的入門,包括圖像是如何繪製的以及顏色是如何渲染的。它包括處理PDF文檔、繪製位圖圖形、使用Quartz內建的顏色管理以及繪製文本的指導。《Programming with Quartz》是新手和經驗豐富的Mac OS X開發人員、Cocoa和Carbon程序員、正在遷移到Mac OS X的UNIX開發人員以及任何對強大的2D圖形系統感興趣的人的豐富資源。


 



目錄

    前言 由Philip Schneider撰寫

    前言
    我們的目標
    大綱
    源代碼
    標頭文件
    約定和假設
    Quartz技術
    致謝

    第1章 介紹Quartz 2D
    一點歷史
    Quartz 2D概述
    哪些軟體可以使用Quartz 2D?
    總結
    另見

    第2章 Quartz 2D繪圖基礎
    Quartz圖形上下文
    填充矩形
    描邊矩形
    填充和描邊操作的順序
    變換坐標系統
    構建Quartz路徑
    使用Alpha繪製
    製作虛線
    裁剪繪圖
    繪製PDF內容
    更多關於圖形上下文
    總結
    另見

    第3章 在Cocoa中使用Quartz 2D
    Xcode概述
    在Tiger中創建Cocoa Xcode項目
    在Interface Builder中創建視圖
    將介面連接到代碼
    在Cocoa中獲取圖形上下文
    編寫繪圖代碼
    檢查繪圖輸出
    Cocoa框架繪圖與Quartz
    總結
    另見

    第4章 在Carbon中使用Quartz 2D
    創建Carbon Xcode項目
    設置Carbon窗口
    創建事件處理程序
    檢查繪圖輸出
    使用QDBeginCGContext
    總結
    另見

    第5章 Quartz坐標系統和坐標變換
    用戶空間和設備空間
    坐標變換
    當前變換矩陣
    仿射變換的數學
    保存和恢復坐標系統
    仿射變換便利函數
    總結
    另見

    第6章 使用路徑繪圖
    路徑的屬性

      路徑構建原語
      三次Bézier曲線
      二次Bézier曲線

    關閉子路徑
    路徑構建便利函數

      額外的路徑便利函數(Tiger)

    描邊路徑

      線寬
      線接頭
      線帽
      線段虛線

    填充路徑
    使用路徑裁剪
    CGPath對象(僅限Jaguar及以後版本)
    抗鋸齒
    路徑實用函數

      在像素邊界上對齊用戶空間坐標

    總結
    另見

    第7章 顏色、Alpha透明度和Quartz圖形狀態
    顏色和顏色空間

      設置顏色的一般方法
      校準顏色空間
      設備顏色空間
      特殊顏色空間
      按名稱創建顏色空間
      渲染意圖

    Alpha透明度

      混合模式(Tiger)

    CGColorRef對象(Panther及以後版本)
    圖形狀態參數
    總結
    另見

    第8章 數據提供者和數據消費者
    數據提供者

      CGDataProviderCreateWithURL
      CGDataProviderCreateWithData
      CGDataProviderCreate
      CGDataProviderCreateDirectAccess
      CGDataProviderCreateWithCFData(Tiger及以後版本)

    使用數據提供者的指導方針
    數據消費者
    總結

    第9章 繪製圖像
    創建CGImage對象

      JPEG和PNG的專用函數
      在翻轉坐標系中繪製圖像
      未壓縮數據的一般函數
      壓縮圖像數據的通用函數(Tiger及以後版本)
      使用QuickTime導入圖像數據
      圖像創建的指導方針

    處理圖像的最佳實踐
    圖像實用函數

      獲取圖像尺寸
      獲取像素格式
      從位圖上下文創建圖像
      處理顏色空間
      創建子圖像

    使用CGImageDestination寫入圖像數據(Tiger)
    使用QuickTime導出器導出為JPEG
    總結
    另見

    第10章 圖像遮罩
    創建圖像遮罩

      繪製和反轉1位圖像遮罩
      繪製8位深度遮罩

    遮罩圖像(Tiger)

      使用圖像遮罩遮罩圖像
      使用圖像遮罩圖像
      遮罩指導方針

    使用顏色作為遮罩(Tiger)
    裁剪到遮罩(Tiger)
    總結
    另見

    第11章 文本
    文本繪製參數

      字體和字體大小
      文本矩陣和文本位置
      文本繪製模式
      字體平滑(Jaguar)
      字元間距

    使用Quartz繪製文本

      使用字元繪製
      使用字形繪製

    使用Cocoa繪製文本

      使用NSString
      使用NSLayoutManager
      子類化以獲得額外控制

    使用Carbon繪製文本

      使用HIThemeDrawTextBox(Panther)
      使用多語言文本引擎
      使用Apple Type Services進行Unicode影像

    在翻轉坐標系中繪製文本
    總結
    另見

    第12章 創建位元
    位圖圖形上下文

      支持的像素格式
      創建位圖圖形上下文
      獲取有關位圖上下文的信息
      使用位圖上下文中的位圖數據

    CGLayers(Tiger)

      創建CGLayer對象
      繪製到CGLayer
      繪製CGLayer的內容
      使用CGLayer繪製棋盤格

    離屏緩存繪圖

      無緩存重複繪製
      使用位圖上下文緩存重複繪製
      使用CGLayer緩存重複繪製
      顯示配置文件問題

    替換CopyBits
    總結
    另見

    第13章 打開和繪製PDF文檔
    PDF文檔屬性
    打開PDF文檔
    使用PDF作為圖形交換

      從剪貼板創建PDF數據:Cocoa
      從剪貼板創建PDF:Carbon

    繪製PDF頁面

      使用CGContextDrawPDFDocument繪製
      在翻轉坐標系中繪製PDF文檔
      使用CGPDFPage對象(Panther)
      在Jaguar及以前版本上使用PDF旋轉繪製

    處理受保護的PDF文檔(Jaguar)
    PDF文檔實用函數
    總結
    另見

    第14章 創建和檢查PDF文檔
    創建新的PDF文檔

      使用CGPDFContextCreateWithURL
      使用輔助信息字典

    將PDF內容複製到剪貼板
    向現有PDF文檔添加內容
    向PDF文檔添加鏈接(Tiger)

      創建指向URL的鏈接
      創建指向文檔中另一頁的鏈接

    創建加密PDF輸出(Tiger)
    PDF文檔生成問題
    檢查PDF文檔內容(Panther, Tiger)

      Quartz PDF內省
      掃描PDF內容流(Tiger)

    總結
    另見

    第15章 高級繪圖功能
    使用圖案繪製

      創建圖案
      創建和繪製彩色圖案
      基礎空間、圖案矩陣和變換圖案
      圖案相位
      創建和繪製模板圖案
      繪製複雜圖案
      圖案問題

    使用陰影繪製(Panther)

      陰影屬性
      創建和使用陰影繪製
      陰影偏移和Quartz基礎空間
      陰影和分組對象
      陰影和PDF文檔

    使用透明度圖層繪製(Panther)

      使用透明度圖層
      Alpha合成和透明度圖層
      透明度圖層和PDF文檔
      透明度圖層與CGLayers的比較

    使用陰影繪製(Jaguar)

      陰影概念和CGFunction
      軸向陰影
      徑向陰影
      徑向陰影幾何
      變換陰影

    總結
    另見

    第16章 支持PostScript和EPS數據
    轉換過程概述
    Quartz轉換函數和回調(Panther)
    從PostScript數據創建PDF數據文件
    在應用程序中使用轉換的PostScript數據
    PSConverter高級問題
    打印源EPS數據
    在應用程序中支持EPS數據的指導方針
    總結
    另見

    第17章 性能和調試
    優化性能

      Quartz合成器
      Quartz對象和內存模型
      提高性能
      測量性能

    調試您的繪圖

      檢查坐標系統
      檢查裁剪區域
      繪製調試矩形
      查找控制台消息
      檢查數據提供者完整性
      檢查不可變性違規
      檢查不正確初始化的上下文
      檢查顏色設置不同步
      將圖像繪製到PDF上下文
      釋放CGPDFContext對象
      檢查圖案顏色空間使用情況
      使用PDF生成作為調試輔助工具

    總結
    另見

    第18章 創建Quartz工具和Python腳本
    使用Quartz進行Python腳本編寫(Panther)

      入門

    使用Python創建位元
    在UNIX工具中使用Quartz

      安全問題

    打印中的PDF工作流程(Jaguar)
    總結
    另見

    索引