Printer technology has not advanced as rapidly as on-screen graphics technology. As a result, there is a disparity between what can be rendered on a screen and what can be printed. To make things worse, the way a document is printed varies from printer to printer. For example, some printers may not print transparencies very well. This variation among output devices makes device independence difficult, if not impossible. Additionally, the life cycle for printers is much longer than that of personal computers (PCs). The life cycle for printers may be from 7-10 years as compared to 2-3 years for a PC. As a result, software manufacturers are required to provide support for outdated printers that are still in use.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
Transparent content and opaque content that is contained within a document is treated differently for printing. The transparent content within a document is rasterized and stored in a bitmap before printing. While rasterization is effective for maintaining visual fidelity of transparent content it can lead to large spool files and poor performance if excessively performed. In order to help optimize the performance of output devices, the transparent content within the document is rasterized and the opaque vector content within the document is drawn into a metafile before printing. The metafile is replayed onto the printer and into the bitmap such that the opaque content can be blended with the rasterized transparent layers that are contained within the bitmap. The bitmap is then drawn on the printer.
Referring now to the drawings, in which like numerals represent like elements, various aspects of the present invention will be described. In particular,
Generally, program modules include routines, programs, components, data structures, and other types of structures that perform particular tasks or implement particular abstract data types. Other computer system configurations may also be used, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like. Distributed computing environments may also be used where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
Throughout the specification and claims, the following terms take the meanings explicitly associated herein, unless the context clearly dictates otherwise.
The term “Alpha Channel” refers to the fact that in ARGB (alpha, red, green, blue) bitmaps, each pixel has a channel that represents its transparency in addition to its red, green and blue channels.
The term “Bitmap” is a raster image (see ‘raster’ below).
The term “Device Context (DC)” refers to a structure that defines a set of graphics objects, their associated attributes, and the graphic modes that affect their output.
The term “Enhanced Metafile (EMF)” is a MICROSOFT WINDOWS native vector graphics format used frequently in applications.
The term “hDC” refers to a handle to a device context.
The term “Opaque” refers to a property of a visual object that makes objects behind not visible.
The term “Pass-through” refers to a method to send data directly to the printer, bypassing the printer driver.
The term “Page Description Language (PDL)” is a language that resides on a printer to translate documents into printer instructions.
The term “Planar Map” is a technique that divides the print area into regions and drawing the edges and intersections of objects in the region.
The term “Raster” refers to pixel-based graphics. If expanded past the original pixel dimensions, interpolation is done to determine the color or the space between pixels.
The term “Screen Door” is a stippling technique used to simulate transparency, similar to looking through a screen door.
The term “Translucency (or Semi-Transparency)” refers to partial transparency.
The term “Transparency” refers to a property of a visual object that makes objects behind it visible. As used herein, the terms translucency and transparency may be used interchangeably.
The term “Vector” refers to graphics that are defined by their geometry. These graphics can be scaled to any size without loss of quality.
Referring now to
The mass storage device 14 is connected to the CPU 5 through a mass storage controller (not shown) connected to the bus 12. The mass storage device 14 and its associated computer-readable media provide non-volatile storage for the computer 2. Although the description of computer-readable media contained herein refers to a mass storage device, such as a hard disk or CD-ROM drive, the computer-readable media can be any available media that can be accessed by the computer 2.
By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, digital versatile disks (“DVD”), or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer 2.
According to various embodiments of the invention, the computer 2 may operate in a networked environment using logical connections to remote computers through a network 18, such as the Internet. The computer 2 may connect to the network 18 through a network interface unit 20 connected to the bus 12. The network interface unit 20 may also be utilized to connect to other types of networks and remote computer systems. The computer 2 may also include an input/output controller 22 for receiving and processing input from a number of other devices, including a keyboard, mouse, or electronic stylus (not shown in
As mentioned briefly above, a number of program modules and data files may be stored in the mass storage device 14 and RAM 9 of the computer 2, including an operating system 16 suitable for controlling the operation of a networked personal computer, such as the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash. The mass storage device 14 and RAM 9 may also store one or more program modules. In particular, the mass storage device 14 and the RAM 9 may store a word processing application program 10. The application program 10 is operative to provide functionality for creating, editing and printing electronic documents, such as the document 24. According to one embodiment, the application program 10 comprises the MICROSOFT WORD word processing application program from MICROSOFT CORPORATION. According to another embodiment, the application program 10 comprises the MICROSOFT POWERPOINT presentation program from MICROSOFT CORPORATION. Other programs may also be utilized. For instance, desktop publishing programs, presentation programs, web browsers, and any other type of program that print documents containing transparent objects may be utilized.
In conjunction with the editing of a document, the application program 10 provides functionality for printing transparent, semi-transparent, and opaque objects that comprise document 24. The application program 10 may utilize a print manager 26 to assist in the printing of the document 24. As will be described in greater detail below, the print manager 26 identifies the transparent content and the opaque content that is within a document; rasterizes the transparent content; stores the rasterization in a system-managed bitmap 30; and draws the opaque vector content into a metafile 32. The metafile 32 is then replayed onto the printer 28 and into the bitmap 30 such that the opaque content can be blended with the rasterized transparent layers that are contained within the bitmap. The bitmap is also drawn on the printer 28.
Opaque objects, such as vector objects 210, which are contained within a document, are typically sent to a metafile 230 before printing. Vector objects include items such as text, lines, vector shapes, solid fills, some gradient fills and the like. Opaque objects may be rasterized depending on whether or not they are obscured by transparent content. According to one embodiment, when an opaque object is obscured by transparent content, at least the region that is obscured is rasterized and sent to change bitmap 240.
Transparent objects are rasterized into a change bitmap 240. The transparent objects 220 include items such as images, raster effects, texture fills, some gradient fills and the like.
Generally, solid text is treated as an opaque object 210 and is written to the metafile 230 then replayed to the full bitmap 250 if the text is not obscured by a transparent object. If the text is obscured, the transparent area is rasterized and alpha blended and placed within change bitmap 240.
Although images are generally raster content they are printed through the metafile 230 unless they need to be blended in the bitmap. Generally, solid vector shapes 210 are written to the metafile 230 if they are not obscured by transparent objects. Gradient fills can be printed through the metafile or the bitmap. According to one embodiment, gradient fills are printed to the bitmap since it has been found that the quality is better when printed through the bitmap than through the metafile.
Shapes that include semitransparent fills and complicated line styles are rasterized. The fill is rasterized since it is semitransparent. According to one embodiment, if an object is obscured by one or more semitransparent objects then the entire transparent region is rasterized even if there are vector shapes below it. Similarly, raster effects (eg. soft shadow, soft edges, blur) are printed as raster objects.
Any of the objects within a document may be transparent or semi-transparent. If there are any semi-transparent regions in an object then those regions are rasterized and printed to the change bitmap 240. Texture fills are tiled raster images so they are printed to the change bitmap 240. Pattern fills and pattern lines are rendered as texture bitmaps and scaled to print at the right size. Tables are broken up so that effects applied to the table are rasterized but table text and lines are drawn through the metafile.
The metafile 230 and the change bitmap 240 are then written to full bitmap 250. The change bitmap 240 is used to temporarily store the rasterized regions of the print output for the document. The resolution of the change bitmap may be set at many different resolutions. For example, the resolution may be at half printer resolution, full printer resolution, or some other determined resolution. For example, the resolution may be a configurable parameter and may be set on the capabilities of the output device. Storing the full bitmap 250 in memory can place significant demands on the system, especially for large paper sizes. For example, an 11″×17″ paper size uses 11×17×300×300×4 bytes/pixel=approx. 64 mb). This memory requirement can be reduced by breaking the full bitmap into tiles or bands so that only part of the bitmap is stored in memory at any given time. For example, if four bands are used, the memory requirement at a given time would be 16 mb at a time instead of 64 mb.
According to one embodiment, when the change bitmap 240 is being written to the full bitmap 250, the metafile 230 is replayed to the full bitmap and then destroyed. The resolution of the metafile is also generally dependent on the capabilities of the output device (printer).
The full bitmap 250 is the cumulative record of what is to be printed to printer 260. Following the final iteration of writing to the full bitmap, the full bitmap is sent to printer 260 for printing. ‘Dirty’ regions (containing transparent pixels) of the bitmap are blitted to the printer, and the metafile is replayed the bitmap and the printer. The full bitmap may also be compressed to speed up the printing process. According to one embodiment, the full bitmap is compressed using JPEG compression. Other compression methods may also be used.
As printing devices have different capabilities, their capabilities may be exploited to produce better looking output. For example, if alpha blending is supported, then the printer can blend transparent content with high fidelity content, while preserving content in its native format. Any other capabilities of the output device may also be considered when determining what objects to rasterize and what objects to write to the metafile.
Referring now to
When reading the discussion of the routines presented herein, it should be appreciated that the logical operations of various embodiments are implemented (1) as a sequence of computer implemented acts or program modules running on a computing system and/or (2) as interconnected machine logic circuits or circuit modules within the computing system. The implementation is a matter of choice dependent on the performance requirements of the computing system implementing the invention. Accordingly, the logical operations illustrated and making up the embodiments of the described herein are referred to variously as operations, structural devices, acts or modules. These operations, structural devices, acts and modules may be implemented in software, in firmware, in special purpose digital logic, and any combination thereof.
After a start operation, the process flows to decision block 410, where a determination is made as to whether there are layered opaque objects. Examples of layered opaque objects may be seen in
Moving to decision operation 420, a determination is made as to whether an opaque object is placed over a transparent object. When an opaque object is placed over a transparent object the opaque object is drawn on top of the transparent one and placed in the metafile (425).
Moving to decision operation 430, a determination is made as to whether a transparent object is placed over an opaque object. When a transparent object is placed over an opaque object, blending is performed (435) (See
Moving to decision operation 440, a determination is made as to whether a transparent object is placed over text. When a transparent object is placed over text, the process moves to operation 445 where the text is preserved if possible. The example in
Moving to operation 450, the metafile and bitmap are played to the printer. The metafile is replayed onto the printer and into the bitmap such that the opaque content can be blended with the rasterized transparent layers that are contained within the bitmap. The bitmap is then drawn on the printer.
The process then moves to an end operation and returns to processing other actions.
Flowing to decision operation 620, a determination is made as to whether the input resolution is less than the default resolution. The default resolution may be set at different resolutions, including: half printer resolution; full printer resolution, or some other determined resolution. For example, if the default resolution is 600 ppi, then the determination would be whether the input resolution is less than 600 ppi. According to one embodiment, when the resolution is less than the default resolution, the selected resolution maintains the default resolution. When the input resolution is not less than the default resolution, the process flows to operation 630.
At operation 630, the modulus operator divides the input resolution by the default resolution. Moving to decision operation 640, a determination is made as to whether the result is 0. When the result is 0, the default resolution is maintained and the process flows to an end block and returns to processing other actions. When the result is not zero, the process flows to operation 650 where the resolution is set using the following formula: Default Resolution+(InputResolution MOD Default Resolution (300)/ceiling(InputResolution/(Default Resolution). This formula yields the smallest factor of the device input resolution that is greater than the default resolution.
Moving to operation 660, the output resolution may be set. If the user does not specify the output resolution, an appropriate default is determined. As a general rule, most printers have an input resolution that is a multiple of 300 ppi (i.e. 300, 600, 1200, 2400, and the like). Generally, the best quality for the device is usually obtained at resolutions that are a factor or multiple of the printer's input resolution. Therefore, the output resolution is set at a factor of the input resolution.
The process then moves to an end block and returns to processing other actions.
The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.