Home > Store

X Window Programming From Scratch

Register your product to gain access to bonus material or receive a coupon.

X Window Programming From Scratch

eBook (Adobe DRM)

  • Sorry, this book is no longer in print.
  • About Adobe DRM eBooks
  • This eBook requires the free Adobe® Digital Editions software.

    Before downloading this DRM-encrypted PDF, be sure to:


    • Install the free Adobe Digital Editions software on your machine. Adobe Digital Editions only works on Macintosh and Windows, and requires the Adobe Flash Player. Please see the official system requirements.
    • Authorize your copy of Adobe Digital Editions using your Adobe ID (select AdobeID as the eBook vendor). If you don't already have an Adobe ID, you can create one here.
Not for Sale

Description

  • Copyright 2003
  • Pages: 800
  • Edition: 1st
  • eBook (Adobe DRM)
  • ISBN-10: 0-7686-5657-5
  • ISBN-13: 978-0-7686-5657-2

X Window Programming From Scratch shows how to create a graphical user interface and accomplish graphic rendering using the X Window System software. It offers a unique approach to skill development by leading you through basic to very advanced concepts. This book provides a guide to the Linux operating system for application development, step-by-step instruction to the correct usage and syntax of C, a comprehensive introduction of the X Window System for interface creation and graphic rendering, and a complete structured project to "learn by doing."

Extras

Related Article

A Look at the Modern X Server

Sample Content

Table of Contents



Introduction.

Section One: Starting Points.

I. ABSOLUTE ZERO.

1. UNIX for Developers.

The man Command. Organization and Navigation.

Directories. Permissions. chmod. The cd Command.

The C Compiler. Object Files. Source Files. The vi Editor. The make Utility.

The cc Command. Makefile.

System Tools and Useful Commands.

grep, Pipes, Redirection, and more. The find Command.

Next Steps.

2. Programming Constructs.

Decisions.

The if Statement. The else Statement. Types of Conditions. The if else Statement. The case Statement.

Loops.

The for Loop. The while Loop. The do while Loop.

Functions.

Declarations. Return Type. Function Name. Parameters. Definition. The return Statement.

Data.

Data Types. Next Steps.

3. A Word on C.

Hello World.

Comment Tokens. The Function main. Code Bodies. Variable Scope. Built-In Functions. Memory Management. Dynamic Memory Allocation. Memory Leaks. Definitions and Macros.

Conclusion. Next Steps.

II. THE PIECES OF X.

4. Windowing Concepts.

Origins of the X Window System. The Pieces of X.

Client/Server Model. Window Hierarchy.

Next Steps.

5. Widget Sets.

The Power and Convenience of Using Widget Sets. The Athena Widget Set.

The Core Widget. Widgets That Manage Other Widgets. The Motif Widgets.

Next Steps.

6. Components of an X Window Application.

Connecting to the X Server.

Employing Widget Resources Using Variable Argument Lists.

Creating the Application Interface.

Creating Buttons. Creating Pixmap Icons. Assigning Actions.

Managing Windows. Processing Events. Summary. Next Steps.

7. Xlib Graphic Primitives.

The Graphics Context.

The GC Function. GCForeground and GCBackground. GCLineWidth. GCTile.

Graphic Primitive Functions.

XDrawPoint. XDrawLine. XDrawRectangle. XDrawArc. Filled Graphics.

Next Steps.

III. BACK TO SCHOOL.

8. Vector Versus Raster Graphics.

Vector Graphics. Raster Graphics. Next Steps.

9. Object Bounds Checking.

Point-Array-Based Object Bounds. Arc Object Bounds. Employing Object Bounds. Next Steps.

10. Trigonometric and Geometric Functions.

Calculating Point and Line Intersections. Calculating Slope. Calculating Point and Arc Intersections. Next Steps.

11. Graphic Transformations.

Moving.

Moving a Line. Moving an Arc.

Scaling.

Scaling a Line. Scaling an Arc.

Rotating.

Rotating a Line. Rotating an Arc.

Next Steps.

12. Coordinate Systems.

Rectangular Coordinates. Polar Coordinate System. Next Steps.

Section Two: Graphics Editor Application.

IV. LAYING OUT THE PARTS.

13. Application Structure.

Project Structure.

Laying Out the User Interface.

Parsing the Command Line. The getopt Function. The XtVaGetApplicationResources Function. Setting Up a Canvas. Building the Project. Next Steps.

14. Program Flow.

Processing Events. X Event Hooks.

Widget Callbacks. Event Handlers. Widget Translation Tables.

Next Steps.

15. Common Object Definition.

Line Object Data Structure. Text Object Data Structure.

Understanding Vector Fonts.

The GXText Data Structure. Arc Object Data Structure. Common Object Data Structure. Next Steps.

16. Object Manipulation.

Copying an Object. Deleting an Object. Refreshing Objects. Parsing for an Object. Managing Object Handles. Managing the Status of an Object. Processing User Navigation of Objects. Next Steps.

17. Utilities and Tools.

Common Object Creation.

Linked List Management.

Creating a Graphics Context.

Graphics Context Tiling.

Using the Cursor as State Indicator. Next Steps.

18. File Formats.

Understanding Files. Binary File Formatting. ASCII File Formatting.

Tagged File Formats. Position-Specific File Formats.

Magic Numbers. Next Steps.

19. Save and Restore.

File Format Strategy. Save and Restore Program Hooks. Common-Object Save and Restore. Object-Specific Save and Restore. Next Steps.

V. ADDING OBJECTS TO THE EDITOR.

20. Latex Line Object.

Creating a Latex Line Object. Drawing and Erasing a Line Object. Finding a Line Object. Selecting and Deselecting a Line Object. Moving a Line Object. Scaling a Line Object. Copying a Line Object. Saving and Restoring a Line Object. Next Steps.

21. Pencil Line Object.

Creating a Pencil Object. Pencil Object Management. Next Steps.

22. Object Templates.

The Box Object. The Arrow Object. Next Steps.

23. Arc Object.

Creating an Arc Object. Drawing and Erasing an Arc Object. Finding an Arc Object. Selecting and Deselecting an Arc Object. Moving an Arc Object. Scaling an Arc Object. Copying an Arc Object. Saving and Restoring an Arc Object. Next Steps.

24. Vector Text Object.

Creating a Text Object. Drawing and Erasing a Text Object. Finding a Text Object. Selecting and Deselecting a Text Object. Moving a Text Object. Scaling a Text Object. Copying a Text Object. Saving and Restoring a Text Object. Next Steps.

VI. ADDING A PRINT DRIVER.

25. Introduction to PostScript.

PostScript. Learning PostScript.

Stacks.

PostScript Commands.

Comments.

PostScript Programming. Viewing PostScript Files.

Comments Understood by Ghostscript.

Next Steps.

26. Color Versus Black and White.

Determining a Printer's Capability. Defining Color Images for Black and White Printers. Next Steps.

27. Working with XImages and Colormaps.

Printing the Canvas. Creating an XImage. Creating a PostScript Prolog. Parsing the X Colormap. Writing the PostScript Page Definition File. Directing the Output to a Printer or File. Next Steps.

VII. WHAT'S NEXT?

28. Extending the Graphics Editor.

Attributes.

Color. Line Attributes. Arc Angles.

Rotating Objects. Next Steps.

29 Adding Context-Sensitive Help.

Processing Help-Related Events. Widget Paths. Relating Widgets to Text. Next Steps.

VIII. APPENDIXES.

Appendix A: Command Shells and Scripting.

UNIX Command Shells.

Command Shell Environment.

Scripting with the Bourne Shell.

Shell Variables. Writing a Script with Function Calls. Debugging Shell Scripts.

Appendix B: Application Layout Code Listing.

make.defines File Contents. GNUmakefile File Contents. gxMain.c File Contents. gxGraphics.c File Contents. gxGx.c File Contents. gxArc.c File Contents. gxLine.c File Contents. gxText.c File Contents. gxGraphics.h File Contents. gxIcons.h File Contents. gxBitmaps.h File Contents. gxProtos.h File Contents.

Appendix C: Additional Vector Font Sets and vector_chars.h.

Triplex Bold Italic Vector Font Set. The vector_chars.h Header File.

Index.

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership