CN107643933A - Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen - Google Patents

Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen Download PDF

Info

Publication number
CN107643933A
CN107643933A CN201710859384.6A CN201710859384A CN107643933A CN 107643933 A CN107643933 A CN 107643933A CN 201710859384 A CN201710859384 A CN 201710859384A CN 107643933 A CN107643933 A CN 107643933A
Authority
CN
China
Prior art keywords
configuration
curve
screen
refresh
coordinate
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
Application number
CN201710859384.6A
Other languages
Chinese (zh)
Inventor
朱启文
周亚凤
刘豫东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing College of Information Technology
Original Assignee
Nanjing College of Information Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nanjing College of Information Technology filed Critical Nanjing College of Information Technology
Priority to CN201710859384.6A priority Critical patent/CN107643933A/en
Publication of CN107643933A publication Critical patent/CN107643933A/en
Pending legal-status Critical Current

Links

Abstract

A kind of dynamic draws the method for drafting with gradual change shade curve to mobile phone screen, and step includes:The step 1)Parameter configuration includes cached parameters configuration, color configuration and timer configuration, coordinate parameters configuration;Wherein, in each configuration process, disposable allocating cache parameter, color configuration, timer configuration after system initialization, the operand that figure layer is drawn is reduced, coordinate configuration configures in figure layer drawing process;The step 2)Data buffer storage includes data cached and renewal reference point;Real time data is cached to and is dynamically assigning in internal memory, and marks current position, if beyond the scope of dynamically distributes data buffer storage length, is covered from original position, continues to cache, and refreshes screen, updates reference point;The step 3)Dynamic refresh, periodic refreshing screen is set, and the refresh rate of setting and the screen-refresh of operating system are consistent;The step 4)Figure layer, which is drawn, includes data boundary processing, coordinate calculates, rendering parameter configures and draws curve and gradual change.

Description

Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen
Technical field
The technical program is related to the scheme that a kind of dynamic draws curve, especially a kind of real-time with dynamic fade background The method for drafting of curve, belongs to software field.
Background technology
In the prior art, draw pixel has much to the method for mobile phone screen, and IOS realizes the API bags that graphical programming uses Include:UIKIT, Core Graphics, OpenGL ES, GLKit etc., the drafting that these API are included are operated all in a figure ring Drawn in border.For example, UIKIT is one group of Objective-c API, be basic bargraphs, color operations, The animation of 2D draftings, image procossing and user interface level.OpenGL ES be the standard that a set of function opens be used to slip into be The C-based of system shape library, the visualization for 2D and 3D data, it is possible to achieve GPU's is hardware-accelerated, and GPU performs figure Order, it is possible to achieve the drafting of complex figure.OpenGL ES framework specifications are complicated, it is not easy to and it is integrated, realize that difficulty is larger, therefore The framework is not used.
Gradual change shade curve is highlighted for real-time data curve, curve as shown in figure 1, background inclined stripe is background picture It is the shade of gradual change below.Traditional method, gradual change background that can not be below drawing data curve, the technical scheme, main solution Certainly this problem.
The content of the invention
In order to solve the above-mentioned problems in the prior art, the technical program proposes that a kind of dynamic draws band gradual change shade To the method for drafting of mobile phone screen, step includes curve:1)Parameter configuration;2)Data buffer storage;3)Dynamic refresh;4)Figure layer is painted System;
The step 1)Parameter configuration includes cached parameters configuration, color configuration and timer configuration, coordinate parameters configuration;
Wherein, in each configuration process, disposable allocating cache parameter, color configuration, timer configuration after system initialization, The operand that figure layer is drawn is reduced, coordinate configuration configures in figure layer drawing process;
The step 2)Data buffer storage includes data cached and renewal reference point;
Real time data is cached to and is dynamically assigning in internal memory, and marks current position, if exceeding dynamically distributes data buffer storage The scope of length, then covered from original position, continue to cache, and refresh screen, update reference point;
The step 3)Dynamic refresh, sets periodic refreshing screen, and the refresh rate of setting and the screen-refresh of operating system are kept Unanimously;
The step 4)Figure layer, which is drawn, includes data boundary processing, coordinate calculates, rendering parameter configuration and drafting curve and gradually Become, specifically comprise the following steps:
The complete gradual change background of Drawing of Curve:
4.1)Travel through data cached, find out maximum MAX and minimum value MIN, calculating difference DIF=MAX-MIN, and unit Coordinate P corresponding to numerical value,
4.2)Coordinate point-rendering curve obtained by as the line color of establishment and with data cached calculating;
4.3)Pass through CGContextSetShouldAntialias (UIGraphicsGetCurrentContext (), YES) Function eliminates the crenellated phenomena of curve;
4.4)The mask of image is realized by CGContextSetBlendMode functions, and mask scope is that drafting obtains curve The latter half.
Compared with prior art, parameter configuration in the technical program, partial parameters are disposably configured, it is more when preventing from drawing Secondary configuration reduces efficiency;Data buffer storage separates with refreshing and using CADisplayLink, prevents interface interim card, make curve with Screen refreshes simultaneously, improves the efficiency of drafting;Data boundary processing, allow all data more whole than being more completely shown in In drawing area, maximization is reached.
Brief description of the drawings
Fig. 1 is the principle schematic of this method.
Fig. 2 is the schematic diagram of " the gradual change shade curve " of mobile phone screenshotss.
Embodiment
The technical program is further illustrated with embodiment below in conjunction with the accompanying drawings:
Such as Fig. 1, a kind of dynamic draws the method for drafting with gradual change shade curve to mobile phone screen, and step includes:1)Parameter configuration; 2)Data buffer storage;3)Dynamic refresh;4)Figure layer is drawn;
The step 1)Parameter configuration includes cached parameters configuration, color configuration and timer configuration, coordinate parameters configuration;
Wherein, in each configuration process, disposable allocating cache parameter, color configuration, timer configuration after system initialization, The operand that figure layer is drawn is reduced, coordinate configuration configures in figure layer drawing process;
The step 2)Data buffer storage includes data cached and renewal reference point;
Real time data is cached to and is dynamically assigning in internal memory, and marks current position, if exceeding dynamically distributes data buffer storage The scope of length, then covered from original position, continue to cache, and refresh screen, update reference point;
The step 3)Dynamic refresh, sets periodic refreshing screen, and the refresh rate of setting and the screen-refresh of operating system are kept Unanimously;
The step 4)Figure layer, which is drawn, includes data boundary processing, coordinate calculates, rendering parameter configuration and drafting curve and gradually Become, specifically comprise the following steps:
The complete gradual change background of Drawing of Curve:
4.1)Travel through data cached, find out maximum MAX and minimum value MIN, calculating difference DIF=MAX-MIN, and unit Coordinate P corresponding to numerical value,
4.2)Coordinate point-rendering curve obtained by as the line color of establishment and with data cached calculating;
4.3)Pass through CGContextSetShouldAntialias (UIGraphicsGetCurrentContext (), YES) Function eliminates the crenellated phenomena of curve;
4.4)The mask of image is realized by CGContextSetBlendMode functions, and mask scope is that drafting obtains curve The latter half.
Such as Fig. 2, this example uses the curve with gradual change shade of Quartz Engine draws.Core Graphic are a set of C- The drafting of the content such as base API, supporting vector image, line, shape, pattern, path, Quartz 2D are Core Graphics 2D draw present engine.Quartz provides path drawing, gradient filling pattern, image, hyaline layer drafting, shade, covering, face Colour tube reason, Coordinate Conversion etc..Quartz can be used together with all figures with cartoon technique.
Parameter configuration is realized:
By calling calloc function dynamic assigning memory, for caching curve data;By calling CGColorCreate letters Number, line color is created, by CGGradientCreateWithColors function creation background graduated colors, create timer CADisplayLink draws curve with screen, improves the efficiency for drawing curve.
Data buffer storage:
Real time data is cached to and is dynamically assigning in internal memory, and marks current position, if going beyond the scope, from starting position Covering, continues to cache, and refresh screen.
Dynamic refresh
CADisplayLink refreshing frequency is consistent with screen-refresh, screen-refresh is made full use of, reduces curve card The phenomenon paused.
Figure layer is drawn:
The complete gradual change background of Drawing of Curve Drawing of Curve, searches data cached border, reduces the scope of data display, make song Line maximum can utilize screen, draw curve by the line color of establishment, pass through CGContextSetShouldAntialias Function eliminates the crenellated phenomena of curve, realizes mask by CGContextSetBlendMode functions, and mask scope is drafting Curve the latter half, make gradual change shade that there is dynamic effect, and data and curves can more clearly be shown.
Using the inventive method, band gradual change shade that is quick and convenient, and meeting drafting is realized using existing drawing engine The requirement of curve.

Claims (1)

1. a kind of dynamic draws the method for drafting with gradual change shade curve to mobile phone screen, it is characterized in that step includes:1)Parameter Configuration;2)Data buffer storage;3)Dynamic refresh;4)Figure layer is drawn;
The step 1)Parameter configuration includes cached parameters configuration, color configuration and timer configuration, coordinate parameters configuration;
Wherein, in each configuration process, disposable allocating cache parameter, color configuration, timer configuration after system initialization, The operand that figure layer is drawn is reduced, coordinate configuration configures in figure layer drawing process;
The step 2)Data buffer storage includes data cached and renewal reference point;
Real time data is cached to and is dynamically assigning in internal memory, and marks current position, if exceeding dynamically distributes data buffer storage The scope of length, then covered from original position, continue to cache, and refresh screen, update reference point;
The step 3)Dynamic refresh, sets periodic refreshing screen, and the refresh rate of setting and the screen-refresh of operating system are kept Unanimously;
The step 4)Figure layer, which is drawn, includes data boundary processing, coordinate calculates, rendering parameter configuration and drafting curve and gradually Become;Specifically comprise the following steps:
4.1)Travel through data cached, find out maximum MAX and minimum value MIN, calculating difference DIF=MAX-MIN, and unit Coordinate P corresponding to numerical value;
4.2)Coordinate point-rendering curve obtained by as the line color of establishment and with data cached calculating;
4.3)Pass through CGContextSetShouldAntialias (UIGraphicsGetCurrentContext (), YES) letter Number eliminates the crenellated phenomena of curve;
4.4)The mask of image is realized by CGContextSetBlendMode functions, and mask scope is that drafting obtains curve The latter half.
CN201710859384.6A 2017-09-21 2017-09-21 Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen Pending CN107643933A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710859384.6A CN107643933A (en) 2017-09-21 2017-09-21 Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710859384.6A CN107643933A (en) 2017-09-21 2017-09-21 Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen

Publications (1)

Publication Number Publication Date
CN107643933A true CN107643933A (en) 2018-01-30

Family

ID=61111741

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710859384.6A Pending CN107643933A (en) 2017-09-21 2017-09-21 Dynamic draws the method for drafting with gradual change shade curve to mobile phone screen

Country Status (1)

Country Link
CN (1) CN107643933A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106023279A (en) * 2016-05-09 2016-10-12 广州视睿电子科技有限公司 Curve drawing method and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106023279A (en) * 2016-05-09 2016-10-12 广州视睿电子科技有限公司 Curve drawing method and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ANDREW KHARCHYSHYN: ""Core Graphics Tutorial Part 2: Gradients and Contexts"", 《HTTPS://WWW.RAYWENDERLICH.COM/410-CORE-GRAPHICS-TUTORIAL-PART-2-GRADIENTS-AND-CONTEXTS》 *
GEORGEWANG: ""WYChart介绍系列(三)线型图绘制以及WYChart介绍系列(四)线型图动画的实现"", 《HTTP://BLOG.ONEINBEST.COM/2016/10/14/WYCHART-介绍系列-三-线性图绘制/》 *
VEGDA NEEL: ""Animate a CGPath with a gradient fill"", 《HTTPS://STACKOVERFLOW.COM/QUESTIONS/39204225/ANIMATE-A-CGPATH-WITH-A-GRADIENT-FILL?RQ=1》 *

Similar Documents

Publication Publication Date Title
CN102306391B (en) OpenGL (open graphics library)-based inverted image display processing device and method
US9760968B2 (en) Reduction of graphical processing through coverage testing
CN105233498B (en) Game role colouring method, device, user terminal and game system
CN107564087B (en) A kind of Three-D linear symbol rendering method based on screen
CN107369205B (en) Mobile terminal city two-dimensional and three-dimensional linkage display method
SG11201903476UA (en) Method and apparatus for animating images on mobile devices
WO2017097143A1 (en) Method and device for setting interface switch animation
CN110555895A (en) Utilizing inter-frame coherency in a medium ordering architecture
CN108932745A (en) image drawing method, device, terminal device and computer readable storage medium
CN106534880A (en) Video synthesis method and device
CN104392479B (en) Method of carrying out illumination coloring on pixel by using light index number
CN105872418A (en) Method and device for superimposing a GUI (Graphical User Interface) image layer on a digital image
CN101021952A (en) Method and apparatus for realizing three-dimensional video special efficiency
CN106709863A (en) GPU-based efficient 2D vector graph rendering method
CN101908216B (en) Method and device for realizing vector fonts
CN107346250A (en) A kind of stacking display algorithm of the progress bar of breath light effect
CN104063888B (en) A kind of wave spectrum artistic style method for drafting based on feeling of unreality
CN106502662A (en) Multizone pattern drawing method and device for intelligent operating system
US10152809B2 (en) Contour gradients using three-dimensional models
CN105427358B (en) View animation generation method and system based on android
CN102819855A (en) Method and device for generating two-dimensional images
CN108153526A (en) A kind of reusable control corners setting method
CN107527377B (en) Three-dimensional virtual earth-suspended Chinese character rendering method based on mobile platform
CN104516621A (en) Cursor display method and device
CN105791764A (en) Video monitoring image display method based on three-dimensional image

Legal Events

Date Code Title Description
PB01 Publication
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: 20180130

RJ01 Rejection of invention patent application after publication