CN106971411A - A kind of method and system of drawing image - Google Patents
A kind of method and system of drawing image Download PDFInfo
- Publication number
- CN106971411A CN106971411A CN201710146162.XA CN201710146162A CN106971411A CN 106971411 A CN106971411 A CN 106971411A CN 201710146162 A CN201710146162 A CN 201710146162A CN 106971411 A CN106971411 A CN 106971411A
- Authority
- CN
- China
- Prior art keywords
- color
- pixel
- algorithm
- line
- rendering
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
Abstract
The present invention provides a kind of method and system of drawing image, and methods described includes:Color assignment is carried out according to treating the order of the figure layer of drawing image from top to down by default Image Rendering algorithm graphing, and to each pixel in the figure;According to it is lower and on sequential processes described in transparent color point set in color assignment.The embodiment of the present invention, according to treating that the order of the figure layer of drawing image from top to down passes through default Image Rendering algorithm graphing, and color assignment is carried out to each pixel in figure, according to it is lower and on sequential processes described in transparent color point set in color assignment, the invalid color of single pixel point can be effectively reduced to set, color operand is reduced, accelerates to draw speed.
Description
Technical field
The present invention relates to computer graphics field, more particularly to a kind of method and system of drawing image.
Background technology
When X-Y scheme to be converted into the grid of computer display, it is necessary to using computer graphics phase inside the Pass
Hold.By related computer graphics algorithm and font Rendering, such as point can direct respective pixel point coordinates, line can
So that using linear equation, DDA algorithms or Bresenham line algorithms, face can use scan-line algorithm or internal from growth
Filling algorithm, word can use the FreeType that corresponding word Rendering is such as increased income, the algorithm or technology of the above
Result be all, by point, line, surface and text conversion into specific canvas coordinate, further according to the color of the figure, to draw painting canvas
The colouring information of the figure is recorded on coordinate, finally according to coordinate and color, file is preserved into or is entered using GDI technologies
Row output, so as to complete drafting.
Existing method for drafting, is the mode for imitating drawing, from bottom to top, carries out color addition, such as line face on the whole,
And line can pass through face, then the order requirements drawn must first draw face, line is then drawn again.For the two overlapping pixel
Point, the color of line is in the case of no transparency, and the color of line understands coverage rate, in the case where there is transparency, then needs first to take
The current color of the pixel, then computing is carried out with the color of line, show that new color value carries out assignment again.
Existing rendering technique from the bottom up, figure have it is overlapping in the case of, can repeat to carry out pixel
The change of color, and color computing and corresponding color copy can be related to during changing, this is huge in data volume, degree of overlapping
In the case of height, substantial amounts of useless calculating can be caused.The opaque color of the figure of the such as one pixel the superiors, still
Plot order from top to bottom, the color configuration information before the superiors are painted all is invalid, if top layer is with saturating
The color of lightness, down to opaque color, then it is invalid that the color under opaque color figure, which is set,.
And order from the bottom up, this just determines that drawing each time of calling can all influence current picture, even
This drafting content can be completely covered in last drawing result, and this also has led to all no completions of drafting and is impossible to
To end result.This can use asymptotic refreshing at some, i.e., that take out that middle states are shown in drawing process meeting is soft
Influence larger in part, it can clearly be seen that certain pixel can be refreshed with many times.
The content of the invention
In view of this, the present invention provides a kind of method and system of drawing image, to solve during prior art drawing image
Computationally intensive the problem of.
Specifically, the present invention is achieved through the following technical solutions:
The present invention provides a kind of method of drawing image, and methods described includes:
According to treating the order of the figure layer of drawing image from top to down by default Image Rendering algorithm graphing, and it is right
Each pixel in the figure carries out color assignment;
According to it is lower and on sequential processes described in transparent color point set in color assignment.
Present invention also offers a kind of system of drawing image, the system, including:
Color assignment unit, treats that the order of the figure layer of drawing image from top to down passes through default Image Rendering for basis
Algorithm graphing, and color assignment is carried out to each pixel in the figure;
Transparent color point set processing unit, for according to it is lower and on sequential processes described in transparent face in color assignment
Color dot collection.
The embodiment of the present invention, according to treating that the order of the figure layer of drawing image from top to down passes through default Image Rendering algorithm
Graphing, and in figure each pixel carry out color assignment, according to it is lower and on sequential processes described in color assign
Transparent color point set in value, can effectively reduce the invalid color of single pixel point and set, reduce color operand, accelerate to paint
Speed processed.
Brief description of the drawings
Fig. 1 is a kind of flow chart of the method for drawing image shown in an exemplary embodiment of the invention;
Fig. 2 is a kind of structure chart of the system of drawing image shown in an exemplary embodiment of the invention.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to
During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment
Described in embodiment do not represent and the consistent all embodiments of the present invention.On the contrary, they be only with it is such as appended
The example of the consistent apparatus and method of some aspects be described in detail in claims, the present invention.
It is the purpose only merely for description specific embodiment in terminology used in the present invention, and is not intended to be limiting the present invention.
" one kind ", " described " and "the" of singulative used in the present invention and appended claims are also intended to including majority
Form, unless context clearly shows that other implications.It is also understood that term "and/or" used herein refers to and wrapped
It may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the present invention
A little information should not necessarily be limited by these terms.These terms are only used for same type of information being distinguished from each other out.For example, not departing from
In the case of the scope of the invention, the first information can also be referred to as the second information, similarly, and the second information can also be referred to as
One information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determining ".
As shown in Figure 1 for a kind of drawing image shown in an exemplary embodiment of the invention method flow chart, it is described
Method includes:
Step S101, according to treating that the order of the figure layer of drawing image from top to down drawn by default Image Rendering algorithm
Figure, and color assignment is carried out to each pixel in the figure.
In embodiments of the present invention, image to be drawn generally includes multiple figure layers, and the process of computer drawing image was both
It is the process for the multiple figure layers for drawing this image.Obtain first and treat the figure layer of drawing image, according to figure layer from top to bottom suitable
Sequence graphing, wherein, figure includes but is not limited to:Point, line, surface, word.For different figures, it is necessary to using different
Rendering algorithm is drawn to it, including:The algorithm that line is drawn includes but is not limited to:Linear equation, DDA (Digital
Differential Analyzer, numerical differentiation) algorithm or Bresenham line algorithms;The algorithm that face is drawn includes
But it is not limited to:Scan-line algorithm is internal from growth algorithm;The algorithm that word is drawn includes but is not limited to:FreeType etc.
Word Rendering.It is pointed out that the output result of above-mentioned various algorithms is coordinate point set, it is convenient follow-up to the seat
Punctuate set carries out pointwise processing.
Each pixel in the figure carries out color assignment, including:
1st, according to size, the color bands number requirement application internal memory for treating rendering context;
2nd, treat that the color of rendering context carries out the initialization of internal memory according to;
3rd, the corresponding memory address of the pixel is obtained according to the coordinate of the pixel, and colouring information setting is arrived
In the memory address.
It is pointed out that the figure records the drafting state of each pixel of the figure by Boolean matrix.
Due to needing component layer to be drawn from top to down, it is therefore desirable to record painting for each pixel by Boolean matrix
State processed.When paintbrush is associated with painting canvas, the wide high level of the painting canvas is read, then applies for that width is multiplied by high boolean's array,
And its initial value is set to vacation.When pixel color is set every time, first according to the coordinate value of pixel, the picture is calculated
The Boolean matrix position of vegetarian refreshments, and take out its value and judged, if very, then directly ignoring the setting of this color, if false, then
Judge the transparency of the pixel color, if opaque, then the color is directly set, if the pixel color has transparent
Degree, then carry out face when its pixel and color being stored in inside paintbrush, then terminate to draw according to order from below to up
The superposition of color.
It is pointed out that the color of the embodiment of the present invention is entered as drawing a figure layer, the figure layer to drafting carries out face
Color assignment, rather than after All Layers are completed, color assignment is carried out to all figure layers.
Step S102, according to it is lower and on sequential processes described in transparent color point set in color assignment.
In embodiments of the present invention, after color assignment has been carried out, it is necessary to in each figure layer intersection it is transparent
Information is handled, and is specially:Taken out according to the storage order inverted sequence of point set, because storage process is from top to down, and face
The mixture of colours needs to know background colour in advance, it is therefore desirable to carry out blend of colors from bottom to up.After graphic plotting terminates, it is depicted as
Fruit is preserved into file or exported using GDI technologies, completes to draw.
The embodiment of the present invention, according to treating that the order of the figure layer of drawing image from top to down passes through default Image Rendering algorithm
Graphing, and in figure each pixel carry out color assignment, according to it is lower and on sequential processes described in color assign
Transparent color point set in value, can effectively reduce the invalid color of single pixel point and set, reduce color operand, accelerate to paint
Speed processed.
A kind of structure chart of the system for the drawing image being illustrated in figure 2 shown in an exemplary embodiment of the invention, it is described
System includes:
Color assignment unit 201, treats that the order of the figure layer of drawing image from top to down passes through default image for basis
Rendering algorithm graphing, and color assignment is carried out to each pixel in the figure.
In embodiments of the present invention, image to be drawn generally includes multiple figure layers, and the process of computer drawing image was both
It is the process for the multiple figure layers for drawing this image.Obtain first and treat the figure layer of drawing image, according to figure layer from top to bottom suitable
Sequence graphing, wherein, figure includes but is not limited to:Point, line, surface, word.For different figures, it is necessary to using different
Rendering algorithm is drawn to it, is specially:Including:The algorithm that line is drawn includes but is not limited to:Linear equation, DDA
(Digital Differential Analyzer, numerical differentiation) algorithm or Bresenham line algorithms;Drawn in face
Algorithm include but is not limited to:Scan-line algorithm is internal from growth algorithm;The algorithm that word is drawn includes but is not limited to:
The word Rendering such as FreeType.It is pointed out that the output result of above-mentioned various algorithms is coordinate point set, it is convenient
It is follow-up that pointwise processing is carried out to the coordinate point set.
Each pixel in the figure carries out color assignment, including:
1st, according to size, the color bands number requirement application internal memory for treating rendering context;
2nd, treat that the color of rendering context carries out the initialization of internal memory according to;
3rd, the corresponding memory address of the pixel is obtained according to the coordinate of the pixel, and colouring information setting is arrived
In the memory address.
It is pointed out that the figure records the drafting state of each pixel of the figure by Boolean matrix.
Due to needing component layer to be drawn from top to down, it is therefore desirable to record painting for each pixel by Boolean matrix
State processed.When paintbrush is associated with painting canvas, the wide high level of the painting canvas is read, then applies for that width is multiplied by high boolean's array,
And its initial value is set to vacation.When pixel color is set every time, first according to the coordinate value of pixel, the picture is calculated
The Boolean matrix position of vegetarian refreshments, and take out its value and judged, if very, then directly ignoring the setting of this color, if false, then
Judge the transparency of the pixel color, if opaque, then the color is directly set, if the pixel color has transparent
Degree, then carry out face when its pixel and color being stored in inside paintbrush, then terminate to draw according to order from below to up
The superposition of color.
It is pointed out that the color of the embodiment of the present invention is entered as drawing a figure layer, the figure layer to drafting carries out face
Color assignment, rather than after All Layers are completed, color assignment is carried out to all figure layers.
Transparent color point set processing unit 202, for according to it is lower and on sequential processes described in it is saturating in color assignment
Bright color point set.
In embodiments of the present invention, after color assignment has been carried out, it is necessary to in each figure layer intersection it is transparent
Information is handled, and is specially:Taken out according to the storage order inverted sequence of point set, because storage process is from top to down, and face
The mixture of colours needs to know background colour in advance, it is therefore desirable to carry out blend of colors from bottom to up.After graphic plotting terminates, it is depicted as
Fruit is preserved into file or exported using GDI technologies, completes to draw.
The embodiment of the present invention, according to treating that the order of the figure layer of drawing image from top to down passes through default Image Rendering algorithm
Graphing, and in figure each pixel carry out color assignment, according to it is lower and on sequential processes described in color assign
Transparent color point set in value, can effectively reduce the invalid color of single pixel point and set, reduce color operand, accelerate to paint
Speed processed.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component can
To be or may not be physically separate, the part shown as unit can be or may not be physics list
Member, you can with positioned at a place, or can also be distributed on multiple NEs.It can be selected according to the actual needs
In some or all of module realize the purpose of the present invention program.Those of ordinary skill in the art are not paying creative labor
In the case of dynamic, you can to understand and implement.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
God is with principle, and any modification, equivalent substitution and improvements done etc. should be included within the scope of protection of the invention.
Claims (10)
1. a kind of method of drawing image, it is characterised in that methods described includes:
According to treating the order of the figure layer of drawing image from top to down by default Image Rendering algorithm graphing, and to described
Each pixel in figure carries out color assignment;
According to it is lower and on sequential processes described in transparent color point set in color assignment.
2. the method as described in claim 1, it is characterised in that the figure includes:Point, line, surface, word.
3. method as claimed in claim 2, it is characterised in that the basis treats the order of the figure layer of drawing image from top to down
By default Image Rendering algorithm graphing, including:
Line is drawn using linear equation, numerical differentiation DDA algorithms or Bresenham line algorithms;And/or,
Use scan-line algorithm or internal from growth algorithm drafting face;And/or,
Word is drawn using FreeType words Rendering.
4. the method as described in claim 1, it is characterised in that each pixel in the figure carries out color tax
Value, including:
According to size, the color bands number requirement application internal memory for treating rendering context;
The initialization of internal memory is carried out according to the color for treating rendering context;
The corresponding memory address of the pixel is obtained according to the coordinate of the pixel, and colouring information is set in described
Deposit in address.
5. the method as described in claim 1, it is characterised in that the figure records each of the figure by Boolean matrix
The drafting state of pixel.
6. a kind of system of drawing image, it is characterised in that the system includes:
Color assignment unit, treats that the order of the figure layer of drawing image from top to down passes through default Image Rendering algorithm for basis
Graphing, and color assignment is carried out to each pixel in the figure;
Transparent color point set processing unit, for according to it is lower and on sequential processes described in transparent color point in color assignment
Collection.
7. system as claimed in claim 6, it is characterised in that the figure includes:Point, line, surface, word.
8. system as claimed in claim 7, it is characterised in that the basis treats the order of the figure layer of drawing image from top to down
By default Image Rendering algorithm graphing, including:
Line is drawn using linear equation, numerical differentiation DDA algorithms or Bresenham line algorithms;And/or,
Use scan-line algorithm or internal from growth algorithm drafting face;And/or,
Word is drawn using FreeType words Rendering.
9. system as claimed in claim 6, it is characterised in that each pixel in the figure carries out color tax
Value, including:
According to size, the color bands number requirement application internal memory for treating rendering context;
The initialization of internal memory is carried out according to the color for treating rendering context;
The corresponding memory address of the pixel is obtained according to the coordinate of the pixel, and colouring information is set in described
Deposit in address.
10. system as claimed in claim 6, it is characterised in that the figure records the every of the figure by Boolean matrix
The drafting state of individual pixel.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710146162.XA CN106971411A (en) | 2017-03-13 | 2017-03-13 | A kind of method and system of drawing image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710146162.XA CN106971411A (en) | 2017-03-13 | 2017-03-13 | A kind of method and system of drawing image |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106971411A true CN106971411A (en) | 2017-07-21 |
Family
ID=59329711
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710146162.XA Pending CN106971411A (en) | 2017-03-13 | 2017-03-13 | A kind of method and system of drawing image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106971411A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108449590A (en) * | 2018-03-30 | 2018-08-24 | 盎锐(上海)信息科技有限公司 | Image processing method and device |
CN110209444A (en) * | 2019-03-20 | 2019-09-06 | 华为技术有限公司 | A kind of method for rendering graph and electronic equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101303849A (en) * | 2007-05-11 | 2008-11-12 | 深圳迈瑞生物医疗电子股份有限公司 | Method and apparatus for rapidly displaying lapped arbitrary shape rarefaction pattern without twinkling |
CN201355252Y (en) * | 2009-02-25 | 2009-12-02 | 江苏新科软件有限公司 | Navigation device capable of smoothly scrolling map |
CN102496169A (en) * | 2011-11-30 | 2012-06-13 | 威盛电子股份有限公司 | Method and device for drawing overlapped object |
CN104010217A (en) * | 2014-05-22 | 2014-08-27 | Tcl集团股份有限公司 | Method and device for mixed display |
CN104038807A (en) * | 2014-06-13 | 2014-09-10 | Tcl集团股份有限公司 | Layer mixing method and device based on open graphics library (OpenGL) |
-
2017
- 2017-03-13 CN CN201710146162.XA patent/CN106971411A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101303849A (en) * | 2007-05-11 | 2008-11-12 | 深圳迈瑞生物医疗电子股份有限公司 | Method and apparatus for rapidly displaying lapped arbitrary shape rarefaction pattern without twinkling |
CN201355252Y (en) * | 2009-02-25 | 2009-12-02 | 江苏新科软件有限公司 | Navigation device capable of smoothly scrolling map |
CN102496169A (en) * | 2011-11-30 | 2012-06-13 | 威盛电子股份有限公司 | Method and device for drawing overlapped object |
CN104010217A (en) * | 2014-05-22 | 2014-08-27 | Tcl集团股份有限公司 | Method and device for mixed display |
CN104038807A (en) * | 2014-06-13 | 2014-09-10 | Tcl集团股份有限公司 | Layer mixing method and device based on open graphics library (OpenGL) |
Non-Patent Citations (5)
Title |
---|
刘金涛: ""基于帧同步校准的多源视频拼接技术研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑(月刊)》 * |
周晨: ""基于地理信息系统的农村电网线损管理系统"", 《机电技术》 * |
林其伟 等: ""井径信号数字化及处理系统"", 《工业控制计算机》 * |
王焱姣: ""基于分形图案的NVD音频播放背景动画"", 《中国优秀硕士学位论文全文数据库 信息科技辑 (月刊)》 * |
程红梅 等: ""纹织CAD中多层显示组件的设计"", 《研究技术》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108449590A (en) * | 2018-03-30 | 2018-08-24 | 盎锐(上海)信息科技有限公司 | Image processing method and device |
CN108449590B (en) * | 2018-03-30 | 2020-02-11 | 盎锐(上海)信息科技有限公司 | Image processing method and device |
CN110209444A (en) * | 2019-03-20 | 2019-09-06 | 华为技术有限公司 | A kind of method for rendering graph and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10706599B2 (en) | Recursive cell-based hierarchy for data visualizations | |
US7825941B1 (en) | Processing illustration artwork | |
US6515675B1 (en) | Processing opaque pieces of illustration artwork | |
US6720977B1 (en) | Processing illustration artwork | |
GB2059727A (en) | Digital data display system | |
CN108959201B (en) | The method for drafting and E-book reader of E-book reader handwriting | |
CN106775429A (en) | A kind of method and apparatus based on setting-out storage on touch-screen | |
CN106971411A (en) | A kind of method and system of drawing image | |
US11620503B2 (en) | Neural network processing | |
CN110471607B (en) | Handwriting display method, handwriting reading equipment and computer storage medium | |
US5748946A (en) | Method and apparatus for improved graphics picking using auxiliary buffer information | |
CN109960543B (en) | Writing operation processing method and device | |
CN106297477A (en) | A kind of method and device generating digitized copybook | |
US4967376A (en) | Method for displaying characters and/or figures in a computer graphics and apparatus thereof | |
JP3352458B2 (en) | Graphic Coloring Method for Graphic Display System | |
Jia et al. | Fractional calculus method for enhancing digital image of bank slip | |
CN103593862A (en) | Image display method and control unit | |
EP0026269A1 (en) | Digital colour data display system | |
JPH07120427B2 (en) | Graphic processing system | |
CN108198233A (en) | A kind of method for drafting, electronic equipment and the storage medium of K line charts | |
CN106933486A (en) | For the touch-control implementation method and device of Android system | |
CN114638916A (en) | Graphic display method of frame buffer display framework of linux system in multi-parameter monitor | |
CN107240142A (en) | Pattern drawing method and device | |
JP2835056B2 (en) | High quality character pattern generation method | |
Willis et al. | Colour raster operations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170721 |
|
RJ01 | Rejection of invention patent application after publication |