CN116774877A - Method and device for erasing graffiti handwriting in OFD document page - Google Patents

Method and device for erasing graffiti handwriting in OFD document page Download PDF

Info

Publication number
CN116774877A
CN116774877A CN202311050255.4A CN202311050255A CN116774877A CN 116774877 A CN116774877 A CN 116774877A CN 202311050255 A CN202311050255 A CN 202311050255A CN 116774877 A CN116774877 A CN 116774877A
Authority
CN
China
Prior art keywords
stroke
handwriting
erasing
graffiti
layer
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.)
Granted
Application number
CN202311050255.4A
Other languages
Chinese (zh)
Other versions
CN116774877B (en
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.)
Fuxin Kunpeng Beijing Information Technology Co ltd
Original Assignee
Fuxin Kunpeng Beijing Information Technology Co ltd
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 Fuxin Kunpeng Beijing Information Technology Co ltd filed Critical Fuxin Kunpeng Beijing Information Technology Co ltd
Priority to CN202311050255.4A priority Critical patent/CN116774877B/en
Publication of CN116774877A publication Critical patent/CN116774877A/en
Application granted granted Critical
Publication of CN116774877B publication Critical patent/CN116774877B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method and a device for erasing graffiti handwriting in an OFD document page, and relates to the technical field of electronic document processing, wherein the method comprises the following steps: acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; under the condition that the drawing of the graffiti handwriting is detected, drawing the current stroke on a second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke on the second image layer and corresponding position information to a stroke information set associated with a current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer; and based on the stroke pictures and the corresponding position information stored in the stroke information set, removing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting. The invention supports different erasing requirements and improves the erasing effect.

Description

Method and device for erasing graffiti handwriting in OFD document page
Technical Field
The invention relates to the technical field of electronic document processing, in particular to a method and a device for erasing graffiti handwriting in an OFD document page.
Background
An Open-layout Document (OFD) is an electronic Document format, and is widely used in the fields of finance, insurance, government and the like.
In the existing OFD document technology, the graffiti handwriting is stored in a line form, so that the file size can be reduced, and the rendering efficiency can be improved. However, when dealing with erasing pressure sensitive handwriting and stroke-wise erasing, a significant amount of computational and sophisticated algorithm support is required. For erasing the pressure-sensitive handwriting, factors such as thickness, color, transparency and the like of the handwriting, and factors such as erasing shape and erasing size need to be considered, so that an accurate result can be obtained. The erasing by strokes is more complex and requires analysis of the trajectory of each stroke. Therefore, the process of erasing the graffiti handwriting in the OFD document based on the prior art is complex, and the erasing effect is poor.
Disclosure of Invention
Aiming at the problems existing in the prior art, the invention provides a method and a device for erasing graffiti handwriting in an OFD document page.
The invention provides an erasing method of graffiti handwriting in an OFD document page, which comprises the following steps:
acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
under the condition that the fact that a user draws a graffiti handwriting in the current OFD document page is detected, drawing the current stroke on the second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke and corresponding position information on the second image layer to a stroke information set associated with the current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer;
and based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
According to the method for erasing the graffiti handwriting in the OFD document page provided by the invention, the pixel corresponding to the erasing operation in the graffiti handwriting is removed, or the stroke corresponding to the erasing operation in the graffiti handwriting is erased, which comprises the following steps:
creating at least one third layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
drawing and synchronously displaying each third layer on a screen of the terminal;
determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and based on the erasing coordinate information and each target image layer, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set.
According to the method for erasing the graffiti handwriting in the OFD document page provided by the invention, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set based on the erasing coordinate information and each target image layer, and the method comprises the following steps:
respectively setting pixels corresponding to the erasure coordinate information in each target layer as transparent colors;
and respectively storing the stroke pictures and the corresponding position information of the effective areas on the target layers to the stroke information set.
According to the method for erasing the graffiti handwriting in the OFD document page provided by the invention, each third image layer is drawn and synchronously displayed on a screen of a terminal, and the method comprises the following steps:
and drawing and synchronously displaying each third layer on the screen through a canvas, respectively binding each third layer to the canvas, and setting a mixed mode of erasing handwriting as a first mode, wherein the first mode is used for indicating to clear pixels intersecting with the erasing coordinate information in the graffiti handwriting.
According to the method for erasing the graffiti handwriting in the OFD document page, which is provided by the invention, the strokes corresponding to the erasing operation in the graffiti handwriting are erased, and the method comprises the following steps:
acquiring erasure coordinate information corresponding to the erasure operation;
and deleting the stroke picture corresponding to each stroke region in the stroke information set under the condition that the position corresponding to the erasure coordinate information is in at least one stroke region and the stroke pixel exists at the position.
The invention also provides an erasing device for the graffiti handwriting in the OFD document page, which comprises:
the system comprises an acquisition module, a first image layer and a second image layer, wherein the acquisition module is used for acquiring the page size of a current OFD document page and creating the first image layer and the second image layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
the processing module is used for drawing the current stroke on the second image layer aiming at the current stroke in the doodle handwriting under the condition that a user draws the doodle handwriting in the current OFD document page, saving a stroke picture of a stroke area of the current stroke on the second image layer and corresponding position information to a stroke information set associated with the current OFD document page, clearing the second image layer and drawing the current stroke on the first image layer;
and the erasing module is used for responding to the erasing operation of the user based on the stroke pictures and the corresponding position information stored in the stroke information set, and clearing the pixels corresponding to the erasing operation in the graffiti handwriting, or erasing the strokes corresponding to the erasing operation in the graffiti handwriting.
According to the device for erasing the graffiti handwriting in the OFD document page, which is provided by the invention, the erasing module is specifically used for:
creating at least one third layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
drawing and synchronously displaying each third layer on a screen of the terminal;
determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and based on the erasing coordinate information and each target image layer, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set.
The invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the method for erasing the graffiti handwriting in the OFD document page when executing the program.
The invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of erasing graffiti handwriting in an OFD document page as described in any one of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a method of erasing graffiti handwriting in an OFD document page as described in any one of the above.
According to the method and the device for erasing the graffiti handwriting in the OFD document page, the first layer and the second layer which are the same as and aligned with the page size of the current OFD document page are created, the first layer is used for drawing the historical handwriting, and the second layer is used for drawing the current stroke; in the process of drawing the graffiti handwriting, aiming at the current stroke in the graffiti handwriting, drawing the current stroke on a second layer, storing a stroke picture and corresponding position information of a stroke area of the current stroke on the second layer to a stroke information set associated with a current OFD document page, clearing the second layer, and drawing the current stroke on the first layer; when the erasing operation is executed, based on the stroke pictures and the corresponding position information stored in the stroke information set, pixels corresponding to the erasing operation in the graffiti handwriting are removed, or the strokes corresponding to the erasing operation in the graffiti handwriting are erased, so that different erasing requirements are supported by using an image processing technology, a complex algorithm is not needed, factors such as pressure feeling, thickness, color and transparency of the handwriting are not needed, the direct processing of a line path is avoided, the erasing process of the graffiti handwriting is simple, and the erasing effect can be improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of an erasing method of graffiti handwriting in an OFD document page provided by the invention;
FIG. 2 is a flow chart of a method for drawing graffiti handwriting in an OFD document page provided by the invention;
FIG. 3 is a flow chart of a method for point-to-point graffiti erasure in an OFD document page provided by the present invention;
FIG. 4 is a flow chart of a method for erasing graffiti in strokes in an OFD document page provided by the present invention;
FIG. 5 is a schematic structural diagram of an erasing device for graffiti handwriting in an OFD document page;
fig. 6 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The method and the device for erasing the graffiti handwriting in the OFD document page are described below with reference to the attached drawing.
Fig. 1 is a flow chart of a method for erasing graffiti handwriting in an OFD document page, as shown in fig. 1, the method includes steps 101-103, wherein:
step 101, obtaining the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes.
It should be noted that, the method for erasing the graffiti handwriting in the OFD document page provided by the invention can be applied to a scene in which the graffiti handwriting in the OFD document page needs to be erased. The execution body of the method can be an erasing device of the graffiti handwriting in the OFD document page, such as an electronic device, a server or a control module in the device for executing the erasing method of the graffiti handwriting in the OFD document page. The electronic device may comprise a cell phone, tablet computer or desktop computer.
Alternatively, by parsing the OFD document or the current OFD document page, the page size of the current OFD document page, such as the page width, the page height, and the starting position of the page, can be obtained. If the first layer and the second layer have been created before, there is no need to repeatedly create the first layer and the second layer here.
The second layer is used to draw the currently ongoing stroke. The first layer is, for example, bitmap1 (Bitmap 1), and the second layer is, for example, bitmap2 (Bitmap 2). The Bitmap1 and Bitmap2 are the same and aligned with the page size of the current OFD document page.
Step 102, under the condition that the fact that a user draws the graffiti handwriting in the current OFD document page is detected, drawing the current stroke on a second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture and corresponding position information of a stroke area of the current stroke on the second image layer to a stroke information set associated with the current OFD document page, clearing the second image layer, and drawing the current stroke on the first image layer.
Optionally, when a user gesture or mouse is detected to be pressed or continuously moved on the current OFD document page, drawing a graffiti handwriting on the second layer according to the movement track of the user gesture or mouse, and recording the position information of the stroke area (effective area) of the current stroke.
For a current stroke in progress, when a user gesture lift or mouse lift is detected, it may be determined that the drawing action of the current stroke has been completed. The stroke area of the current stroke is cut and added to the stroke information set associated with the current OFD document page. Simultaneously, the current stroke is drawn on the first layer, and the second layer is emptied and prepared for the next drawing. Alternatively, the second layer need not be emptied.
When it is detected that the user gesture or the mouse is pressed again, and drawing of the strokes is started, step 102 is repeated until the user finishes drawing.
Optionally, the stroke information set is saved to a document or other storage medium for subsequent use or presentation.
Step 103, based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
Alternatively, the types of erase operations may include point-wise erase and stroke-wise erase.
When the erasing operation of the user on the current OFD document page is detected, under the condition of point-by-point erasing, pixels corresponding to the erasing operation in the graffiti handwriting are cleared based on the stroke pictures and the corresponding position information stored in the stroke information set.
Or when detecting the erasing operation of a user on the current OFD document page, acquiring erasing coordinate information corresponding to the erasing operation under the condition of erasing according to strokes; and deleting the stroke picture corresponding to each stroke region in the stroke information set under the condition that the position corresponding to the erasure coordinate information is in at least one stroke region and the stroke pixel exists at the position.
According to the method for erasing the graffiti handwriting in the OFD document page, the first layer and the second layer which are the same as and aligned with the page size of the current OFD document page are created, the first layer is used for drawing the historical handwriting, and the second layer is used for drawing the current stroke; in the process of drawing the graffiti handwriting, aiming at the current stroke in the graffiti handwriting, drawing the current stroke on a second layer, storing a stroke picture and corresponding position information of a stroke area of the current stroke on the second layer to a stroke information set associated with a current OFD document page, clearing the second layer, and drawing the current stroke on the first layer; when the erasing operation is executed, based on the stroke pictures and the corresponding position information stored in the stroke information set, pixels corresponding to the erasing operation in the graffiti handwriting are removed, or the strokes corresponding to the erasing operation in the graffiti handwriting are erased, so that different erasing requirements are supported by using an image processing technology, a complex algorithm is not needed, factors such as pressure feeling, thickness, color and transparency of the handwriting are not needed, the direct processing of a line path is avoided, the erasing process of the graffiti handwriting is simple, and the erasing effect can be improved.
Optionally, the implementation manner of erasing the pixels corresponding to the erasing operation in the graffiti handwriting or erasing the strokes corresponding to the erasing operation in the graffiti handwriting may include the following steps:
step a, creating at least one third image layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
optionally, when a gesture of a user or a mouse press is detected, reading position information corresponding to the stroke pictures of all strokes stored in the stroke information set from the current OFD document or the current OFD document page; and acquiring the page size, such as the page width, the page height and the page starting position, of the current OFD document page. And generating third layers with the same stroke number as the graffiti handwriting, wherein the third layers are the same as the page size of the current OFD document page and are aligned. Each stroke uniquely corresponds to a third layer.
Step b, drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
c, drawing and synchronously displaying each third layer on a screen of the terminal;
step d, determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and e, based on the erasing coordinate information and each target layer, cleaning pixels corresponding to the erasing operation in the graffiti handwriting by updating the stroke information set.
When the erasing operation of a user on the current OFD document page is detected, at least one third image layer which is the same as the page size of the current OFD document page and is aligned with the page size of the current OFD document page is created, stroke images of all strokes are respectively drawn on the corresponding third image layers, each third image layer is drawn and synchronously displayed on a screen of a terminal, at least one target image layer which is intersected with the erasing coordinate information is selected from the third image layers based on erasing coordinate information corresponding to the erasing operation, and a stroke information set is updated based on the erasing coordinate information and each target image layer so as to clear pixels corresponding to the erasing operation in the graffiti handwriting.
Optionally, in the case of point-to-point erasure, the implementation manner of erasing the pixels corresponding to the erasure operation in the graffiti handwriting by updating the stroke information set based on the erasure coordinate information and each of the target image layers may include the following steps:
step 1, respectively setting pixels corresponding to the erasure coordinate information in each target layer to be transparent so as to update the target layer; for each updated target layer, acquiring a stroke picture and corresponding position information of an effective area of a stroke on the updated target layer;
and 2, respectively storing the stroke pictures and the corresponding position information of the effective areas on the target layers to the stroke information set.
Optionally, the drawing and synchronously displaying each third layer on a screen of the terminal includes: and drawing and synchronously displaying each third layer on the screen through a canvas (canvas), respectively binding each third layer to the canvas, and setting a mixed mode of erasing handwriting as a first mode, wherein the first mode is used for indicating to clear pixels intersecting with the erasing coordinate information in the graffiti handwriting. In practice, the first mode may include, for example, porterduff.
Optionally, in the case of erasing by strokes, the erasing the strokes corresponding to the erasing operation in the graffiti handwriting includes the following steps:
step 1), acquiring erasure coordinate information corresponding to the erasure operation;
and 2) deleting the stroke picture corresponding to each stroke region in the stroke information set under the condition that the position corresponding to the erasing coordinate information is in at least one stroke region and the stroke pixel exists in the position.
Fig. 2 is a flow chart of a method for drawing graffiti handwriting in an OFD document page provided by the present invention, as shown in fig. 2, the method includes steps 201-206, wherein:
step 201, a user draws through an input terminal such as a mouse or a touch screen, and when detecting that a gesture of the user is pressed or the mouse is pressed, namely a pressing event is triggered, the width, the height and the starting position of a current OFD document page are obtained;
step 202, generating two bitmaps which are the same as the current OFD document page in size and aligned, such as Bitmap1 and Bitmap2, wherein Bitmap1 is used for drawing historical handwriting, and Bitmap2 is used for drawing current ongoing handwriting. Creating a region object box of the current stroke, converting screen coordinates into document coordinates, managing pressed coordinate points through box image. Unit (point. X, point. Y), and outputting a minimum rectangular region containing all handwriting moving points, namely an effective region of the stroke;
step 203, when it is detected that a user gesture is pressed or moved or a mouse is pressed or moved, that is, a pressing or moving event for the mouse or a touch screen is triggered, converting screen coordinates into document coordinates, drawing graffiti handwriting onto Bitmap2 so as to achieve that the drawn content is consistent with the original document position, and calculating an effective range of the drawn content (i.e., strokes) by managing moving coordinate points through a box Rect.
Step 204, when it is detected that the user gesture is lifted or the mouse is lifted, that is, a lifting event for the mouse or the touch screen is triggered, a stroke action is considered to be completed, a stroke is cut according to a stroke area or an effective area box rect, a cut stroke picture is obtained, the cut stroke picture and a corresponding box rect are stored in a history set, that is, the stroke picture and corresponding position information are stored in a stroke information set, meanwhile, the stroke is drawn on a Bitmap1, a Bitmap2 is emptied, and the next drawing is prepared;
step 205, after detecting that the gesture of the user is pressed or the mouse is pressed, that is, after triggering the pressing event aiming at the mouse or the touch screen, determining that the user has started drawing a new stroke, and executing steps 203-205 again;
step 206, saving the stroke set and the corresponding position information to a document or other storage medium for subsequent use or presentation.
FIG. 3 is a flow chart of the method for point-to-point graffiti erasing in an OFD document page provided by the present invention, as shown in FIG. 3, the method includes steps 301-307, wherein:
step 301, when it is detected that a gesture of a user is pressed or a mouse is pressed, that is, after a pressing event for the mouse or a touch screen is triggered, reading a stroke picture and position information from a document, and obtaining the width and height and the starting position of a current OFD document page;
step 302, generating bitmaps with the same stroke number, wherein the bitmaps are the same as the current OFD document page in size and aligned;
step 303, drawing the stroke pictures on the corresponding bitmaps respectively;
step 304, drawing the bitmap through a canvas and synchronously displaying the bitmap on a screen;
step 305, binding bitmaps to a new canvas, and setting the mixed mode of erasing Paint to porterduff. Mode. Clear;
step 306, when the gesture of the user moves, a dot is drawn on each bitmap, and the intersected pixels are set to be transparent, so that an erasing effect is realized;
step 307, the pen drawing picture is cut again according to the effective area, and the pen drawing picture is saved back to the document.
FIG. 4 is a flow chart of a method for erasing graffiti in strokes in an OFD document page provided by the present invention, as shown in FIG. 4, the method includes steps 401-403, wherein:
step 401, after detecting that a gesture of a user is pressed or a mouse is pressed, namely, a pressing event aiming at the mouse or a touch screen is triggered, intersecting a pressing coordinate with each stroke area;
step 402, judging that the coordinate is in a certain stroke area and handwriting pixels exist at the position where the coordinate is;
and step 403, deleting a stroke picture corresponding to the stroke when the coordinate is in a certain stroke area and handwriting pixels exist at the position of the coordinate, so as to realize the effect of erasing according to the stroke.
The method for erasing the graffiti handwriting in the OFD document page provided by the invention does not need to consider whether the graffiti handwriting has pressure feeling, thickness, color and transparency, and is consistent operation. The method of erasing according to the points is compatible with consideration and solves the problem of difficult splitting of overlapped strokes; the complexity of the more complex stroke-wise deletion is greatly simplified. The method can reduce the calculated amount while ensuring the efficiency of erasing the graffiti handwriting, and can ensure the erasing speed without affecting the erasing effect.
The device for erasing the graffiti handwriting in the OFD document page is described below, and the device for erasing the graffiti handwriting in the OFD document page described below and the method for erasing the graffiti handwriting in the OFD document page described above can be referred to correspondingly.
Fig. 5 is a schematic structural diagram of an apparatus for erasing graffiti handwriting in an OFD document page, as shown in fig. 5, where the apparatus 500 for erasing graffiti handwriting in an OFD document page includes: an acquisition module 501, a processing module 502, and an erasure module 503; wherein,,
the obtaining module 501 is configured to obtain a page size of a current OFD document page, and create a first layer and a second layer that are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
a processing module 502, configured to, in a case where a user draws a graffiti handwriting in the current OFD document page, draw, on the second layer, the current stroke for a current stroke in the graffiti handwriting, save, on the second layer, a stroke picture of a stroke area of the current stroke and corresponding position information to a stroke information set associated with the current OFD document page, empty the second layer, and draw, on the first layer, the current stroke;
and an erasing module 503, configured to respond to an erasing operation of the user based on the stroke picture and the corresponding position information stored in the stroke information set, and erase a pixel corresponding to the erasing operation in the graffiti handwriting, or erase a stroke corresponding to the erasing operation in the graffiti handwriting.
According to the erasing device for the graffiti handwriting in the OFD document page, the first layer and the second layer which are the same as and aligned with the page size of the current OFD document page are created, the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes; in the process of drawing the graffiti handwriting, aiming at the current stroke in the graffiti handwriting, drawing the current stroke on a second layer, storing a stroke picture and corresponding position information of a stroke area of the current stroke on the second layer to a stroke information set associated with a current OFD document page, clearing the second layer, and drawing the current stroke on the first layer; when the erasing operation is executed, based on the stroke pictures and the corresponding position information stored in the stroke information set, pixels corresponding to the erasing operation in the graffiti handwriting are removed, or the strokes corresponding to the erasing operation in the graffiti handwriting are erased, so that different erasing requirements are supported by using an image processing technology, a complex algorithm is not needed, factors such as pressure feeling, thickness, color and transparency of the handwriting are not needed, the direct processing of a line path is avoided, the erasing process of the graffiti handwriting is simple, and the erasing effect can be improved.
Optionally, the erasing module 503 is specifically configured to:
creating at least one third layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
drawing and synchronously displaying each third layer on a screen of the terminal;
determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and based on the erasing coordinate information and each target image layer, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set.
Optionally, the erasing module 503 is specifically configured to:
respectively setting pixels corresponding to the erasure coordinate information in each target layer as transparent colors;
and respectively storing the stroke pictures and the corresponding position information of the effective areas on the target layers to the stroke information set.
Optionally, the erasing module 503 is specifically configured to: and drawing and synchronously displaying each third layer on the screen through a canvas, respectively binding each third layer to the canvas, and setting a mixed mode of erasing handwriting as a first mode, wherein the first mode is used for indicating to clear pixels intersecting with the erasing coordinate information in the graffiti handwriting.
Optionally, the erasing module 503 is specifically configured to: acquiring erasure coordinate information corresponding to the erasure operation; and deleting the stroke picture corresponding to each stroke region in the stroke information set under the condition that the position corresponding to the erasure coordinate information is in at least one stroke region and the stroke pixel exists at the position.
Fig. 6 illustrates a physical schematic diagram of an electronic device, as shown in fig. 6, which may include: processor 610, communication interface (Communications Interface) 620, memory 630, and communication bus 640, wherein processor 610, communication interface 620, and memory 630 communicate with each other via communication bus 640. Processor 610 may invoke logic instructions in memory 630 to perform a method of erasing graffiti scripts in an OFD document page, the method comprising:
acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
under the condition that the fact that a user draws a graffiti handwriting in the current OFD document page is detected, drawing the current stroke on the second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke and corresponding position information on the second image layer to a stroke information set associated with the current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer;
and based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
Further, the logic instructions in the memory 630 may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, where the computer program can be stored on a non-transitory computer readable storage medium, where the computer program when executed by a processor can perform a method for erasing graffiti handwriting in an OFD document page provided by the above methods, where the method includes:
acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
under the condition that the fact that a user draws a graffiti handwriting in the current OFD document page is detected, drawing the current stroke on the second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke and corresponding position information on the second image layer to a stroke information set associated with the current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer;
and based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
In yet another aspect, the present invention further provides a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor, is implemented to perform a method of erasing graffiti handwriting in an OFD document page provided by the methods above, the method comprising:
acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
under the condition that the fact that a user draws a graffiti handwriting in the current OFD document page is detected, drawing the current stroke on the second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke and corresponding position information on the second image layer to a stroke information set associated with the current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer;
and based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. The method for erasing the graffiti handwriting in the open format document OFD document page is characterized by comprising the following steps:
acquiring the page size of a current OFD document page, and creating a first layer and a second layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
under the condition that the fact that a user draws a graffiti handwriting in the current OFD document page is detected, drawing the current stroke on the second image layer aiming at the current stroke in the graffiti handwriting, storing a stroke picture of a stroke area of the current stroke and corresponding position information on the second image layer to a stroke information set associated with the current OFD document page, emptying the second image layer, and drawing the current stroke on the first image layer;
and based on the stroke pictures and the corresponding position information stored in the stroke information set, responding to the erasing operation of the user, and clearing pixels corresponding to the erasing operation in the graffiti handwriting, or erasing strokes corresponding to the erasing operation in the graffiti handwriting.
2. The method for erasing the graffiti handwriting in the OFD document page according to claim 1, wherein the erasing the pixels corresponding to the erasing operation in the graffiti handwriting comprises:
creating at least one third layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
drawing and synchronously displaying each third layer on a screen of the terminal;
determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and based on the erasing coordinate information and each target image layer, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set.
3. The method for erasing the graffiti handwriting in the OFD document page according to claim 2, wherein the erasing pixels corresponding to the erasing operation in the graffiti handwriting based on the erasing coordinate information and each target layer by updating the stroke information set comprises:
respectively setting pixels corresponding to the erasure coordinate information in each target layer as transparent colors;
and respectively storing the stroke pictures and the corresponding position information of the effective areas on the target layers to the stroke information set.
4. The method for erasing the graffiti handwriting in the OFD document page according to claim 2, wherein the drawing and synchronously displaying each third layer on the screen of the terminal comprises:
and drawing and synchronously displaying each third layer on the screen through a canvas, respectively binding each third layer to the canvas, and setting a mixed mode of erasing handwriting as a first mode, wherein the first mode is used for indicating to clear pixels intersecting with the erasing coordinate information in the graffiti handwriting.
5. The method for erasing the graffiti handwriting in the OFD document page according to claim 1, wherein the erasing the strokes corresponding to the erasing operation in the graffiti handwriting comprises:
acquiring erasure coordinate information corresponding to the erasure operation;
and deleting the stroke picture corresponding to each stroke region in the stroke information set under the condition that the position corresponding to the erasure coordinate information is in at least one stroke region and the stroke pixel exists at the position.
6. An erasing device for graffiti handwriting in an OFD document page is characterized by comprising:
the system comprises an acquisition module, a first image layer and a second image layer, wherein the acquisition module is used for acquiring the page size of a current OFD document page and creating the first image layer and the second image layer which are the same as and aligned with the page size of the current OFD document page; the first layer is used for drawing historical handwriting, and the second layer is used for drawing current strokes;
the processing module is used for drawing the current stroke on the second image layer aiming at the current stroke in the doodle handwriting under the condition that a user draws the doodle handwriting in the current OFD document page, saving a stroke picture of a stroke area of the current stroke on the second image layer and corresponding position information to a stroke information set associated with the current OFD document page, clearing the second image layer and drawing the current stroke on the first image layer;
and the erasing module is used for responding to the erasing operation of the user based on the stroke pictures and the corresponding position information stored in the stroke information set, and clearing the pixels corresponding to the erasing operation in the graffiti handwriting, or erasing the strokes corresponding to the erasing operation in the graffiti handwriting.
7. The device for erasing graffiti handwriting in an OFD document page according to claim 6, wherein the erasing module is specifically configured to:
creating at least one third layer which is the same as and aligned with the page size of the current OFD document page based on the page size of the current OFD document page; different strokes in the graffiti handwriting respectively correspond to different third layers;
drawing the stroke pictures of all strokes on a corresponding third layer respectively based on the position information corresponding to the stroke pictures of all strokes stored in the stroke information set;
drawing and synchronously displaying each third layer on a screen of the terminal;
determining at least one target layer intersecting with the erasure coordinate information in each third layer based on the erasure coordinate information corresponding to the erasure operation;
and based on the erasing coordinate information and each target image layer, the pixels corresponding to the erasing operation in the graffiti handwriting are cleared by updating the stroke information set.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements a method of erasing graffiti handwriting in an OFD document page according to any one of claims 1 to 5 when the program is executed by the processor.
9. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of erasing graffiti handwriting in an OFD document page according to any one of claims 1 to 5.
CN202311050255.4A 2023-08-21 2023-08-21 Method and device for erasing graffiti handwriting in OFD document page Active CN116774877B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311050255.4A CN116774877B (en) 2023-08-21 2023-08-21 Method and device for erasing graffiti handwriting in OFD document page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311050255.4A CN116774877B (en) 2023-08-21 2023-08-21 Method and device for erasing graffiti handwriting in OFD document page

Publications (2)

Publication Number Publication Date
CN116774877A true CN116774877A (en) 2023-09-19
CN116774877B CN116774877B (en) 2023-12-19

Family

ID=88011994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311050255.4A Active CN116774877B (en) 2023-08-21 2023-08-21 Method and device for erasing graffiti handwriting in OFD document page

Country Status (1)

Country Link
CN (1) CN116774877B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117111817A (en) * 2023-10-24 2023-11-24 福昕鲲鹏(北京)信息科技有限公司 Annotation information erasing method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5813792B2 (en) * 2014-01-09 2015-11-17 株式会社東芝 System, data providing method, and electronic apparatus
CN109523609A (en) * 2018-10-16 2019-03-26 华为技术有限公司 A kind of method and terminal of Edition Contains
CN113467680A (en) * 2021-06-28 2021-10-01 网易(杭州)网络有限公司 Drawing processing method, drawing processing device, electronic equipment and storage medium
CN109445676B (en) * 2018-09-11 2022-05-20 宁波思骏科技有限公司 Method for deleting handwritten stroke information input by user on handwriting equipment
CN114879869A (en) * 2022-05-10 2022-08-09 深圳市掌阅科技有限公司 Note erasing method, electronic device and computer storage medium
CN113312017B (en) * 2021-05-25 2023-02-21 广州市奥威亚电子科技有限公司 Terminal handwriting synchronization method, system, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5813792B2 (en) * 2014-01-09 2015-11-17 株式会社東芝 System, data providing method, and electronic apparatus
CN109445676B (en) * 2018-09-11 2022-05-20 宁波思骏科技有限公司 Method for deleting handwritten stroke information input by user on handwriting equipment
CN109523609A (en) * 2018-10-16 2019-03-26 华为技术有限公司 A kind of method and terminal of Edition Contains
CN113312017B (en) * 2021-05-25 2023-02-21 广州市奥威亚电子科技有限公司 Terminal handwriting synchronization method, system, equipment and storage medium
CN113467680A (en) * 2021-06-28 2021-10-01 网易(杭州)网络有限公司 Drawing processing method, drawing processing device, electronic equipment and storage medium
CN114879869A (en) * 2022-05-10 2022-08-09 深圳市掌阅科技有限公司 Note erasing method, electronic device and computer storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117111817A (en) * 2023-10-24 2023-11-24 福昕鲲鹏(北京)信息科技有限公司 Annotation information erasing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN116774877B (en) 2023-12-19

Similar Documents

Publication Publication Date Title
US9141134B2 (en) Utilization of temporal and spatial parameters to enhance the writing capability of an electronic device
CN116774877B (en) Method and device for erasing graffiti handwriting in OFD document page
CN105843494A (en) Method and device for realizing region screen capture, and terminal
JP5664164B2 (en) Electronic information board device, information display method, program
CN107977155B (en) Handwriting recognition method, device, equipment and storage medium
US9678642B2 (en) Methods of content-based image area selection
US5404433A (en) Image processing apparatus having improved function for creating image using a plurality of original images
CN111949156A (en) Chinese character writing test method and system of writing device and writing device
CN111814716A (en) Seal removing method, computer device and readable storage medium
AU2018251560B2 (en) Live ink presence for real-time collaboration
CN112711362A (en) Method and device for generating hand-drawn flow chart icon in standardized manner
CN113313027A (en) Image processing method, image processing device, electronic equipment and storage medium
CN116402020A (en) Signature imaging processing method, system and storage medium based on OFD document
CN112035035B (en) Eraser realizing method and system capable of erasing strokes of top layer local area
EP3101527A1 (en) Information processing device, information processing program, and information processing method
CN110209280B (en) Response method, response device and storage medium
CN111724455A (en) Image processing method and electronic device
US9483171B1 (en) Low latency touch input rendering
CN113655973B (en) Page segmentation method and device, electronic equipment and storage medium
CN113436297A (en) Picture processing method and electronic equipment
CN107730571B (en) Method and apparatus for rendering an image
CN117111817B (en) Annotation information erasing method and device, electronic equipment and storage medium
JP2019023888A (en) Information processing apparatus, information processing program and information processing method
CN116166165B (en) Visual text selection method, visual text selection device and storage medium
JP2002279420A (en) Method and device for image processing and recording medium stored with program for making computer perform processing in device thereof

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
GR01 Patent grant
GR01 Patent grant