Rendering ink strokes of variable width and angle
Apparatus and methods for dynamically rendering digital ink strokes of arbitrary stroke width while a user is drawing the ink strokes. An ink rendering system may receive sampled pen tip positions associated with a stylus or pen on a digitizer. The ink rendering system may further determine pen tip instances having particular shapes, sizes, and/or rotations, and may determine connecting shapes, preferably quadrangles, that connect between the pen tip instances. Smoothing techniques may also be used for existing digital ink.
Latest Microsoft Patents:
- Systems and methods for electromagnetic shielding of thermal fin packs
- Application programming interface proxy with behavior simulation
- Artificial intelligence workload migration for planet-scale artificial intelligence infrastructure service
- Machine learning driven teleprompter
- Efficient electro-optical transfer function (EOTF) curve for standard dynamic range (SDR) content
This application is a continuation application of U.S. patent application Ser. No. 09/918,721, filed Aug. 1, 2001, which is hereby incorporated by reference as to its entirety.
FIELD OF THE INVENTIONThe present invention is directed generally to rendering digital ink, and more particularly to dynamically rendering ink having arbitrary width and pen instance rotation.
BACKGROUND OF THE INVENTIONThe term “digital ink” refers to one or more strokes that are recorded from a pointing device, such as a mouse, a stylus/pen on a digitizer tablet, or a stylus/pen on a display screen integrated with a digitizer tablet (e.g., a touch-sensitive display screen). As used herein, the term “ink” is shorthand for digital ink. Also, the term “pen” and “stylus” are used generically and interchangeably. Each stroke may be stored as one or more ink packets, in which each ink packet may contain coordinates (x, y) corresponding to the position of the pointing device. For example, a user may move a pen along a touch-sensitive display screen of a computer system so as to draw a line or curve, and the computer system may sample the coordinates (x, y) along the trajectory of the pen tip position over time (or on any other interval as known in the art) as the user moves the pen. These coordinates represent points along the curve or line and are stored as ink packets.
Ink may be either transparent or non-transparent, as used herein. Ink that is transparent means that the ink does not fully conceal the background behind it when displayed on a display or printed on a printer. Ink that is not transparent completely conceals or occludes the background behind it. Non-transparent ink may also be referred to as opaque ink. For instance,
It is often desirable to render a transparent ink stroke dynamically while the ink stroke is being drawn, in other words, to draw the ink stroke on the display screen while the pointing device moves and adds new points to the ink stroke or strokes. One way to accomplish this is to erase the entire screen and redraw everything on the screen each time a new point is added to the ink stroke. This is an imperfect solution, however, since in practice there is typically a short time interval between ink points, and repeatedly clearing and redrawing the screen uses massive amounts of processing power, not to mention causing the screen to flicker. A way to reduce the redrawing time would be draw each new segment of an ink stroke as it is drawn. The problem with this is that the transparencies of the overlapping portion of ink segments are reduced in an unexpected and unintended manner. The effect of redrawing transparent ink is shown in
There is also a need for providing various artistic features not provided by current systems, such as dynamically rendering ink responsive to variable width, pressure, speed, and angle of the pen.
SUMMARY OF THE INVENTIONApparatus and methods are disclosed for dynamically rendering digital ink strokes of arbitrary stroke width while a user is drawing the ink strokes. An ink rendering system may receive sampled pen tip positions associated with a stylus or pen on a digitizer. The ink rendering system may further determine pen tip instances associated with the stylus or pen and having particular shapes, sizes, and/or rotations. The ink rendering system may determine connecting regions, preferably quadrangles, that connect between the pen tip instances. The pen tip instances may be circles, rectangles, or any other shape, and may be of any size and/or angular rotation. The configurations of the pen tip instances and connecting regions determine the overall width of the ink stroke. The connecting regions may depend upon the shapes, sizes, and/or rotations of the pen tip instances. The pen tip instances and connecting regions may be sent to a graphics toolbox for painting. Where an ink stroke has already been recorded or stored, the ink stroke may be smoothed as to its (x, y) position, the sizes of the pen tip instances, and/or the angular rotations of the pen tip instances.
These and other features of the invention will be apparent upon consideration of the following detailed description of preferred embodiments. It will be apparent to those skilled in the relevant technology, in light of the present specification, that alternate combinations of aspects of the invention, either alone or in combination with one or more elements or steps defined herein, may be used as modifications or alterations of the invention or as part of the invention. It is intended that the written description of the invention contained herein covers all such modifications and alterations.
BRIEF DESCRIPTION OF THE DRAWINGSThe foregoing summary of the invention, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the accompanying drawings, which are included by way of example, and not by way of limitation with regard to the claimed invention. In the accompanying drawings, elements are labeled with reference numbers, wherein the first digit of a three-digit reference number, and the first two digits of a four-digit reference number, indicates the drawing number in which the element is first illustrated. The same reference number in different drawings refers to the same or a similar element.
Improved ink rendering systems and methods are disclosed. The various embodiments of the invention are described in the following sections: General Purpose Computing Environment, Ink Rendering System, and Ink Smoothing.
General Purpose Computing Environment
A basic input/output system 460 (BIOS), containing the basic routines that help to transfer information between elements within computer 400, such as during start-up, is stored in ROM 140. The computer 400 also includes a hard disk drive 470 for reading from and writing to a hard disk (not shown), a magnetic disk drive 480 for reading from or writing to a removable magnetic disk 490, and an optical disk drive 491 for reading from or writing to a removable optical disk 492 such as a CD ROM or other optical media. Hard disk drive 470, magnetic disk drive 480, and optical disk drive 491 are connected to the system bus 430 by a hard disk drive interface 492, a magnetic disk drive interface 493, and an optical disk drive interface 494, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for personal computer 400. It will be appreciated by those skilled in the art that other types of computer readable media that can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories (RAMs), read only memories (ROMs), and the like, may also be used in the example operating environment.
A number of program modules can be stored on hard disk drive 470, magnetic disk 490, optical disk 492, ROM 440, and/or RAM 450, including an operating system 495, one or more application programs 496, other program modules 497, and program data 498. A user can enter commands and information into computer 400 through input devices such as a keyboard 401 and pointing device 402. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner or the like. These and other input devices are often connected to processing unit 410 through a serial port interface 406 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port or a universal serial bus (USB). Further still, these devices may be coupled directly to system bus 430 via an appropriate interface (not shown). A monitor 407 or other type of display device is also connected to system bus 430 via an interface, such as a video adapter 408. In addition to the monitor, personal computers typically include other peripheral output devices (not shown), such as speakers and printers. In one embodiment, a pen digitizer 465 and accompanying pen or stylus 466 are provided in order to digitally capture freehand input. Although a direct connection between pen digitizer 465 and processing unit 410 is shown, in practice, pen digitizer 465 may be coupled to processing unit 410 via a serial port, parallel port, and/or other interface and system bus 430 as known in the art. Furthermore, although digitizer 465 is shown apart from monitor 407, in some embodiments the usable input area of digitizer 465 be co-extensive with the display area of monitor 407. Further still, digitizer 465 may be integrated in monitor 407, or may exist as a separate device overlaying or otherwise appended to monitor 407.
The computer 400 can operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 409. Remote computer 409 can be a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to computer 400, although only a memory storage device 411 has been illustrated in
When used in a LAN networking environment, the computer 400 is connected to local network 412 through a network interface or adapter 414. When used in a WAN networking environment, the computer 400 typically includes a modem 415 or other device for establishing a communications over wide area network 413, such as the Internet. Modem 415, which may be internal or external, is connected to system bus 430 via the serial port interface 406. In a networked environment, program modules depicted relative to the computer 400, or portions thereof, may be stored in a remote memory storage device.
It will be appreciated that the network connections shown are exemplary and other techniques for establishing a communications link between the computers can be used. The existence of any of various well-known protocols such as TCP/IP, Ethernet, FTP, HTTP and the like is presumed, and the system can be operated in a client-server configuration to permit a user to retrieve web pages from a web-based server. Any of various conventional web browsers can be used to display and manipulate data on web pages.
Ink Rendering System
An exemplary ink rendering system 500 is illustrated in
Stored ink may be rendered by calling the graphics toolbox 503 to perform various functions. The ink storage 501 may maintain a list of rendering environments, one for each view in which the application renders dynamically. Each rendering environment may maintain a list of the states, one for each stroke that is currently being dynamically rendered. Each state may represent the last pen tip position (e.g., point) recorded and/or a queue of geometric regions that are further described below. In at least one embodiment, the graphics toolbox 503 has transparent painting capabilities, such as does Microsoft WINDOWS GDI+.
Pen tip positions may be sampled at a particular rate. The sampling rate may be set at a rate at least high enough to capture sufficient pen tip positions based on the anticipated speed of a normal user. Once the new pen tip position is captured and received, the ink rendering system 500 (e.g., in particular, the ink storage 501) may determine the area (and/or the contour that outlines and defines the area) that is associated with the pen tip at the new position based on the size and/or shape of the virtual pen tip. This area is also known as a “pen tip instance.” For example, where the virtual pen tip is considered to be a 3-millimeter diameter circle, then the pen tip instance may be the 3-millimeter diameter circle centered at the new pen tip position. Or, where the virtual pen tip is considered to be a rectangle of 2 millimeters by 4 millimeters, then the pen tip instance may be the 2 by 4 millimeter rectangle centered at the new pen tip position. Examples of circular pen tip instances 701, 702, 703, 704 are shown in
Each time a pen tip instance is determined, that pen tip instance (and/or the associated pen tip position) may be stored (e.g., queued) for later retrieval. Pen tip instances and/or positions may be stored as data in, e.g., RAM 450. Data representing the position (e.g., (x, y) coordinate position), shape, and/or rotation of the pen tip instance may further be stored. Previous pen tip instances and/or positions may further be stored as part of digital ink storage such as in the serialized format described in U.S. patent application Ser. No. 09/852,799, entitled “Serial Storage of Ink and its Properties”, filed May 11, 2001.
A queue (e.g., an ordered list) of regions, pen tip instances and/or positions may be stored, with the order in the queue being chronological. The queue may have a fixed, dynamic, maximum, or other controlled length such that when the threshold length is surpassed by adding another pen tip instance and/or position, the oldest pen tip instance and/or position is pushed out of the queue. For instance, the queue may have a maximum enforced length of 2 or 4 pen tip instances or positions. The queue may operate in a first-in-first-out (FIFO) manner, as in a pipeline. The queue may separately store the actual pen tip instances and/or positions, or may have pointers that point to pen tip instances or positions already stored in, e.g., serialized format. The queue may also be referred to as a group of ink strokes connecting a previous pen tip instance to a currently received (or new) pen tip instance. When the queue has four pen tip instances, it may also be referred to as containing line segments that connect the pen tip instances.
Referring still to
The new pen tip instance is associated with the new pen tip position, and may be centered about the new pen tip position. The new connecting quadrangle may be determined in a variety of ways, and the method for determining the connecting quadrangle may depend upon the shapes of the new and previous pen tip instances. Various methods for determining connecting quadrangles will be discussed herein. Examples of connecting quadrangles 705, 706, 707 are shown in
The combination (e.g., union) of some or all of a plurality of previous regions may also be determined (step 603). These previous regions may be those regions that are stored in the queue. For example, referring to
The ink rendering system 500 (in particular, e.g., the rendering environment 502) may freeze the color settings of the pixels (step 604) within the region defined by the combination (e.g., union) of the queued regions (e.g., the shaded area in
The new region may be sent to the graphics toolbox 503 for painting (step 605). The new region may be painted in a transparent or nontransparent color as desired. After the new regions are painted, some or all of the pixels in the excluding clip region may be unfrozen (step 606). This step allows the color settings of the formerly frozen pixels to again be modified. More generally, the ink rendering system 500 may determine whether pixels within the new pen tip instance and/or new connecting quadrangle are also within the previous regions (such as those regions in the queue). For those pixels that are, the color settings of those pixels may not be changed. For those pixels that are in the new pen tip instance but not within any of the previous queued regions, the color settings may be changed.
The new region (e.g., connecting quadrangle 909) may then be pushed into the queue (step 607). Where the queue has rules that determine the queue length, one or more of the oldest regions may be pushed out of the queue as appropriate according to the queue rules. For example, referring to
Further, a queue length that is allowed to be too long may prevent certain desirable overlapping of transparent ink, such as when writing the script letter “e” as in
The exemplary method of
As an alternative to determining the union of the queued regions and/or freezing the pixels in the union, the intersection (i.e., overlap) between the new region and one or more of the queued regions may be determined. Instead of freezing the entire union of the queued regions, it may be desirable to freeze only those pixels in the intersection. For instance, where connecting quadrangle 909 is the new region, the intersection between the new region and the union of regions 907, 903, 908, and 904 may be determined (as an alternative to step 603), and only those pixels in the intersection would be frozen (as an alternative to step 604).
It is understood that one or more of the steps illustrated in
The generation of connecting quadrangles is now discussed. Referring to
The calculations for determining a connecting quadrangle may vary depending upon the relative shapes and sizes of the pen tip instances. Where the pen tip instances are both perfectly circular and of the same size, as in
Thus far the exemplary pen tip instances have all been identically sized circles. However, this is not always the case. Pen tip instances may be of any shape, such as circles, rectangles (including squares), triangles, ovals, blobs, stars, lines, arcs, points, or polygons. Pen tip instances may be symmetric or asymmetric. An example of an asymmetric pen tip instance is one configured to emulate the tip of a calligraphy pen. Pen tip instances may also be of varying size, such that two consecutive pen tip instances in the same set of ink may be of different sizes. Pen tip instances may further be of varying shape, such that two consecutive pen tip instances in the same set of ink may be of different shapes. Pen tip instances may further be of varying rotation, such that two consecutive pen tip instances in the same set of ink may be rotated at different angles. Of course, where the pen tip instance is an exact circle, the angle of rotation is meaningless. The rotation of a pen tip instance is also considered a property of each pen tip position and/or the entire stroke. To account for these potential variations in pen tip instance characteristics, another exemplary ink rendering system 1000 is shown in
The contour generator 1002 (or another specialized contour generator) may also generate contours that define the shape of the connecting quadrangles, based on the received and utilized pen tip instance characteristics and positions. The contour generator 1002 may then send the generated contours to a graphics toolbox 1004. Where the ink is transparent, the contour generator 1002 may communicated with the graphics toolbox 1004 via a rendering environment 1003, and the method of
Referring to
Referring to
Next in
It may be desirable to utilize a connecting quadrangle that connects between the outermost portions of the two pen tip instances to be connected. For instance, where the two pen tip instances are both polygons (i.e., closed shapes having only straight edges connected at corners), it may be desirable to connect the outermost corners together to provide for the largest area possible covered by the connecting quadrangle. Such an embodiment may in many cases provide a very smooth transition between pen tip instances and a higher-quality ink that is pleasing to the eye. Also, some or all of the possible connecting quadrangles (or a subset thereof) may be determined, and the determined quadrangles may be combined together (e.g., by taking their collective union) into a single connecting region. For example, referring to
Ink Smoothing
The ink-rendering process may also include smoothing the ink. Smoothing may be performed by the rendering system 500, 1000, such as by the graphics toolbox 503, 1004, using known smoothing functions. Another example of an ink rendering system 1900 is illustrated in
Smoothing may be performed on the size and/or rotation parameters. The rendering system 1900 may use any smoothing technique such as least squares fitting. To smooth ink, samples of the ink may need to be taken. These samples may be taken anywhere along the ink stroke, but at least one sampling technique is to sample the locations that were originally sampled from the pen (i.e., the sampled pen tip locations).
An exemplary smoothing function may be implemented by the ink rendering system 1900 (more particularly, by, e.g., the smoothing application 1902) as follows for each sample along the ink stroke:
(smoothed width)i=A1*(original width)i−1+A2*(original width)i+A3*(original width)i+1, (1)
where A1, A2, and A3 are constants that may be chosen as desired, i is the sample number along the sampled ink stroke, “smoothed width” is the width of the ink stroke at sample i after smoothing, and “original width” is the width of the ink stroke at sample i before smoothing. In some examples, the sum of these three constants should equal unity. A combination of A1=0.25, A2=0.5, and A3=0.25 works well. Angle of rotation can also be smoothed using any of the method for smoothing width, including substituting “smoothed width” and “original width” in equation 1 with “smoothed angle” and “original angle,” respectively. In another embodiment, both size and angle may be smoothed for the same ink stroke.
Referring to
For example, using a least-squares method for smoothing, the following algorithm may be used such that the fitting curve P minimizes the following:
min Σ {a(Ci−Pi)2+b[W(Ci)−W(Pi)]2+c[R(Ci)−R(Pi)]}2 (2)
where a, b, and c are optional weighting constants; Pi are the locations of the points on the fitting curve P; W(Pi) are the sizes/widths for each point Pi; and R(Pi) are rotations for each point Pi. The fitting curve P may be any curve desired, such as one chosen from the family of parametric or Bezier curves. In effect, width/size and/or rotation are treated as additional dimensions other than position. Any subcombination of the dimensions in fitting a curve may also be used. For example, the third term c[R(Ci)−R(Pi)]2 may be dropped from equation 2 so that rotation is not considered. Or, the second term b[W(Ci)−W(Pi)]2 may be dropped from equation 2 so that width or size is not considered. Or, the first term a(Ci−Pi)2 may be dropped from equation 2 so that sample position is not considered. Alternatively, both the first and second terms, or both the first and third terms, may be dropped from equation 2 so that only rotation or only width are considered in determining the fitting curve parameters.
While exemplary systems and methods embodying the present invention are shown by way of example, it will be understood, of course, that the invention is not limited to these embodiments. Modifications may be made by those skilled in the art, particularly in light of the foregoing teachings. For example, each of the elements of the aforementioned embodiments may be utilized alone or in combination with elements of the other embodiments. For example, while connecting quadrangles are discussed herein as a particularly advantageous shape, any shape of connecting regions other than quadrangular-shaped regions may be used. Also, while the above description discussed pen tip positions as being defined by (x, y) in a rectilinear coordinate system on the digitizer, any other coordinate system, such as polar, may be used.
Claims
1. A method for rendering a digital ink stroke, comprising the steps of:
- receiving a first pen tip instance;
- receiving a second pen tip instance; and
- determining a quadrangle based on the first and second pen tip instances,
- wherein the first and second pen instances each are associated with data representing at least one of a size, shape, or rotation of the respective pen tip instance.
2. The method of claim 1, further including the step of displaying a representation of the first pen tip instance, the second pen tip instance, and the quadrangle.
3. The method of claim 1, wherein the first and second pen instances each are associated with data representing at least one of a size, shape, or rotation of the respective pen tip instance.
4. The method of claim 1, wherein the step of determining the quadrangle includes determining the quadrangle to connect the first pen tip instance to the second pen tip instance.
5. The method of claim 4, wherein the first pen tip instance is a rectangle, the step of determining including determining two sides of the quadrangle to each have one endpoint at a corner of the rectangle.
6. The method of claim 5, wherein the rectangle is a square.
7. The method of claim 1, wherein the first pen tip instance is a triangle, the step of determining including determining two sides of the triangle to each have one endpoint at a corner of the triangle.
8. The method of claim 1, wherein the digital ink stroke is opaque.
9. A method for rendering a digital ink stroke, comprising the steps of:
- receiving a first pen tip instance;
- receiving a second pen tip instance; and
- determining a region connecting the first and second pen tip instances,
- wherein the first and second pen tip instances are each associated with data representing an area defined by a contour of the respective pen tip instance.
10. A method for rendering a digital ink stroke, comprising the steps of:
- receiving a first pen tip instance;
- receiving a second pen tip instance;
- determining a plurality of quadrangles based on the first and second pen tip instances; and
- determining a union of the plurality of quadrangles.
11. The method of claim 10, further including the step of displaying a representation of the first pen tip instance, the second pen tip instance, and the plurality of quadrangles.
12. The method of claim 10, wherein the first pen tip instance is a rectangle, the step of determining including determining two sides of each of the plurality of quadrangles to each have one endpoint at a corner of the rectangle.
13. The method of claim 1, wherein the first and second pen tip instances each have an area defined by a contour.
14. The method of claim 1, wherein the first and second pen tip instances are of different sizes or different shapes.
15. The method of claim 9, wherein the region overlaps a portion of the area of each of the first and second pen tip instances.
16. A computer-readable medium having computer-executable instructions for performing the steps recited in claim 1.
17. A computer-readable medium having computer-executable instructions for performing the steps recited in claim 9.
Type: Application
Filed: Mar 10, 2005
Publication Date: Jul 28, 2005
Applicant: Microsoft Corporation (Redmond, WA)
Inventors: Bodin Dresevic (Bellevue, WA), Michael Kallay (Bellevue, WA)
Application Number: 11/075,727