A multi-object paint writing method and system
By rewriting the pen event method of the electronic whiteboard, identifying and constructing stroke, the problem of traditional electronic whiteboards being unable to write with multiple objects is solved, realizing free pen writing with multiple objects and improving the user experience.
Patent Information
- Application Number
- CN202211038857.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-29
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-08-29
AI Technical Summary
Traditional electronic whiteboards cannot allow simultaneous drawing on multiple objects, limiting their use cases and impacting user experience.
By overriding the OnStylusDown, OnStylusMove, and OnStylusUp methods, a static plugin for InkCanvas is created. This plugin recognizes pen events and constructs a stroke based on the four vertices of an object, determining whether the pen is located on the object, thus enabling multi-object pen writing.
It enables freehand drawing on multiple objects simultaneously on the electronic whiteboard, enhancing the user experience.
Smart Images

Figure CN115509429B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronic whiteboard, and particularly discloses a multi-object brush writing method and system. BACKGROUND
[0002] With the rapid development of computer technology, various multimedia courseware integrating sound, image, text and video have entered the classroom. Electronic whiteboard, which integrates computer technology, display technology, network technology, photography and videography technology, etc., has emerged in this digital era. However, the traditional electronic whiteboard cannot perform brush writing (annotation) on objects (pictures, videos, tables, etc.) in the electronic whiteboard at the same time when writing, or can only perform brush writing on one object, which greatly limits the use scenarios of the electronic whiteboard and further greatly affects the user experience.
[0003] Therefore, how to provide a multi-object brush writing method and system to freely perform brush writing on multiple objects while writing on the electronic whiteboard has become a technical problem to be solved. SUMMARY
[0004] The present application aims to provide a multi-object brush writing method and system to freely perform brush writing on multiple objects while writing on the electronic whiteboard.
[0005] In a first aspect, the present application provides a multi-object brush writing method, comprising the following steps:
[0006] In step S10, the device ID of each type of brush is pre-stored, and a static plug-in of InkCanvas is created based on the rewritten OnStylusDown method, OnStylusMove method and OnStylusUp method;
[0007] In step S20, a stroke is constructed based on the four vertices of each object on the electronic whiteboard, and the stroke and the object are subjected to matrix transformation based on the operation instruction of the object;
[0008] In step S30, when the current user selects brush writing, the brush writing operation is performed based on the static plug-in, stroke and device ID.
[0009] Further, the step S10 specifically comprises:
[0010] The device ID of each type of brush is pre-stored, and the OnStylusDown method, OnStylusMove method and OnStylusUp method of the initial static plug-in of InkCanvas are rewritten to obtain the corresponding static plug-in.
[0011] Furthermore, in step S20, the operation command is to move, rotate, or scale.
[0012] Further, step S30 specifically includes:
[0013] The first entry is located within the object:
[0014] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0015] Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event.
[0016] Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation.
[0017] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0018] The first entry is not located within the object:
[0019] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0020] When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated;
[0021] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0022] Secondly, the present invention provides a multi-object pen writing system, comprising the following modules:
[0023] The static plugin creation module is used to pre-store the device IDs of various types of pens and create static plugins for InkCanvas based on the overridden OnStylusDown, OnStylusMove, and OnStylusUp methods.
[0024] The stroke construction module is used to construct strokes based on the four vertices of each object on the electronic whiteboard, and to perform matrix transformations on the strokes and objects based on the object's operation instructions.
[0025] The pen writing operation module is used to perform pen writing operations based on the static plugin, stroke, and device ID when the current user selects a pen to write.
[0026] Furthermore, the static plugin creation module specifically comprises:
[0027] The device IDs of various types of pens are pre-stored, and the OnStylusDown, OnStylusMove, and OnStylusUp methods of the initial static plugin of InkCanvas are overridden to obtain the corresponding static plugin.
[0028] Furthermore, in the stroke construction module, the operation command is to move, rotate, or scale.
[0029] Furthermore, the pen writing operation module is specifically used for:
[0030] The first entry is located within the object:
[0031] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0032] Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event.
[0033] Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation.
[0034] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0035] The first entry is not located within the object:
[0036] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0037] When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated;
[0038] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0039] The advantages of this invention are:
[0040] By overriding the OnStylusDown, OnStylusMove, and OnStylusUp methods, a static plugin for InkCanvas is created. This allows the static plugin to recognize the StylusDown, StylusMove, and StylusUp events triggered by the pen. A stroke is constructed based on the four vertices of the object. By checking whether the pen falls within the rectangle formed by the stroke, it can determine if the pen is currently on an object. Based on this, the corresponding static plugin is called to execute the pen writing. Ultimately, this allows for free pen writing or multiple-stroke writing on multiple objects while writing on the electronic whiteboard, greatly improving the user experience. Attached Figure Description
[0041] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0042] Fig. 1 This is a flowchart of a multi-object pen writing method according to the present invention.
[0043] Fig. 2 This is a schematic diagram of the structure of a multi-object pen writing system according to the present invention. Detailed Implementation
[0044] Please refer to Figs. 1-2 As shown, a preferred embodiment of the multi-object pen writing method of the present invention includes the following steps:
[0045] Step S10: Pre-store the device IDs of each type of pen, and create a static plugin for InkCanvas based on the overridden OnStylusDown, OnStylusMove, and OnStylusUp methods;
[0046] Step S20: Construct strokes based on the four vertices of each object on the electronic whiteboard, and perform matrix transformations on the strokes and objects based on the operation instructions of the objects; a stroke is a trajectory composed of a set of planar coordinate points, from the beginning of a stroke to the end of a stroke; each object corresponds to an InkCanvas (a control used to collect and display ink marks, that is, to collect the coordinate sequence of the pen during the sliding process on the electronic whiteboard and display it according to the set style);
[0047] Step S30: When the current user selects a pen to write, the pen writing operation is performed based on the static plugin, stroke, and device ID.
[0048] Step S10 specifically involves:
[0049] The device IDs of various types of pens are pre-stored, and the OnStylusDown, OnStylusMove, and OnStylusUp methods of the initial static plugin of InkCanvas are overridden to obtain the corresponding static plugins.
[0050] In step S20, the operation command is to move, rotate, or scale.
[0051] Step S30 mainly implements the writing of objects on the overall canvas, and is handled in two cases: the first case is that the first point of the first stroke is located in the object; the second case is that the first point of the first stroke is located in the overall canvas.
[0052] Step S30 specifically involves:
[0053] The first entry is located within the object:
[0054] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0055] Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event. In other words, determine whether the current touch point is on the object by checking if the current touch point is within the rectangle formed by the strokes.
[0056] That is, if the device ID does not match, the OnStylusDown, OnStylusMove, and OnStylusUp methods will not perform any processing; if they match, the base class operation will be called directly.
[0057] Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation.
[0058] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the strokes; StrokeCollected is the pen collection.
[0059] The first entry is not located within the object:
[0060] When the pen is pressed for the first stroke, the static plugin generates a first press event. It checks whether the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the input first point to a preset second coordinate value, for example, adjusting the first coordinate value to (-9999, -9999), and thus does not call the first press event; if yes, then:
[0061] When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated;
[0062] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0063] A preferred embodiment of the multi-object pen writing system of the present invention includes the following modules:
[0064] The static plugin creation module is used to pre-store the device IDs of various types of pens and create static plugins for InkCanvas based on the overridden OnStylusDown, OnStylusMove, and OnStylusUp methods.
[0065] The stroke construction module is used to construct strokes based on the four vertices of each object on the electronic whiteboard, and to perform matrix transformations on the strokes and objects based on the operation instructions of the objects. A stroke is a trajectory composed of a set of planar coordinate points, from the beginning of a stroke to the end of a stroke. Each object corresponds to an InkCanvas (a control used to collect and display ink marks, that is, to collect the coordinate sequence of the pen during the sliding process on the electronic whiteboard and display it according to the set style).
[0066] The pen writing operation module is used to perform pen writing operations based on the static plugin, stroke, and device ID when the current user selects a pen to write.
[0067] The static plugin creation module is specifically as follows:
[0068] The device IDs of various types of pens are pre-stored, and the OnStylusDown, OnStylusMove, and OnStylusUp methods of the initial static plugin of InkCanvas are overridden to obtain the corresponding static plugins.
[0069] In the stroke construction module, the operation command is to move, rotate, or scale.
[0070] The brush writing operation module mainly implements writing on the entire canvas and objects, and handles two cases: the first case is when the first point of the first stroke is located in the object; the second case is when the first point of the first stroke is located in the entire canvas.
[0071] The pen writing operation module is specifically used for:
[0072] The first entry is located within the object:
[0073] When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then:
[0074] Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event. In other words, determine whether the current touch point is on the object by checking if the current touch point is within the rectangle formed by the strokes.
[0075] That is, if the device ID does not match, the OnStylusDown, OnStylusMove, and OnStylusUp methods will not perform any processing; if they match, the base class operation will be called directly.
[0076] Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation.
[0077] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the strokes; StrokeCollected is the pen collection.
[0078] The first entry is not located within the object:
[0079] When the pen is pressed for the first stroke, the static plugin generates a first press event. It checks whether the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the input first point to a preset second coordinate value, for example, adjusting the first coordinate value to (-9999, -9999), and thus does not call the first press event; if yes, then:
[0080] When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated;
[0081] The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
[0082] In summary, the advantages of this invention are:
[0083] By overriding the OnStylusDown, OnStylusMove, and OnStylusUp methods, a static plugin for InkCanvas is created. This allows the static plugin to recognize the StylusDown, StylusMove, and StylusUp events triggered by the pen. A stroke is constructed based on the four vertices of the object. By checking whether the pen falls within the rectangle formed by the stroke, it can determine if the pen is currently on an object. Based on this, the corresponding static plugin is called to execute the pen writing. Ultimately, this allows for free pen writing or multiple-stroke writing on multiple objects while writing on the electronic whiteboard, greatly improving the user experience.
[0084] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A multi-object pen writing method, characterized in that: Includes the following steps: Step S10: Pre-store the device IDs of each type of pen, and create a static plugin for InkCanvas based on the overridden OnStylusDown, OnStylusMove, and OnStylusUp methods; Step S20: Construct strokes based on the four vertices of each object on the electronic whiteboard, and perform matrix transformations on the strokes and objects based on the object's operation instructions; Step S30: When the current user selects a pen to write, the pen writing operation is performed based on the static plugin, stroke, and device ID; Step S30 specifically involves: The first entry is located within the object: When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then: Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event. Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation. The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke. The first entry is not located within the object: When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then: When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated; The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
2. The multi-object pen writing method as described in claim 1, characterized in that: Step S10 specifically involves: The device IDs of various types of pens are pre-stored, and the OnStylusDown, OnStylusMove, and OnStylusUp methods of the initial static plugin of InkCanvas are overridden to obtain the corresponding static plugin.
3. The multi-object pen writing method as described in claim 1, characterized in that: In step S20, the operation command is to move, rotate, or scale.
4. A multi-object pen writing system, characterized in that: Includes the following modules: The static plugin creation module is used to pre-store the device IDs of various types of pens and create static plugins for InkCanvas based on the overridden OnStylusDown, OnStylusMove, and OnStylusUp methods. The stroke construction module is used to construct strokes based on the four vertices of each object on the electronic whiteboard, and to perform matrix transformations on the strokes and objects based on the object's operation instructions. The pen writing operation module is used to perform pen writing operations based on the static plugin, stroke, and device ID when the current user selects a pen for writing. The pen writing operation module is specifically used for: The first entry is located within the object: When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then: Determine if the first stroke is within the rectangle formed by the strokes. If it is, do not call the first press event; otherwise, generate the StylusDown event. Based on whether the strokes generated by the StylusDown event are within the rectangle formed by the strokes, the object's canvas or the entire canvas is invoked to perform the pen writing operation. The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke. The first entry is not located within the object: When the pen is pressed for the first stroke, the static plugin generates a first press event. It then checks if the device ID of the pen that generated the first press event matches a pre-stored device ID. If not, it adjusts the first coordinate value of the first input point to a preset second coordinate value, and thus does not invoke the first press event; if yes, then: When the first stroke is not within the rectangle formed by the strokes, the first press event is invoked, the entire canvas performs the pen writing operation, and a StylusDown event is generated; The electronic whiteboard generates a StrokeCollected event, which collects the strokes written by the pen and deletes the strokes whose first point is within the rectangle formed by the stroke.
5. The multi-object pen writing system as described in claim 4, characterized in that: The static plugin creation module is specifically as follows: The device IDs of various types of pens are pre-stored, and the OnStylusDown, OnStylusMove, and OnStylusUp methods of the initial static plugin of InkCanvas are overridden to obtain the corresponding static plugin.
6. The multi-object pen writing system as described in claim 4, characterized in that: In the stroke construction module, the operation command is to move, rotate, or scale.
Citation Information
Patent Citations
A method for generating dynamic writing animations from images of calligraphic Chinese characters.
CN102289838A
A method of deleting handwriting stroke information inputted by a user on a handwriting device
CN109445676A