TAILIEUCHUNG - Học Actionscript 3.0 - p 23

The Graphics Class Using Bitmap Fills and Lines In addition to applying gradients to fills and lines, you can use bitmaps to decorate your drawing’s fills and lines. Both the beginBitmapFill() and lineBitmapStyle() methods we cover in this section use instances of the BitmapData class. This class handles pixel color and alpha data and allows low-level manipulation of bitmaps. Conveniently, BitmapData is also the data type of bitmaps instantiated from the Flash Professional library using a linkage class. So, any time we need such an instance in the following examples, using a linkage class with an imported bitmap will fit the bill. Bitmap. | The Graphics Class Using Bitmap Fills and Lines In addition to applying gradients to fills and lines you can use bitmaps to decorate your drawing s fills and lines. Both the beginBitmapFill and lineBitmapStyle methods we cover in this section use instances of the BitmapData class. This class handles pixel color and alpha data and allows low-level manipulation of bitmaps. Conveniently BitmapData is also the data type of bitmaps instantiated from the Flash Professional library using a linkage class. So any time we need such an instance in the following examples using a linkage class with an imported bitmap will fit the bill. Bitmap fills Using bitmap fills is an easy way to add art to a shape created with the drawing API. Instead of using the beginFill method simply substitute beginBitmap-Fill . The method requires a BitmapData instance such as a bitmap from the library but all remaining parameters are optional. When using the default values the bitmap will automatically tile. This is very useful for keeping file size down because you can fill large areas with custom bitmap art by using tiles. In the following example the 18 x 19 pixel tile in Figure 8-6 has been imported into the source file and been given a linkage class of WeaveTile. The following code fills a 200 x 200 rectangle with the tile resulting in what you see in Figure 8-7. Note in line 5 that you must pass in the size of the bitmap you want to use for your fill when creating the BitmapData instance. 1 var canvas Sprite new Sprite 2 addChild canvas 3 var g Graphics 4 5 new WeaveTile 18 19 6 0 0 200 200 7 NOTE In Chapter 13 we ll discuss how to load external images so you can use bitmaps that haven t already been imported into an FLA. For now let s focus on the syntax required to use bitmaps no matter where they originate. NOTE Flash Professional CS5 users can omit the width and height values in this usage. This will be discussed

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.