Blend control system

Abstract: The present invention provides a method and apparatus for determining color blend of a computer graphical object (4). The method involves providing a plurality of interactive control points (5,6), each of the control points (5,6) having an associated color value; and calculating a color value of each portion of the object depending on its relative position to the control points. Preferably, the number of the control points (5,6) is two. Preferably, the position or associated color value of each of the control points (5,6) can be interactively altered and the method further comprises the step of recalculating the color values of each portion of the object (4) when the control points are altered. Preferably, the portions of the object (4) having a projection outside a line taken between the two control points are determined to have a color substantially the same as the closest one of the control points (5,6).

Description: Field of the Invention The present invention generally relates to the field of computer graphics and, in particular, to a method of and an apparatus for determining a color blend of a computer graphical object. Background In recent years, as computers have become ever more powerful, there has been a proliferation of software application packages for designing and creating complex full-color images that can be subsequently printed out using color printing devices. The quality of such created images created readily achieves. or surpasses, that capable of being achieved even with photographic images. Consequently, an industry has developed around the creation of such images employing a large number of graphic artists and the like whose occupation is to create complex and appealing images for general public consumption. The complex images created by software application packages (such as Adobe's Photoshop and Illustrator (Trade Marks), Quark's Express (Trade Mark) and other packages of the same ilk) generally consist of a large number of substantially independent objects which are often independently created by the graphic artist. One attribute sometimes found in such software application packages is the ability to create blends between a first color and second color and to apply the blend to any of the objects. By way of example, a circle 1 is shown in Fig. 1 which is a simple object from which other more complex objects can be made up. This object 1 has a predefined blend from a first dark color 2 to a second lighter color 3. Although such blends are known in software application packages such as the ones mentioned above, such conventional software application packages disadvantageously do not allow for the manipulation of a blend. For example, they do not enable a fine alternation of a blend to a slightly different color. Summary of the Invention The invention relates to a method of and an apparatus for determining a color blend of a computer graphical object as set out in independent claims 1 and 6 respectively. It is an object of the present invention to provide a system which allows for the simple creation of blends and their fine manipulation. In accordance with a first embodiment of the invention, there is provided a method of determining a color blend of a computer graphical object. The method comprises providing a plurality of interactive control points, where each of the control points has an associated color value, and calculating a color value of each portion of the graphical object dependent on its relative position to the control points. Preferably, the number of the control points is two. Further, portions of the graphical object that have a projection outside a line taken between the two control points can be determined to have a color substantially the same as the closest one of the control points. Optionally, the position, or associated color value, or both, of each of the control points can be interactively altered. Still further, the method can also comprise the step of recalculating the color values of each portion of the graphical object when the control points are altered. Optionally, the color blend comprises an opacity blend where each of the control points has an associated opacity value. In accordance with a second embodiment of the invention, there is provided an apparatus for determining a color blend of a computer graphical object. The apparatus comprises means for providing a plurality of interactive control points, where each of the control points has an associated color value, and means for calculating a color value of each portion of the graphical object dependent on its relative position to the control points. Preferably, the number of the control points is two. The apparatus can further comprise means for determining the color of portions of the graphical object having a projection outside a line extending between the two control points whereby the color of each portion is assigned to be substantially the same as that of the closest one of the control points. Optionally, the position, or associated color value, or both, of each of the control points can be interactively altered. Still further, the apparatus can comprise means for recalculating the color values of each portion of the graphical object when the control points are altered. Optionally, the color blend comprises an opacity blend where each of the control points has an associated opacity value. In accordance with a third embodiment of the invention, there is provided a method for controlling a color blend of a graphical object. The graphical object is displayed as part of a computer-generated image on display means. The image comprises a first predetermined number of pixels and is stored in memory coupled to a processing means. The graphical object has a second predetermined number of pixels less than or equal to the first predetermined number of pixels. The method comprises the steps of: providing at least two control points for controlling the blend of the graphical object, wherein the control points are capable of being interactively manipulated by a user and each control point has a corresponding color; altering the position of at least one of the control points. wherein the color blend is dependent on the control points; calculating the color of each one of the second predetermined number of pixels of the graphical object dependent on the altered position of the at least one of the control points; and displaying the calculated colors of the second predetermined number of pixels to provide a modified color blend of the graphical object. Preferably, the method includes the step of storing the color and the position of each of the control points as part of the graphical object stored in the memory. Further, the at least two control points preferably define a line extending between the control points within the graphical object. Still further the calculating step can comprise the following steps which are carried out for each pixel (P) of the second predetermined number of pixels: determining if a projection of the pixel (P) intersects with the line, when the pixel (P) does intersect with the line, the color of the pixel (P) is specified to be a color dependent on the intersect with the color blend between the at least two control points; and otherwise, the color of the pixel (P) is specified to be a color dependent on the color of the nearest one of the at least two control points. Optionally, the color blend comprises an opacity blend where each of the control points has an associated opacity value. In accordance with a fourth embodiment of the invention, there is provided an apparatus for controlling a color blend of a graphical object. The graphical object is displayed as part of a computer-generated image on a display means and the image is stored in memory coupled to a processing means. The image has a first predetermined number of pixels and the graphical object has a second number of pixels less than or equal to the first number of pixels. The apparatus comprises: means for providing at least two control points for controlling the blend of the graphical object. wherein the control points are capable of being interactively manipulated by a user and each control point has a corresponding color; means for altering the position of at least one of the control points, wherein the color blend is dependent on the control points; and means for calculating the color of each one of the second predetermined number of pixels of the graphical object dependent on the altered position of the at least one of the control points; wherein the calculated colors of the second predetermined number of pixels are displayed on the display means to provide a modified color blend of the graphical object. Preferably, the apparatus comprises means for storing the color and the position of each of the control points as part of the graphical object stored in the memory. Further, the at least two control points preferably define a line extending between the control points within the graphical object. Still further, the calculating means operates on each pixel (P) of the second predetermined number of pixels and further comprises: means for determining if a projection of the pixel (P) intersects with the line; means for specifying the color of the pixel (P) to be a color dependent on the intersect with the color blend between the at least two control points when the pixel (P) does intersect with the line and for specifying the color of the pixel (P) to be the color of the nearest one of the at least two control points otherwise. Preferably, the color blend comprises an opacity blend where each of the control points has an associated opacity value. In accordance with a fifth embodiment of the invention, there is provided a computer program product comprising a computer usable medium having computer readable program code means embodied in said medium for determining a color blend of a computer graphical object, said product including: codes for providing a plurality of interactive control points, each of said control points having an associated colour value; and codes for calculating a color value of each portion of said graphical object dependent on its relative position to said control points. In accordance with a sixth embodiment of the invention, there is provided a computer program product comprising a computer usable medium having computer readable program code means embodied in said medium for controlling a color blend of a graphical object, said graphical object being displayed as part of a computer-generated image on display means and said image comprising a first predetermined number of pixels, wherein said image is stored in a memory coupled to a processing means. said graphical object having a second predetermined number of pixels less than or equal to said first predetermined number of pixels, said product including: codes for providing at least two control points for controlling said blend of said graphical object, wherein said control points are capable of being interactively manipulated by a user and each control point has a corresponding color; codes for altering the position of at least one of said control points, wherein said color blend is dependent on said control points; codes for calculating the color of each one of the said second predetermined number of pixels of said graphical object dependent on the altered position of said at least one of said control points; codes for displaying said calculated colors of said second predetermined number of pixels to provide a modified color blend of said graphical object. Brief Description of the Drawings The preferred embodiment of the present invention will now be described with reference to the accompanying drawings, in which: Fig. 1 illustrates an object having a blend; Figs. 2 to 5 illustrate the process of creating blends in accordance with the preferred embodiment; Fig. 6 illustrates the process of calculation of a color value of a particular point of an object in accordance with the preferred embodiment; Fig. 7 is a block diagram illustrating a general purpose computer that can be used to practice the preferred embodiment of the invention; Fig. 8 is a flow diagram illustrating a method according to the preferred embodiment for controlling the color blend of a computer-generated graphical object; and Fig 9 is a flow diagram illustrating a method of calculating the color of each point within the computer-generated graphical object in accordance with the preferred embodiment. Detailed Description In the method and apparatus according to the preferred embodiment, a number of control points are provided to independently control the color blend of an object. Fig. 2 illustrates a circle 4 having a blend in accordance with the preferred embodiment. The blend is in the same direction as a notional line extending between a first control point 5 and a second control point 6. Tlic first control point 5 is defined to have a first blend color and the second control point 6 is defined to have a second blend color. The object 4 preferably has a linear blend between the two colors, with the linear blend of the object 4 only being displayed within the border of the object 4 (i.e., the linear blend is "clipped" within the object). The control points 5 and 6 can be used in accordance with the preferred embodiment to control the blend to achieve much greater accuracy when manipulating the color blend of the object 4, thereby overcoming a significant disadvantage of the prior art. The method and apparatus for controlling a color blend within a computer-generated graphical object according to the preferred embodiment is preferably implemented using a general-purpose computer. A representative embodiment of such a general-purpose computer system is illustrated in Fig. 7. The computer system 700 consists of a computer 702, a video display 716, and input devices 718, 720. In addition, the computer system 700 can also have any of a number of other output devices including line printers, laser printers, plotters, and other reproduction devices connected to the computer 702. The computer system 700 can be connected to one or more other computers using an appropriate communication channel such as a modem communications path, a computer network, or the like. The conventional computer 702 itself preferably consists of a central processing unit(s) (simply referred to as a processor hereinafter) 704, memory 706 which can include random access memory (RAM) and read-only memory (ROM). an input/output (I/O) interface 708, a video interface 710, and one or more storage devices generally represented by a block 712 in Fig. 7. The storage device(s) 712 can consist of one or more of the following: a floppy disc, a hard disc drive, a magneto-optical disc drive, CD-ROM or any other of a number of non-volatile storage devices well-known to those skilled in the art. Each of the components 704 to 712 is typically connected to one or more of the other devices via a bus 714 that in turn consists of data, address, and control buses. The video interface 710 is connected to the video display 716 and provides video signals from the computer 702 for display on the video display 716 via the video interface 710. User inputs to operate the computer 702 can be provided by one or more input devices. A user can use the keyboard 718 and/or a pointing device such as the mouse 720 to provide input to the computer 702. The overall structure and individual elements of the computer system 700 are conventional and are well known to persons skilled in the art. For example, the video interface 710 could include video RAM (VRAM). Thus, the system 700 is simply provided for illustrative purposes and other configurations can be employed without departing from the scope and spirit of the invention. Operation of the system according to the preferred embodiment will now be described with reference to Figs. 8 and 9. Fig. 8 is a general flow diagram illustrating the steps of controlling a blend of a graphical object in a computer generated image in accordance with the preferred embodiment. While the following description makes reference to a "color" blend, it will be apparent to a person skilled in the art that the invention is equally applicable to an opacity blend, or a color and opacity blend. The practice of providing an opacity value for each point or pixel in an image, in addition to a color value (e.g. RGB), is well known to persons skilled in the art. To clarify the invention, the following description simply makes reference to color values of a blend. Processing starts at step 800. In step 802, the computer-generated graphical object is displayed on the video display system 716 by the computer 702. The graphical object consists of a number of pixels and the object itself is part of a computer-generated image displayed on the video display 716. The image includes one or more graphical object. To clarify the invention, only a single graphical object is referred to. However, it will be apparent to a person skilled in the art that the present invention is applicable to a plurality of separate graphical objects as well as complex graphical objects each containing a number of graphical objects. In step 804, at least two control points for controlling the color blend of the graphical object are provided. As will be described below, the control points are preferably represented by X's in Figs. 2 to 6 displayed to the user on the video display 716. In step 806, a check is made to determine if processing should terminate. If decision block 806 returns true (yes), processing terminates at step 814. Otherwise, if decision block 806 returns false (no), processing continues at step 808. In step 808, the user can manipulate one or more of the control points of the graphical object. Preferably, this is carried out by the user using the mouse 720 to click on one of the control points represented on the video display 716 and to alter its position, thereby affecting the color blend of the graphical object. As will be described below with reference to Figs. 2 to 6, this enables a user to finely control the color blend of a graphical object. In step 810. in response to interactive user inputs to manipulate the control points, the color blend of the graphical object is calculated dependent upon the alteration or movement of the control point(s). This processing is preferably carried out using the computer 702. The control points each have a corresponding color which relates to the color blend of the graphical object. Further, a notional line is defined between the first and second control points corresponding to the color blend between the colors of the first and the second control points. The direction and the gradient of the color blend within the graphical object is dependent upon the relative position of the control points in relation to the graphical object. In turn, the color of each point (e.g., pixel) within the graphical object is calculated dependent upon the projection of the point at a right angle onto the line between the two control points. In step 812, the graphical object having the modified color blend is displayed on the video display 716 by the computer 702. Preferably, the color blend of the graphical object is carried out interactively using steps 808 to 812 so that the displayed blend of the graphical object is modified and updated as the user clicks on and moves a control point. Processing then continues at decision block 806. It will be apparent to a person skilled in the art that while the flow diagram of Fig. 8 has a control loop beginning with the decision block 806 to determine if processing is to continue followed by steps 808 to 812, control of the processing can be equivalently governed in a number of other ways using differing control structures or loops without departing from the scope and spirit of the present invention. Fig. 9 is a detailed flow diagram illustrating the process of calculating the color/opacity values of points of the blend within the graphical object according to the preferred embodiment. The actual source code for implementing the preferred embodiment is set forth in Annexure A, which is incorporated herein by reference. Processing begins at step 900. In step 902, the color and/or opacity blends of the graphical object are checked to determine special cases. It will be appreciated by a person skilled in the art that the present invention is applicable to color blends of opacity blends, or a combination of the two. However, to clarify the invention, the invention Is simply described with reference to color blends. In this step, for example, the control points arc checked to determine if they are to close. In step 904, the data structure of the graphical object stored in memory is set up to contain blend values at a first scan line of the intersect and per scan line increments. In step 906, the color blend segments are calculated. In step 908, the opacity. blend segments are calculated. In step 910, if required, the color and opacity blend segments are merged together. In decision block 912, a check is made to determine if there are more scan lines to be processed. If decision block 912 returns false (no), processing terminates at step 914. Otherwise, if decision block 912 returns true (yes), processing continues at step 916. In step 916, the color blending is advanced to the next scan line. Processing then continues at step 906. In Figure 3. each of the object control points 5 and 6 can be independently moved, and therefore the object 4 has a differently oriented blend than that of Fig. 2 due to the blend points 5 and 6 having been moved to the points illustrated. Once moved, the blend is recalculated in the same way as the blend was originally calculated with reference to the object of to Fig. 2. By using control points to control the blend of an object, the method and apparatus according to the preferred embodiment allows for a much greater ability to control other aspects of the blend. For example, referring now to Fig. 4, the control points 5 and 6 arc moved away from one in relation to the object 4 to produce a lower gradient of the blend with finer changes in color. In Fig. 5, the control points 5 and 6 are moved close together inside the graphical object 4 to produce a greater gradient in the blend having a coarser change in color. In this case, those points of the object not lying between the control points 5 and 6 are preferably defined to have a color content value equal to that defined by the nearest one of control points 5 and 6 to produce a gradient of blend within object 4. It can therefore be seen that by using the control points to control the blend, accurate positioning and variation of the blend can be easily achieved. By making the control points 5 and 6 part of the structure utilised to define the object 4, they can be made to be always available to alter the blend of a graphical object at a later stage, thereby providing maximum flexibility. By way of example, reference is made to the method of Fig. 8 and the graphical object 4 shown in Figs. 4 and 5. Firstly, with reference to object 4 of Fig. 4, the graphical object 4 is displayed on the video display 716 in step 802 of Fig. 8. In step 804, the control points 5, 6, which form part of the graphical object 4, are provided. For example, the control points 5 an d6 can be positioned initially as shown in Fig. 4 for the color blend of Fig. 4. If processing has not been terminated by the user at decision block 806, execution continues at step 808. In step 806, the user can alter the blend by manipulating one of the control points 5, 6 using the mouse 720 of Fig. 7, for example. As such, the user could click on control point 5 and move it inwardly toward control point 6 and position it within graphical object 4. The preferred embodiment is preferably implemented by interactively update the blend of the graphical object 4, as a control point 5, 6 is moved. Thus, the color blend is recalculated in step 810 and the modified blend displayed in step 812, with processing continuing at step 806. These steps 806 to 812 can be repetatively carried out as the blend is incrementally updated with movement of the control point 5 from its initial position in Fig. 4 to final position inside the graphical object 4. Likewise, the second control point 6 can be moved inwardly and the blend of graphical object 4 interactively updated until the control point is released within the graphical object 4 as shown in Fig. In Fig. 5, instead of the graphical object 4 having a continuous blend throughout as shown in Fig. 4, the gradient of the blend is very steep in the intermediate region of the graphical object 4. The opposite end regions of the graphical object 4 corresponding to control points 5 and 6 are black and white, respectively, in accordance with the color of the respective control points. Referring now to Figure 6, there is shown a second graphical object 10 having blend control points 11 and 12. To calculate the color value of any point (P)13, within the object 10, the projection 14 of the point 13 onto the notional line between the control points 11 and 12 is first determined. The ratio of the distance between the points 11 and 14 and points 14 and 12 is then determined. The color of the point 13 can then be determined by a simple linear combination dependent on the distance. Points having a projection 14 that falls outside the interval between the control points 11 and 12 are assigned the color corresponding to the nearest control point 11 or 12. For example, the point 15 will have a projection outside the interval between 11 and 12. Therefore, the point 15 has its color assigned to be the same value as that of the control point 12. The color of the point 13 is calculated using Equation 1. If C1 is the defined color of the control point 11 and C2 is the defined color of the control point 12, the color value at point P is given by: C(P) = xC2 + (1-x)C1, where x is the ratio of the interval from the control point 11 to the point 14 in comparison with the interval from the control point 11 to the control point 12. A blend value need only be calculated for those points lying inside the object 10 and the well-known process of clipping can be used to determine those points lying within the graphical object 10. As stated previously, the process of calculation of a blend is known in the art. However, the embodiment of the invention is particularly advantageous in that the use of control points are provided. To further instruct those skilled in the art, the attached Appendix A includes a "C" program for the calculation of a blend on a scan line by scan line order in accordance with the above formula. The enclosed program includes portions which calculate a blend of an object given the color components of two control points. Of course, other known technologies could be used such as the well-known "filling" technique. Both of these techniques for rendering an image are disclosed in the standard reference such as Foley, Van Dam, et. al, Computer Graphics: Principles and Practice , Addison-Wesley Publishing Company, Inc., 1990. The present invention can be applied to a system constituted by a number of devices (e.g., host computer, interface, reader, printer) or to an apparatus comprising a single device (e.g., copy machine, facsimile). Further, the object of the present invention can be also achieved by providing a storage medium storing program codes for performing the aforesaid processes to a system or an apparatus. The program codes can be read by a computer (e.g., CPU, MPU) of the system or apparatus from the storage medium. The computer can then execute the program. In this case, the program codes read from the storage medium constitute an implementation or realization of the functions according to the above embodiment, and the storage medium storing the program codes constitutes another embodiment of the invention. Further, the storage medium (e.g., a floppy disk, a hard disk, an optical disk, a magneto-optical disk, CD-ROM. CD-R, a magnetic tape, a non-volatile type memory card, or a ROM) can be used for providing the program codes. Besides the aforesaid functions according to the above embodiments being realized by executing the program codes which are read by a computer, a further embodiment of the invention includes the case in which an operating system (OS) or the like carried out on the computer performs a part or entire processes in accordance with designations of the program codes and realizes functions according to the above embodiments. Finally, yet another embodiment of the invention also includes the case in which, after the program codes read from the storage medium are written in a function expansion card which can be inserted into the computer or in a memory provided in a function expansion unit which is connected to a computer (CPU) or the like contained in the function expansion card. the computer performs a part of or the entire process in accordance with designations of the program codes and realizes functions of the above embodiments. The foregoing describes a small number of embodiment of the present invention. Modifications and changes can be made thereto without departing from the scope of the invention. In the embodiments above, the computer 702 can be set up to perform the described operations by supplying it with a signal, which could for example be transmitted via a network such as the Internet or through "free space", to program the computer as required.

Claims: A method of determining a color blend of a computer graphical object (4), said method comprising the steps of: providing (804) a plurality of interactive control points (5, 6), each of said control points having an associated color value; and calculating the color value of each portion of said graphical object (4), the method being characterised in that the color value of each portion is calculated (810) dependent on the relative position of the portion to said control points (5, 6) and the calculated color values are clipped at the boundary of the graphical object (4). The method according to claim 1, wherein: the number of said control points (5, 6) is two; and portions of said graphical object (4) having a projection outside a line taken between the two control points are determined to have a color substantially the same as the closest one of said control points (5, 6). The method according to claim 1, wherein the position, or associated color value, or both, of each of said control points (5, 6) can be interactively altered (808). The method according to claim 3, further comprising the step of recalculating (810) said color values of each portion of said graphical object (4) when said control points (5, 6) are altered. The method according to claim 1, wherein said color blend comprises an opacity blend where each of said control points (5, 6) has an associated opacity value. An apparatus for determining a color blend of a computer graphical object, said apparatus comprising: means for defining a plurality of interactive control points (5, 6), each of said control points (5, 6) having an associated color value; and means for calculating a color value of each portion of said graphical object, the apparatus being characterised in that said means for calculating a color value is arranged to calculate the color value of each portion dependent on the relative position of the portion to said control points (5,6), and the calculated color values are clipped at the boundary of the graphical object (4). The apparatus according to claim 6, wherein the number of said control points (5, 6) is two; and said apparatus further comprises means for determining the color of portions of said graphical object (4) having a projection outside a line extending between the two control points whereby the color of each portion is assigned to be substantially the same as that of the closest one of said control points. The apparatus according to claim 6, including means for interactively altering the position, or associated color value, or both, of each of said control points (5, 6). The apparatus according to claim 8, further comprising means for recalculating said color values of each portion of said graphical object (4) when said control points are altered. The apparatus according to claim 6, wherein said color blend comprises an opacity blend where each of said control points (5, 6) has an associated opacity value. A computer program product comprising a computer usable medium having computer readable program code means embodied in said medium for determining a color blend of a computer graphical object, said product including: codes for defining a plurality of interactive control points (5, 6), each of said control points (5, 6) having an associated color value; and codes for calculating a color value of each portion of said graphical object (4) dependent on the position of the portion relative to said control points, and clipping the calculated color values at the boundary of the graphical object. A signal for causing a computer to perform a method according to any of claims 1 to 5.

Inventors: LONG TIMOTHY MERRICK, LONG, TIMOTHY MERRICK
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1996
Main classification: G06T11
IPC codes: G06T11, G09G5