DoodleView Method printImage
On Android 4.4 and higher devices, method printImage
(Fig. 7.33) uses the Android Support Library’s PrintHelper
class to print the current drawing. Line 301 first confirms that printing support is available on the device. If so, line 304 creates a PrintHelper
object. Next, line 307 specifies the image’s scale mode—PrintHelper.SCALE_MODE_FIT
indicates that the image should fit within the printable area of the paper. There’s also the scale mode PrintHelper.SCALE_MODE_FILL
, which causes the image to fill the paper, possibly cutting off a portion of the image. Finally, line 308 calls PrintHelper
method printBitmap, passing as arguments the print job name (used by the printer to identify the print) and the Bitmap
containing ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.