Real-time picture mark drawing method and device and error scanning equipment
By using a dual-layer caching technique, the drawing content is separated into a real-time drawing layer and a cached drawing layer, which solves the performance degradation problem caused by the large number or high frequency of path points in traditional drawing techniques, and achieves efficient and smooth real-time drawing effects.
Patent Information
- Application Number
- CN202511763839.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-03
AI Technical Summary
Existing single-path cumulative rendering schemes result in significant performance overhead and frame rate drops when the number of path points is large or the rendering frequency is high, affecting rendering smoothness and real-time response performance.
A real-time image marking and drawing method based on dual-layer caching is adopted. The drawing content is separated by a real-time drawing layer and a cache drawing layer. The real-time drawing layer is used for lightweight incremental drawing, while the cache drawing layer is used for persistent storage, reducing redundant calculations. The image is generated by rendering the cached incremental path fragments.
It improves rendering performance, reduces interface lag and operation delay, and achieves an efficient and smooth real-time rendering experience.
Smart Images

Figure CN121597091A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and more specifically, to a real-time image marking and drawing method, apparatus, and error scanning device. Background Technology
[0002] Currently, the most common drawing method in mainstream mobile operating systems (such as Android and iOS) is the single-path cumulative drawing scheme. This scheme is the most basic and commonly used implementation method for graphics APIs (such as Android's Canvas and Path interfaces), and it is documented in a large number of publicly available technical documents and development tutorials, such as the usage guide for the Canvas and Path classes in the official Android developer documentation.
[0003] In the above scheme, the system typically draws according to the following process: 1) Path accumulation: When the user starts drawing on the touchscreen (i.e., when a touch event ACTION_DOWN is received), the system first creates an empty Path object. As the user's finger moves (ACTION_MOVE), the system appends each sampled touch coordinate point to the Path object sequentially, for example, by calling the path.lineTo(x,y) method to achieve continuous path accumulation. 2) Full redraw: When the screen needs to be refreshed (usually during the rendering phase of each frame), the system calls the Canvas.drawPath(Path, Paint) method to draw. At this time, the drawing engine needs to traverse and process all the historical coordinate points stored in the Path object, calculating and rendering the entire path sequentially from the starting point to the ending point.
[0004] The above-mentioned drawing mechanism is simple to implement and highly compatible, making it suitable for general path drawing scenarios. However, when the number of path points is large or the drawing frequency is high, this solution requires repeated redrawing of the entire path, which can easily lead to significant performance overhead and frame rate drops, thus affecting the smoothness of drawing and real-time response performance.
[0005] There is currently no effective solution to the above problems. Summary of the Invention
[0006] This invention provides a real-time image marking drawing method, apparatus, and error scanning device to at least solve the technical problems of interface lag and operation delay in traditional drawing techniques as the marking complexity increases.
[0007] According to one aspect of the present invention, a real-time image marker drawing method based on dual-layer caching is provided, comprising: capturing user touch events in real time, wherein the touch events include touch press events, touch move events, and touch release events; when the captured user touch event is a touch press event, drawing a touch point on a real-time drawing layer as a previous touch point; when the captured user touch event is the touch move event, generating an incremental path segment between the previous touch point and the current touch point on the real-time drawing layer based on the coordinates of the current touch point and the previous touch point, wherein the incremental path segment consists only of the previous touch point and the current touch point; when the captured user touch event is a touch release event or when a drawing segment interruption is detected, saving the incremental path segment or the drawing instruction of the incremental path segment to a cache drawing layer, and rendering a screen buffer based on all data of the cache drawing layer or the incremental path segment to generate a corresponding image.
[0008] According to another aspect of the present invention, a real-time image marker drawing device based on a dual-layer cache is also provided, comprising: a capture module configured to capture user touch events in real time, wherein the touch events include touch press events, touch move events, and touch release events; a point drawing module configured to draw a touch point as a previous touch point on a real-time drawing layer when the captured user touch event is a touch press event; a path drawing module configured to generate an incremental path segment between the previous touch point and the current touch point on the real-time drawing layer based on the coordinates of the current touch point and the previous touch point when the captured user touch event is the touch move event, wherein the incremental path segment consists only of the previous touch point and the current touch point; and a rendering module configured to save the incremental path segment or the drawing instruction of the incremental path segment to a cache drawing layer when the captured user touch event is a touch release event or when a drawing segment interruption is detected, and to render a screen buffer based on all data of the cache drawing layer or the incremental path segment to generate a corresponding image.
[0009] According to another aspect of the present invention, a wrong question scanning device is also provided, including the real-time image marking and drawing device based on dual-layer caching as described above.
[0010] In this embodiment of the invention, user touch events are captured in real time, including touch press events, touch move events, and touch release events. When the captured user touch event is a touch press event, a touch point is drawn on the real-time rendering layer as the previous touch point. When the captured user touch event is a touch move event, an incremental path segment between the previous touch point and the current touch point is generated on the real-time rendering layer based on the coordinates of the current touch point and the previous touch point, wherein the incremental path segment consists only of the previous touch point and the current touch point. When the captured user touch event is a touch release event or when a drawing segment interruption is detected, the incremental path segment or the drawing instruction of the incremental path segment is saved to the cache rendering layer, and the screen buffer is rendered based on all the data of the cache rendering layer or the incremental path segment to generate the corresponding image. This solution solves the technical problems of interface lag and operation delay in traditional drawing techniques as the complexity of the markers increases. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0012] Figure 1 This is a flowchart of a real-time image marker drawing method based on dual-layer caching according to an embodiment of the present invention;
[0013] Figure 2 This is a structural diagram of a real-time image marker drawing device based on a dual-layer cache according to an embodiment of this application;
[0014] Figure 3 This is a flowchart of another optional real-time image marker drawing method based on dual-layer caching according to an embodiment of the present invention;
[0015] Figure 4 This is an optional touch processing state diagram according to an embodiment of the present invention;
[0016] Figure 5 This is a system architecture diagram of an image marking and drawing system according to an embodiment of the present invention;
[0017] Figure 6 This is a flowchart of an optional image marker drawing method according to an embodiment of the present invention;
[0018] Figure 7 This is a flowchart of an optional deletion operation according to an embodiment of the present invention;
[0019] Figure 8This is a structural diagram of another real-time image marker drawing device based on dual-layer caching according to an embodiment of this application;
[0020] Figure 9 A schematic diagram of the structure of a computer device suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] According to an embodiment of the present invention, a method embodiment of a real-time image tagging drawing method based on dual-layer caching is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0024] Figure 1 This is a real-time image marker drawing method based on dual-layer caching according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0025] Step S102: Capture user touch events in real time, wherein the touch events include touch press events, touch move events, and touch release events.
[0026] Step S104: When the captured user touch event is a touch press event, draw the touch point on the real-time drawing layer as the previous touch point.
[0027] This application adopts a dual-layer caching method, dividing the layer caching area into a real-time drawing layer and a cached drawing layer.
[0028] The real-time drawing layer is a lightweight, temporary drawing cache area used to handle the user's current drawing operation. This layer is updated at a high refresh rate during system operation, typically storing only drawing data from the current touch frame or a very short time period, and is not persisted. Its main functions are: to generate and display incremental path fragments between adjacent touch points in real time as the user's finger moves; to clear the previous incremental content before each frame refresh to ensure only the latest stroke trajectory is displayed; and to clear the cache layer after passing the final drawing result to the drawing cache layer upon completion or submission (triggered by ACTION_UP). The real-time drawing layer is equivalent to the system's dynamic pen layer, used to quickly respond to the user's current operation, ensuring the immediacy and smoothness of the drawing process.
[0029] The cached drawing layer is a persistent drawing storage area used to save all completed drawing results. This layer typically exists in the form of a bitmap or a display list, and its data accumulates continuously during multiple user drawing processes. Its main functions are: to permanently save the corresponding image or drawing instructions after each real-time drawing layer submission; to be drawn first as the bottom layer during each frame rendering, providing a stable background for subsequent real-time incremental displays; and to avoid repeated calculations or redrawing of historical paths, achieving efficient incremental overlay rendering. The cached drawing layer can be understood as the system's history canvas layer, used to maintain all completed markings or handwriting results.
[0030] Step S106: When the captured user touch event is the touch movement event, based on the coordinates of the current touch point and the previous touch point, an incremental path segment between the previous touch point and the current touch point is generated on the real-time rendering layer, wherein the incremental path segment consists only of the previous touch point and the current touch point.
[0031] When the captured user touch event is a touch movement event, the incremental path segment of the previous frame on the real-time rendering layer is first cleared. Based on the coordinates of the current touch point and the previous touch point, an incremental path segment between the previous touch point and the current touch point is generated on the real-time rendering layer.
[0032] Step S108: When the captured user touch event is a touch release event or when a drawing segment interruption is detected, the incremental path segment or the drawing instruction of the incremental path segment is saved to the cache drawing layer, and the screen buffer is rendered based on all the data of the cache drawing layer or the incremental path segment to generate the corresponding image.
[0033] When the captured user touch event is a touch release event or when a drawing segment interruption is detected, the incremental path segment is saved to the cache drawing layer as pixel data; or the drawing instructions describing the incremental path segment are saved to the cache drawing layer as an instruction sequence.
[0034] Then, all the data of the cached drawing layer is rendered to the screen buffer to generate the corresponding image; or, the incremental path is overlaid and drawn to the screen buffer to generate the corresponding image, wherein the screen buffer renders the previously generated image.
[0035] This invention provides a real-time image marking and drawing system based on dual-layer caching, which introduces layered drawing and incremental update techniques. By separating the drawing content into two logical layers: a real-time drawing layer and a cached drawing layer, the costly full redraw is transformed into an efficient cached overlay incremental process, thereby decoupling drawing performance from the complexity of historical operations.
[0036] Figure 2 This is a structural diagram of a real-time image marker drawing device based on a dual-layer cache according to an embodiment of this application, such as... Figure 2 As shown, the system includes a touch event handling module 22, a dual-layer management module 24, a drawing logic module 26, and a compositing rendering module 28.
[0037] The touch event handling module 22 is used to capture user touch events (ACTION_DOWN, ACTION_MOVE, ACTION_UP). The dual-layer management module 24 is used to create and manage two logical layers: a real-time drawing layer and a cached drawing layer. The real-time drawing layer is a lightweight, temporary drawing surface used to draw the currently ongoing incremental operation. The cached drawing layer is a persistent drawing surface or data storage used to save the results of all completed drawing operations. The drawing logic module 26 is used to execute specific drawing instructions on the two layers based on touch events. The compositing and rendering module 28 is used to sequentially composite the contents of the cached drawing layer and the real-time drawing layer in each frame and output them to the display device.
[0038] The following section will describe in detail the operation process of a real-time image labeling and drawing system based on dual-layer caching, such as... Figure 3 As shown, the real-time image marker drawing method based on dual-layer caching includes the following steps:
[0039] Step S302: A finger press is detected, and a new path begins.
[0040] The touch event handling module receives a finger press (ACTION_DOWN) event. The drawing logic module does not clear any layers; instead, it directly draws the starting position of the current touch point on the real-time drawing layer (e.g., drawing a point, or recording it as the start of a path). At this time, the cached drawing layer remains unchanged.
[0041] Step S304: Finger movement is detected, and incremental drawing is performed.
[0042] This step is the key innovation of this invention. For each finger movement (ACTION_MOVE) event, the system does not merge the new point into the massive historical path. The drawing logic module generates an extremely short line segment (i.e., an "incremental path fragment") on the real-time drawing layer based solely on the coordinates of the current touch point and the coordinates of the previous touch point. This tiny incremental fragment is then immediately drawn onto the real-time drawing layer. Because this fragment has extremely low complexity (only 2 points), the drawing speed is extremely fast. During each ACTION_MOVE, the real-time drawing layer first clears the incremental content of the previous frame before drawing the new incremental fragment, ensuring that only the most recent stroke segment is displayed.
[0043] Step S306: If a finger is detected to be lifted or submitted in segments, the path segment is submitted to the cache.
[0044] When the touch event handling module receives a segment commit (ACTION_UP) event, or when the system determines a drawing segment based on strategies such as timeout or stroke discontinuity, a commit operation is triggered. The drawing logic module 26 permanently draws the final path segment (or its equivalent graphic data) completed on the real-time drawing layer onto the cached drawing layer.
[0045] Specific submission methods can be: 1) Bitmap caching: Render the path fragment onto a cached drawing layer (a BitmapCanvas or Bitmap object). The cache layer then stores pixel data. 2) Display list caching: Store the drawing instructions (such as drawLine, drawPath) describing the path fragment into a display list. The cache layer then stores the instruction sequence. After submission, clear the live drawing layer to prepare for the next drawing operation.
[0046] The compositing rendering module performs the following operations in the order of drawing each frame: 1) Draws the complete content of the cached drawing layer onto the screen buffer. This operation is usually very efficient because the cached layer may be a static bitmap or an optimized display list. 2) Overlays the current content of the live drawing layer (i.e., the latest incremental path fragment) onto the screen buffer.
[0047] Figure 4This is a touch processing state diagram according to an embodiment of this application, which illustrates the system state transition logic driven by touch events in a real-time image marking drawing method based on dual-layer caching.
[0048] like Figure 4 As shown, the system mainly includes three main states: Idle, Drawing, and Committed, as well as sub-processes within the drawing states such as ReceivePoint, ProcessLine, and DrawImmediate. The specific state transition relationships are as follows:
[0049] 1) Idle state
[0050] After system startup, it is in the Idle state by default. At this time, the touch event handling module is in listening mode, waiting for user touch input. When the user's first touch event (ACTION_DOWN) is detected, the system jumps from the Idle state to the Drawing state and starts the real-time drawing process.
[0051] 2) Drawing Status
[0052] In the Drawing state, the system continuously responds to the user's touch movement events (ACTION_MOVE) and executes a set of loop sub-processes within the state to achieve real-time, incremental drawing.
[0053] ReceivePoint sub-process: Captures and records the coordinate information of the current touch point in real time;
[0054] ProcessLine sub-process: Calculates the incremental path segment between the current touch point and the previous touch point without traversing or redrawing the entire history path;
[0055] The DrawImmediate subprocess directly draws the calculated incremental path fragment to the Real-time Drawing Layer and triggers a UI refresh for immediate display.
[0056] As the user's finger continues to move, the system continuously executes the three sub-processes ReceivePoint, ProcessLine, and DrawImmediate in the Drawing state.
[0057] 3) Status exit and submission logic.
[0058] When the touch event handling module detects ACTION_UP (finger lift) or the system determines that a drawing segment has ended, it transitions from the Drawing state to the Committed state. In this state, the system performs a "commit operation," merging the incremental content in the real-time drawing layer into the cached drawing layer to form a persistent drawing result. After the commit is complete, the system automatically clears the real-time drawing layer and returns to the Idle state, ready to accept the next round of touch input.
[0059] If an ACTION_CANCEL event is detected during the drawing process, such as when the user interrupts the operation or the system forces a reset, the system will directly return from the Drawing state to the Idle state without performing a commit operation.
[0060] Through the aforementioned state transition mechanism, this invention achieves a real-time, stable, and efficient drawing process driven by touch events.
[0061] Figure 5 This diagram illustrates the system architecture of an image labeling and drawing system provided in this embodiment of the invention. It shows the overall module composition of the real-time image labeling and drawing system based on a dual-layer cache and the interaction relationships between the modules. The system mainly includes a drawing controller, a user interface layer, and three types of data / drawing carrier layers.
[0062] 1) User Interface
[0063] The user interface is the entry point for human-computer interaction, providing users with an interface for image marking and a drawing feedback area. This interface mainly includes: 1) a display area: showcasing the composite results of the background image, cached drawing layer, and real-time drawing layer, where users can directly perform touch drawing operations; 2) a toolbar area: providing drawing tool selection (such as brushes, colors, erasers, etc.) and control functions (such as undo, clear, save, etc.); and 3) an event interface module: used to capture user touch events and pass them to the drawing controller, synchronizing the drawing logic with the interface display.
[0064] Through this interface, users can perform real-time annotation and editing operations on images on mobile devices or touch terminals. The system then completes instant drawing and display based on user input using a dual-layer caching architecture.
[0065] 2) Drawing controller.
[0066] The drawing controller is the core scheduling and coordination unit of this system. It is used to receive touch input events (including ACTION_DOWN, ACTION_MOVE, ACTION_UP, etc.) from the user interface and trigger the corresponding drawing logic flow accordingly.
[0067] The drawing controller is also used to manage the system's drawing status, layer data, and rendering synchronization. Its internal control flow includes touch event distribution and parsing, drawing path generation and updating, data submission and composition control of real-time drawing layers and cached drawing layers, and timing scheduling of layer rendering.
[0068] 3) Three-layer layer caching.
[0069] The entire system's drawing and display are built on a three-layer cache: a background layer, a cached drawing layer, and a real-time drawing layer. These three layers are uniformly managed and invoked by the drawing controller, and they are superimposed on each other to form a complete image display result.
[0070] The background layer is the original image layer, used to store the raw image data to be labeled, such as incorrect questions on a test paper, serving as the base canvas for user labeling operations. This layer contains static content and does not participate in real-time rendering; it is only displayed as a base image during the compositing rendering stage.
[0071] The cached drawing layer, also known as the underlying markup cache layer (Canvas / Bitmap), is used to store all completed and submitted markup content, including paths, strokes, or other graphic elements formed by the user during the historical drawing process; this layer can be implemented in the form of a bitmap or a canvas.
[0072] The real-time drawing layer, also known as the upper real-time editing layer, is used to display the user's current touch drawing action in real time. During the touch event, only the incremental line segment between the current touch point and the previous touch point is drawn on this layer. Before each frame refresh, the temporary content of the previous drawing is cleared to ensure that only the latest trajectory of the current operation is displayed. When the touch end (ACTION_UP) is detected or the segmented submission condition is met, the content of this layer is committed and merged into the lower mark cache layer, and then cleared, waiting for the next drawing.
[0073] Users interact with the screen through the user interface; the user interface transmits touch events to the drawing controller; the drawing controller schedules the real-time drawing layer and the cache drawing layer to perform corresponding operations according to the touch events (press, move, release); during the rendering stage, the system performs image compositing in the order of background layer, cache drawing layer, and real-time drawing layer, and finally generates real-time display effects and outputs them to the display device.
[0074] In this embodiment, the background layer provides a background canvas, such as incorrect questions in an exam paper; the cached drawing layer stores historical drawing results to avoid full redrawing; and the real-time drawing layer is only used for lightweight incremental drawing, thereby achieving a low-latency and high-smoothness drawing experience.
[0075] The drawing process of the system according to the embodiments of this application will be described in detail below.
[0076] Figure 6 This illustrates the system's drawing process and corresponding performance optimization logic under different operational scenarios (including real-time drawing, submission completion, and deletion operations). Figure 6 As shown, the method includes the following steps:
[0077] Step S602: Determine the drawing type.
[0078] The drawing controller first determines the current drawing type. When it detects that the user is drawing, the system determines that the operation belongs to the "real-time drawing" type and proceeds to step S604; if it is determined to be the "submission completed" type, it proceeds to step S608.
[0079] Step S604: Draw straight lines connecting the contact points of the upper layer.
[0080] The system draws lines on the upper layer, connecting the current touch point with the previous touch point with straight lines to form incremental path segments. This step only processes the current incremental data, without traversing or recalculating the entire historical path, thus significantly reducing drawing complexity and processing latency.
[0081] Step S606, real-time display.
[0082] The system instantly displays the generated incremental line segments on the screen, achieving a real-time display effect for touch operations. After this display is completed, the process returns to step S602 to continue judging new touch events to support continuous drawing.
[0083] Step S608: Draw the bottom layer path to generate a complete curve path.
[0084] The underlying cache layer generates a complete curve path based on the path data in the real-time drawing layer, merging multiple incremental segments into a continuous path structure.
[0085] Step S610: Save permanently and redraw when needed.
[0086] The system permanently saves the generated complete path and corresponding drawing results to the underlying cache layer. This cached content can be directly called during subsequent rendering or redrawing without recalculating the path or performing a full redraw, thereby effectively improving system performance and drawing stability.
[0087] Figure 7 The flowchart illustrates the deletion operation. This flowchart is primarily used to ensure that the drawing results are correctly updated when the user performs a deletion mark or clear operation, while minimizing system resource consumption. For example... Figure 7 As shown, the deletion operation includes the following steps:
[0088] Step S702: A deletion operation was detected.
[0089] The system detected a user's delete command. This command can be triggered by the delete tool in the user interface or automatically issued by the system during specific operations (such as undo, partial clear, etc.). Upon detecting a delete event, the drawing controller enters the delete processing flow.
[0090] Step S704: Clear the relevant paths.
[0091] The system first clears the path data corresponding to the currently deleted target. For implementations using path caching, the system removes the target path from the cached rendering layer, ensuring that the deleted marked content will no longer participate in subsequent rendering.
[0092] Step S706: Perform a complete redraw of the bottom layer.
[0093] The system performs a complete redraw operation on the underlying cache layer to restore the correct image state of the area affected by the deleted content.
[0094] Step S708: Redraw only the necessary parts.
[0095] The system employs a performance optimization strategy, redrawing only necessary areas. Specifically, by calculating the local area affected by the deletion operation, the system only refreshes the pixels of the modified area, without performing a full redraw of the entire canvas.
[0096] Through the above steps, this embodiment implements an efficient update mechanism for deletion operations. This mechanism not only ensures the accuracy of the deletion results and the consistency of the interface, but also effectively avoids redundant calculations at the performance level, further enhancing the stability and smoothness of the invention in real-time rendering scenarios.
[0097] This invention also provides a real-time image marker drawing method based on dual-layer caching. The difference from the previous embodiments lies in that, during the incremental path segment generation stage triggered by touch movement events, this embodiment calculates and encodes multi-dimensional touch features, including pressure value, tilt angle, touch area, and speed change trend, for each incremental path segment in real time. During the real-time rendering layer display stage, the compositing rendering module reads the multi-dimensional feature vectors associated with each incremental path segment from the real-time rendering layer and adjusts the thickness, transparency, texture representation, or dynamic animation effects of the brushstrokes in real time according to a preset feature-driven rendering strategy. Based on the above differentiated processing, this embodiment will describe the two unique steps in detail; the remaining steps are consistent with the previous embodiments and will not be repeated here.
[0098] First, upon receiving a touch movement event at the current touch point, the touch event processing module acquires the coordinate information of the current touch point in real time. Simultaneously, it obtains physical characteristics such as touch pressure, tilt angle, and touch area from the touch sensor interface, and records the coordinates of the previous touch point and its corresponding touch feature data. Then, based on the coordinates and timestamps of the current and previous touch points, it calculates the historical speed change trend. For example, it takes the coordinate difference of several consecutive touch points, divides it by the time difference to form a speed vector, and then performs a difference operation on the speed vector to obtain acceleration or change trend information, thereby capturing the dynamic characteristics of finger movement.
[0099] Next, the rendering logic module combines pressure value, tilt angle, touch area, and historical speed change trends to form a multi-dimensional feature vector. This vector is then normalized to unify the data range across different dimensions, and a compression encoding algorithm is used to remove redundant information, retaining only key features for real-time display, thereby reducing the cache usage of the real-time rendering layer. Subsequently, the system generates an incremental path segment based on the coordinates of the current touch point and the previous touch point, and stores this incremental path segment along with the corresponding multi-dimensional feature vector in the temporary cache of the real-time rendering layer.
[0100] During the real-time display phase, the compositing and rendering module reads incremental path fragments and their multi-dimensional feature vectors from the real-time rendering layer each frame, dynamically controlling the display effect using a feature-driven strategy. For example, touch pressure values are mapped to stroke thickness, touch tilt angles and touch areas are jointly mapped to stroke shape and transparency, and historical speed change trends are used to control path animation performance, including path gradations, dynamic extensions, or smooth curve adjustments, thereby achieving dynamic and personalized display for each incremental path fragment. After display is complete, the incremental content of the previous frame is cleared before the next frame is refreshed to ensure that the real-time rendering layer only presents the latest touch operation effect.
[0101] When the touch event handling module detects a touch release event or an interruption in the drawing process, the drawing logic module submits the incremental path fragments and their encoded features stored in the real-time drawing layer to the cached drawing layer. During the submission process, it is possible to choose to retain the complete multi-dimensional features or only save the key features to balance storage and display effects. In subsequent frame rendering, the cached drawing layer uses the complete path and feature-driven effects for composite rendering, thus maintaining both the integrity of the historically drawn content and the dynamic display characteristics.
[0102] Through the above method, this embodiment introduces real-time acquisition, encoding and feature-driven display of multi-dimensional touch features on the basis of dual-layer caching architecture, which not only ensures efficient incremental drawing and low-latency response, but also enhances the visual realism and interactive experience of the drawing.
[0103] This application also provides another real-time image marker drawing device based on dual-layer caching, such as... Figure 8As shown, the system includes: a capture module 82, configured to capture user touch events in real time, wherein the touch events include touch press events, touch move events, and touch release events; a point drawing module 84, configured to draw a touch point on the real-time drawing layer as the previous touch point when the captured user touch event is a touch press event; a path drawing module 86, configured to generate an incremental path segment between the previous touch point and the current touch point on the real-time drawing layer based on the coordinates of the current touch point and the previous touch point when the captured user touch event is the touch move event, wherein the incremental path segment consists only of the previous touch point and the current touch point; and a rendering module 88, configured to save the incremental path segment or the drawing instructions of the incremental path segment to the cache drawing layer when the captured user touch event is a touch release event or when a drawing segment interruption is detected, and to render the screen buffer based on all the data of the cache drawing layer or the incremental path segment to generate a corresponding image. The capture module 82 is equivalent to... Figure 2 The touch event handling module 22, point drawing module 84, and path drawing module 86 in the middle are equivalent to Figure 2 The drawing logic module 26 and the rendering module 88 are equivalent to... Figure 2 The compositing rendering module 28 in the middle.
[0104] It should be noted that the real-time image marking and drawing device based on dual-layer caching provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the real-time image marking and drawing device based on dual-layer caching provided in the above embodiments and the real-time image marking and drawing method embodiments based on dual-layer caching belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0105] This application also provides a wrong-answer scanning device, which includes the aforementioned real-time image marking and drawing device based on dual-layer caching. The drawing device is used to mark the wrong-answer areas or corresponding knowledge points on the scanned test paper in real time. Users can directly add circles, underlines, or key points on the display interface via touch operation, so as to simultaneously record learning focus and problem-solving strategies during the scanning process. This marking and drawing device can achieve instant annotation of wrong-answer content while ensuring the quality of the scanned image, improving the efficiency and accuracy of learning records.
[0106] Figure 9 A schematic diagram of a computer device suitable for implementing embodiments of the present disclosure is shown. It should be noted that... Figure 9The computer device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0107] like Figure 9 As shown, the computer device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage section 1008 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for system operation. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0108] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 1010 as needed so that computer programs read from it can be installed into storage section 1008 as needed.
[0109] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A real-time image marker drawing method based on dual-layer caching, characterized in that, include: Real-time capture of user touch events, including touch press events, touch move events, and touch release events; When the captured user touch event is a touch press event, draw the touch point on the real-time drawing layer as the previous touch point; When the captured user touch event is the touch movement event, based on the coordinates of the current touch point and the previous touch point, an incremental path segment between the previous touch point and the current touch point is generated on the real-time rendering layer, wherein the incremental path segment consists only of the previous touch point and the current touch point; When the captured user touch event is a touch release event or when a drawing segment interruption is detected, the incremental path segment or the drawing instruction of the incremental path segment is saved to the cache drawing layer, and the screen buffer is rendered based on all the data of the cache drawing layer or the incremental path segment to generate the corresponding image.
2. The method according to claim 1, characterized in that, Before generating the incremental path segment between the previous touch point and the current touch point on the real-time rendering layer, the method further includes: clearing the incremental path segment of the previous frame on the real-time rendering layer.
3. The method according to claim 1, characterized in that, Saving the incremental path segment or the drawing instruction of the incremental path segment to the cache drawing layer includes: The incremental path segment is saved to the cached rendering layer as pixel data; or The drawing instructions describing the incremental path segment are saved to the cache drawing layer as a sequence of instructions.
4. The method according to claim 1, characterized in that, Rendering the screen buffer based on all data from the cached drawing layer or the incremental path fragment includes: Render all the data from the cached rendering layer to the screen buffer to generate the corresponding image; or... The incremental path is overlaid and drawn onto the screen buffer to generate the corresponding image, wherein the screen buffer renders the previously generated image.
5. The method according to claim 1, characterized in that, The real-time drawing layer is a temporary drawing cache, used only to store the incremental path segments of the current frame that have not yet been submitted; The cached drawing layer is a permanent drawing cache used to store submitted drawing result data.
6. A real-time image marking and drawing device based on dual-layer caching, characterized in that, include: The capture module is configured to capture user touch events in real time, wherein the touch events include touch press events, touch move events, and touch release events; The point drawing module is configured to draw the touch point as the previous touch point on the real-time drawing layer when the captured user touch event is a touch press event. The path drawing module is configured to generate an incremental path segment between the previous touch point and the current touch point on the real-time drawing layer based on the coordinates of the current touch point and the previous touch point when the captured user touch event is the touch movement event, wherein the incremental path segment consists only of the previous touch point and the current touch point; The rendering module is configured to save the incremental path segment or the drawing instructions of the incremental path segment to the cached drawing layer when the captured user touch event is a touch release event or when a drawing segment interruption is detected, and to render the screen buffer based on all the data of the cached drawing layer or the incremental path segment to generate the corresponding image.
7. A device for scanning incorrect questions, characterized in that, include: The real-time image marking and drawing device based on dual-layer caching as described in claim 6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 1 to 6.
9. A computer device, characterized in that, include: Memory and processor The memory stores computer programs; The processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, the processor performs the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.