TAILIEUCHUNG - Interface-Oriented Design phần 2

The Pragmatic Starter Kit, Lập trình thực dụng, thực dụng lập trình, Tủ sách thực dụng và thiết bị liên kết g là các nhãn hiệu của lập trình viên thực dụng, LLC. Mỗi biện pháp phòng ngừa đã được thực hiện trong việc chuẩn bị của cuốn sách này. Tuy nhiên, nhà xuất bản không chịu trách nhiệm cho các lỗi hoặc thiếu sót | Real-Life Interfaces 10 it can be stored in a file or sent to a printer device. An example of PostScript commands to print Hello world on a page is as follows Times-Roman findfont 12 scalefont setfont newpath 200 300 moveto Hello world show showpage The printer interprets the commands and prints the page. The set of printers that understand Postscript can be considered polymorphic implementations of the PostScript Just like pizza shops their output may vary in quality and speed. But they all implement the same functionality. We ll examine in Chapter 3 how to translate a textual interface such as the FTP commands into a programmatic interface. The PostScript file acts like a document-style interface. We ll explore document-style interfaces in more detail in Chapter 6. The GUI Interface Packages that support graphical user interfaces make extensive use of polymorphism. In both Java and Windows you draw in a graphics context. In Java the context is the Graphics class. For Windows the graphic context for the Microsoft Foundation Classes MFC is the CDC for device context class. The graphics context could refer to a display a printer an in-memory screen buffer or a metafile. The user drawing on the graphics context may not be aware to what they are actually outputting. In Java you call drawString to output a string to the display at a particular position void drawString String string int x int y Given a reference to a Graphics object say g to output the string you would code this Hello world 200 300 For example in MFC you write text to the device context using the following method 7You can display PostScript files on Windows and Unix with GSView http ghost gsview . Things to Remember 11 BOOL TextOut int x int y const CString string With a pointer to a CDC object say pDC the code to output a string is as follows 8 pDC- TextOut 200 300 Hello world Both graphics contexts are state-based interfaces they contain the current .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.