1. Technical Field
The embodiments of the present disclosure relate to drawing systems and methods, and particularly to a computing device and a method for generating drawing codes of pictures.
2. Description of Related Art
Many graphics applications are provided for users to draw pictures. However, the graphics applications can only generate pictures for display, and cannot generate drawing codes. Sometimes it is not convenient to perform further processes on the pictures without the drawing codes.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
In general, the word “module”, as used herein, refers to logic embodied in computing or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an erasable programmable read only memory (EPROM). The modules described herein may be implemented as either software and/or computing modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
In step S301, the definition module 200 defines a plurality of drawing elements, and defines a drawing model for each of the drawing elements. The drawing elements may include shape elements, e.g. a rectangle element and a circle element, to draw different shapes in pictures. The drawing elements may further include operation elements, e.g. a rotation element and a zoom element, to operate on the shapes in pictures. In one embodiment, each drawing element may be represented by an icon, which is displayed on a user interface when pictures are being drawn. Each drawing model consists of a block of program codes and includes one or more drawing parameters. In one example, a drawing model of a line element may include coordinates of a start point and coordinates of an end point. In another example, a drawing model of a circle element may include coordinates of a center, a radius, a start angle, an end angle of the circle, and a formation direction (clockwise or counter-clockwise).
When a user selects one of the drawing elements to draw a picture, in step S302, the obtaining module 210 obtains parameter values of the selected drawing element. For example, a line element is selected by the user to draw a line in a picture. Coordinates of a start point of the line are (1, 1). Coordinates of an end point of the line are (5, 6).
In step S303, the replacement module 220 replaces drawing parameters of a drawing model of the selected drawing element with the parameter values, to obtain drawing codes corresponding to the selected drawing element. For example, a line element is selected by the user to draw a line in a picture. Coordinates of a start point of the line are (1, 1). Coordinates of an end point of the line are (5, 6). Therefore, coordinates of a start point of a drawing model of a line element is replaced by (1, 1), and coordinates of an end point of the drawing model of a line element is replaced by (5, 6), to obtain drawing codes corresponding to the selected line element.
In step S304, the integration module 230 records a sequence of drawing steps of the picture, integrates drawing codes corresponding to each selected drawing element according to the sequence, and stores the integrated drawing codes into the storage system 12. In one example, the user draws a line, a rectangle, and a circle in sequence. The integration module 230 integrates drawing codes corresponding to the line, drawing codes corresponding to the rectangle, and drawing codes corresponding to the circle to generate overall drawing codes of the picture. In one embodiment, the integration module 230 further displays the integrated drawing codes of the picture on the display device 14.
In step S305, the conversion module 240 converts the integrated drawing codes of the picture into a specified format, and stores the integrated drawing codes in the specified format into the storage system 12. In this way, the picture is able to be displayed in a specified environment (e.g., on a webpage). In one embodiment, the conversion module 240 adds tags (e.g., HTML tags) to the integrated drawing codes. In accordance with the integrated drawing codes and the tags, the picture can be displayed on a webpage.
Although certain disclosed embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
2012101702197 | May 2012 | CN | national |