Data processing method and electronic equipment
By creating a target canvas in an electronic device and automatically converting data into pixelated graphics, the problems of incomplete data display and high labor costs on small display screens are solved, and efficient pixelated processing is achieved.
Patent Information
- Application Number
- CN202411401418.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, due to the limited display accuracy of the small display screen, data cannot be displayed normally on the small display screen, and the cost is high when manually processing data and it is prone to incomplete input.
By creating a target canvas in an electronic device, rendering and displaying the pending data into the target canvas, determining the target pixel occupied by the pending data in the target canvas and the first coordinate information of each target pixel, and automatically converting the pending data into a pixelated figure based on the second coordinate information of each raster in the target canvas.
It reduces labor costs, avoids the problem of incomplete data entry, improves the effect of pixelation processing, and enables the small display to display data normally.
Smart Images

Figure CN120495458A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular relates to a data processing method and electronic equipment. Background Art
[0002] As electronic products become increasingly versatile, many small electronic devices are now equipped with small displays. These displays have limited resolution, sometimes only a few hundred pixels. This means that data (e.g., text, emojis, etc.) that can be displayed normally on mobile phones and computers cannot be displayed properly on these displays.
[0003] In related technologies, system personnel can pre-pixelate the data to be displayed to generate pixelated graphics, allowing the corresponding pixelated graphics to be displayed on a display screen with lower display accuracy. However, due to the large amount of data to be processed, manual processing by system personnel not only results in high labor costs but also easily leads to incomplete data entry. Summary of the Invention
[0004] The embodiments of the present application provide a data processing method and electronic device to solve the problems of high labor costs and incomplete text entry when converting data into pixelated graphics.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to an electronic device, and the method includes: rendering and displaying the data to be processed into a target canvas; the target canvas includes multiple grids, each grid does not overlap, and each grid includes at least one pixel; determining the target pixels occupied by the data to be processed in the target canvas and the first coordinate information of each target pixel; determining the target grid based on the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas; and converting the data to be processed into a pixelated graphic based on the target coordinate information corresponding to the target grid.
[0006] In the data processing method provided in the embodiment of the present application, the data to be processed is rendered and displayed on the target canvas, the target pixels occupied by the data to be processed in the target canvas and the first coordinate information corresponding to each target pixel are determined, and then the target grid in the target canvas that collides with the data to be processed and the target coordinate information of the target grid are determined based on the second coordinate information of each grid in the target canvas and the first coordinate information of the target pixel. The data to be processed is automatically pixelated based on the target coordinate information to obtain a pixelated graphic, thereby reducing labor costs and avoiding the problem of incomplete data entry.
[0007] In a second aspect, an embodiment of the present application provides a data processing device, which is applied to an electronic device, and the device includes: a data rendering module, which is used to render and display the data to be processed into a target canvas; the target canvas includes multiple grids, each grid does not overlap, and each grid includes at least one pixel; a pixel determination module, which is used to determine the target pixels occupied by the data to be processed in the target canvas and the first coordinate information of each target pixel; a grid determination module, which is used to determine the target grid based on the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas; a pixel processing module, which is used to convert the data to be processed into a pixelated graphic based on the target coordinate information corresponding to the target grid.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, and the processor is used to implement the above-mentioned data processing method when executing a computer program stored in the memory.
[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned data processing method is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0011] Figure 1 This is an application scenario diagram of the data processing method provided in the embodiment of the present application.
[0012] Figure 2 It is a flowchart of a data processing method provided in an embodiment of the present application.
[0013] Figure 3 Schematic diagram of the target canvas provided in an embodiment of the present application.
[0014] Figure 4 3 is a flow chart of a method for determining a target pixel provided in an embodiment of the present application.
[0015] Figure 5 It is a flowchart of the collision detection method provided in an embodiment of the present application.
[0016] Figure 6 This is a schematic diagram of the target grid determination process provided in an embodiment of the present application.
[0017] Figure 7AThis is a schematic diagram of a pixelated graphic provided in the first embodiment of the present application.
[0018] Figure 7B This is a schematic diagram of a pixelated graphic provided in the first embodiment of the present application.
[0019] Figure 7C This is a schematic diagram of a pixelated graphic provided in the first embodiment of the present application.
[0020] Figure 8 It is a structural diagram of the data processing device provided in an embodiment of the present application.
[0021] Figure 9 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features therein can be combined with each other in the absence of conflict.
[0023] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application.
[0025] As electronic products become increasingly versatile, many small electronic devices are now equipped with small displays. These displays have limited resolution, sometimes only a few hundred pixels. This means that data (e.g., text, emojis, etc.) that can be displayed normally on mobile phones and computers cannot be displayed properly on these displays.
[0026] In the related art, system personnel can pre-pixelate the data to be displayed to obtain pixelated graphics, so that the corresponding pixelated graphics can be displayed on a display screen with lower display accuracy. However, taking English text as an example, English text includes 26 English letters, and system personnel need to pre-pixelate the 26 English letters to obtain pixelated graphics. Taking Chinese text and emoticons as an example, the number of Chinese texts and emoticons is even greater. For example, there are more than 3,000 commonly used characters in Chinese text. If it is manually processed by system personnel, not only will the labor cost be high, but it is also easy to have problems with incomplete data entry. In addition, in the related art, when pixelating the data to be displayed, most of the time, the data is blurred, for example, the data is downsampled, resulting in poor pixelation effect and failure to meet user needs.
[0027] In view of the above problems, in order to solve the problems of high labor costs, incomplete text entry and poor pixelation effect when converting data into pixelated graphics, the embodiments of the present application provide a data processing method and electronic device that can automatically pixelate the data to be processed, reduce labor costs, avoid the problem of incomplete data entry, and improve the pixelation effect.
[0028] In order to better understand a data processing method and electronic device provided in an embodiment of the present application, an application environment applicable to the embodiment of the present application is first described below.
[0029] Figure 1 : is an application scenario diagram of the data processing method provided in the embodiment of the present application. As an embodiment, the data processing method provided in the embodiment of the present application can be applied to an electronic device 10. The electronic device 10 includes but is not limited to any electronic product that can interact with a customer through a keyboard, mouse, remote control, touchpad or voice control device, such as a personal computer, tablet computer, smart phone, digital camera, etc. Figure 1 As shown, the application scenario also includes a designated device 20, which represents a device with a small display screen. The display accuracy of the small display screen is relatively low. For example, the designated device 20 may include, but is not limited to, portable energy storage devices and smart homes. Portable energy storage devices may include power banks, mobile power supplies (also known as outdoor power supplies), and detachable, independently usable battery packs. Smart homes may include refrigerators, lamps, washing machines, makeup mirrors, and door locks.
[0030] In some embodiments, a user can input customized data to be displayed on the designated device 20 in the electronic device 10 through a keyboard, mouse, remote control, touchpad or voice control device (for ease of description, the present embodiment of the application is referred to as "data to be processed"), and the data to be processed may include English text, Chinese text, emoticons, etc. The electronic device 10 processes the data to be processed according to the data processing method provided in the embodiment of the present application to obtain a pixelated graphic to be displayed. In some embodiments, the designated device 20 is communicatively connected to the electronic device 10, and the electronic device 10 can send the pixelated graphic to be displayed to the designated device 20. After receiving the pixelated graphic, the designated device 20 displays the pixelated graphic on a small display screen.
[0031] In some embodiments, the designated device 20 and the electronic device 10 can be connected via wired communication or wireless communication to obtain the pixelated graphics output by the electronic device 10 via wired communication or wireless communication. When the designated device 20 and the electronic device 10 are connected via a wired connection, the designated device 20 and the electronic device 10 can be connected via a charging cable. At this time, in addition to realizing power transmission between the designated device 20 and the electronic device 10, the charging cable also performs communication data transmission at the same time, so that the electronic device 10 can transmit the pixelated graphics to the designated device 20 via the charging cable. It can be understood that a dedicated data cable can also be set between the designated device 20 and the electronic device 10 for communication. Therefore, after a wired connection is established between the designated device 20 and the electronic device 10, the pixelated graphics can be transmitted via wired communication.
[0032] In one embodiment, the designated device 20 and the electronic device 10 may also be connected via wireless communication. For example, the designated device 20 and the electronic device 10 are connected via wireless communication methods such as Bluetooth, WiFi, ZigBee, and a cellular network. After a wireless communication connection is established between the designated device 20 and the electronic device 10, the pixelated graphic may be obtained via the wireless communication method. It is understood that the wireless communication connection established between the designated device 20 and the electronic device 10 may be a point-to-point direct wireless communication connection, that is, without the need for a transfer device; or the designated device 20 and the electronic device 10 may also be wirelessly connected to the electronic device 10 via a server in the cloud. The electronic device 10 sends the pixelated graphic to the designated device 20 via the server.
[0033] In the data processing method provided in the embodiments of the present application, an electronic device can automatically pixelate the data to be processed to obtain a pixelated image. The electronic device then transmits the pixelated image to a designated device, which displays the pixelated image on a small display screen, thereby enabling a display screen with lower display accuracy to display the corresponding pixelated image.
[0034] Figure 2 is a flow chart of a data processing method provided in an embodiment of the present application. The data processing method can be applied to electronic devices (for example, Figure 1 The electronic device 10 in FIG. Figure 2 As shown, the data processing method may include the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0035] S11: Rendering and displaying the data to be processed in a target canvas. The target canvas includes multiple grids, each grid does not overlap, and each grid includes at least one pixel.
[0036] In at least one embodiment of the present application, in response to a display instruction, the electronic device creates a target canvas. The display instruction is used to indicate an instruction to display customized data in a specified device, or the display instruction can also be used to indicate the creation of a pixelated graphic corresponding to the customized data. The display instruction can be triggered by a user on the electronic device through a keyboard, mouse, remote control, touchpad, or voice-controlled device. The customized data can include, but is not limited to, Chinese text, English text, various characters, and emoticons.
[0037] In some embodiments, a canvas creation program is installed in the electronic device. When the electronic device receives a display instruction, the canvas creation program can be loaded, and the target canvas can be created by the canvas creation program. For example, the canvas creation program can be a canvas plug-in. After the canvas plug-in is loaded, the target canvas can be created by functions or instructions such as createCanvas.
[0038] In some embodiments, before creating the target canvas, the above method further includes: determining the target hardware parameters of the specified device; determining the canvas size of the target canvas based on the target hardware parameters; and creating the target canvas based on the canvas size. The target hardware parameters may include parameters such as the size, resolution, and pixels per inch (PPI) of the display screen in the specified device. In some embodiments, a mapping relationship between the target hardware parameters and the canvas size can be pre-set, and by querying the mapping relationship, the canvas size of the target canvas corresponding to the target hardware parameters can be determined. In other embodiments, a canvas size determination model can also be pre-set, and the input data of the canvas size determination model is the target hardware parameters of the specified device, and the output data is the canvas size of the target canvas. In other embodiments, the canvas size of the target canvas can also be set according to actual needs, which is not limited here.
[0039] In some embodiments, combined Figure 3 A schematic diagram illustrating the target canvas provided in the embodiment of the present application. Figure 3As shown, the size of the target canvas is 60*50, and the target canvas is divided to obtain multiple grids. The grid division method can be set according to actual needs and is not limited here. For example, by uniformly dividing the target canvas horizontally and vertically, multiple grids of the same size and rectangular shape are obtained. For example, the size of each grid is 9*9, each grid does not overlap, and the spacing between grids is 1. In other embodiments, the target canvas can also be non-uniformly divided horizontally and vertically to obtain multiple grids of different sizes and rectangular shapes. In practical applications, there is no limit on the size and shape of the grids. In some embodiments, each grid contains at least one pixel. For example, when the size of the grid is 9*9, each grid contains 81 1*1 pixels.
[0040] In at least one embodiment of the present application, the data to be processed represents data that a user inputs on an electronic device and needs to be processed. The data to be processed may include English text, Chinese text, and emoticons. The present application embodiment uses Chinese text as an example for explanation.
[0041] In some embodiments, rendering and displaying the data to be processed on a target canvas includes: determining rendering parameters for the data to be processed; and rendering and displaying the data to be processed on the target canvas based on the rendering parameters. Taking the data to be processed as text as an example, the rendering parameters may include font size, font color, text line height, text starting coordinates, and font format. Taking the data to be processed as an emoticon as an example, the rendering parameters may include emoticon width, emoticon height, etc. In some embodiments, taking the canvas creation program as a canvas plug-in as an example, the fillText() function may be called to render the data to be processed on the target canvas based on the rendering parameters.
[0042] S12: Determine the target pixels occupied by the data to be processed in the target canvas and first coordinate information of each target pixel.
[0043] In at least one embodiment of the present application, the target canvas includes multiple grids, each grid includes multiple pixels, and the coordinate information of each pixel (for ease of description, the present embodiment of the application is referred to as "first coordinate information") can be determined based on the coordinate system established for the target canvas. For example, please continue to refer to Figure 3 , determine the lower left corner of the target canvas as the origin of the coordinate system, and construct a coordinate system based on the origin, such as a two-dimensional rectangular coordinate system. In this way, the first coordinate information of each pixel in the target canvas can be determined. In other examples, the upper left corner of the target canvas can also be determined as the origin of the coordinate system, and the coordinate system can be constructed based on the origin, and so on. This application does not limit the method of establishing the coordinate system.
[0044] In some embodiments, when the data to be processed is rendered and displayed on the target canvas, the data to be processed will occupy multiple pixels in the target canvas, and the pixels occupied by the data to be processed in the target canvas are used as target pixels. Based on the constructed two-dimensional rectangular coordinate system, the first coordinate information of the target pixel can be determined.
[0045] S13 , determining a target grid according to the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas.
[0046] In at least one embodiment of the present application, each grid is a collection of multiple pixels, and the coordinate information of each grid (for ease of description, referred to as "second coordinate information" in the present embodiment) can represent the collection of coordinate information of multiple pixels in the grid. For example, please continue to refer to Figure 3 ,Will Figure 3 The grid in the lower left corner is used as the first grid. The first grid can be represented as a set of 81 pixels whose horizontal coordinates are in the range of [1, 9] and whose vertical coordinates are in the range of [1, 9]. The second coordinate information of the first grid can include the set of first coordinate information corresponding to the 81 pixels.
[0047] In some embodiments, the grid where the target pixel is located is determined based on the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas, and the grid where the target pixel is located is used as the target grid. Figure 3 The grid in the lower left corner is used as the first grid. If the first coordinate information of the target pixel is (9, 9), the target pixel is within the first grid, and the first grid is used as the target grid.
[0048] S14, converting the data to be processed into pixelated graphics according to the target coordinate information corresponding to the target grid.
[0049] In at least one embodiment of the present application, the second coordinate information of each grid represents a collection of coordinate information of multiple pixels in the grid, and the second coordinate information corresponding to the target grid is used as the target coordinate information.
[0050] In other embodiments, the second coordinate information of each grid represents the coordinate information of the vertex of the grid, such as the coordinate information of the upper left corner vertex of the grid.
[0051] After determining the target coordinate information corresponding to the target grid, the target grid is filled, and the data to be processed can be converted into pixelated graphics.
[0052] In some embodiments, filling the target grid may include traversing and filling all pixels in the target grid so that the target grid is distinguishable from other grids in the target canvas.
[0053] In other embodiments, filling the target grid may include filling the target grid with specified graphic information or a specified image, so that the target grid is distinguished from other grids in the target canvas.
[0054] In the data processing method provided in the embodiment of the present application, the data to be processed is rendered and displayed on the target canvas, the target pixels occupied by the data to be processed in the target canvas and the first coordinate information corresponding to each target pixel are determined, and then the target grid in the target canvas that collides with the data to be processed and the target coordinate information of the target grid are determined based on the second coordinate information of each grid in the target canvas and the first coordinate information of the target pixel. The data to be processed is automatically pixelated based on the target coordinate information to obtain a pixelated graphic, thereby reducing labor costs and avoiding the problem of incomplete data entry. In addition, the above method determines the pixelated graphic based on the first coordinate information of the target pixel occupied by the data to be processed in the target canvas and the second coordinate information of the grid in the target canvas. By determining the association between the target pixel and the grid, the pixelated graphic is determined, avoiding the use of downsampling to pixelate the data to be processed, which can improve the effect of pixelation processing and make the pixelated graphic meet user needs.
[0055] In at least one embodiment of the present application, rendering and displaying the data to be processed on a target canvas includes: displaying the data to be processed on the target canvas according to preset size information. The size information may include information such as the font size, width, and height of the data to be processed. The size information may be set based on actual needs, or the size information may be determined based on the display effect of the pixelated graphics corresponding to the data to be processed on a designated device. In some embodiments, a method for determining the size information may include: determining the grid size of a grid in the target canvas; and determining the size information of the data to be processed based on the grid size. The size information of the data to be processed may be a multiple of the grid size. Continuing with the example described in the above embodiment, assuming that the grid size of each grid is 9*9, the size information of the data to be processed may be set to 17 times the grid size, thereby achieving a better display effect of the pixelated graphics corresponding to the data to be processed on the designated device. In other examples, the size information of the data to be processed may be set to other multiples of the grid size, such as 12 times, 15 times, or 20 times, etc. This setting may be based on actual needs and is not limited by the present application.
[0056] The embodiment of the present application determines the size information of the data to be processed based on the display effect of the pixelated graphics corresponding to the data to be processed in the specified device, and renders the data to be processed into the target canvas based on the size information, thereby improving the display effect of the pixelated graphics corresponding to the data to be processed in the specified device.
[0057] In at least one embodiment of the present application, the data to be processed includes text, such as Chinese text and English text. Displaying the data to be processed in the target canvas according to the preset size information includes: displaying the text in the data to be processed in the target canvas according to the preset font size. The preset font size can be set according to actual needs, or the preset font size can be determined based on the display effect of the pixelated graphics corresponding to the data to be processed in the specified device. Continuing with the example in the above embodiment, assuming that the grid size of each grid is 9*9, and the border occupied by the text is 17 times the grid size, the display effect of the data to be processed in the specified device is better, then the font size corresponding to the text can be determined based on 17 times the grid size.
[0058] The embodiment of the present application determines the font size of the text based on the display effect of the pixelated graphics corresponding to the text in the specified device, and renders the text into the target canvas based on the font size, thereby improving the display effect of the pixelated graphics corresponding to the data to be processed in the specified device.
[0059] In at least one embodiment of the present application, the data to be processed may also include expressions, such as smiling expressions, laughing expressions, etc. Displaying the data to be processed in the target canvas according to the preset size information includes: displaying the expressions in the data to be processed in the target canvas according to the preset width and height. Among them, the preset width and height can be set according to actual needs, or the preset width and height can be determined according to the display effect of the pixelated graphics corresponding to the expression in the specified device. Continuing with the above example, assuming that the grid size of each grid is 9*9, and the border occupied by the expression is 17 times the grid size, the display effect of the data to be processed in the specified device is better, then it can be determined that the width corresponding to the expression is approximately 153 pixels, and the corresponding height is approximately 153 pixels.
[0060] The embodiment of the present application determines the width and height of the expression based on the display effect of the pixelated graphics corresponding to the expression in the specified device, and renders the expression into the target canvas based on the height and width, thereby improving the display effect of the pixelated graphics corresponding to the data to be processed in the specified device.
[0061] In at least one embodiment of the present application, when the data to be processed is rendered and displayed on the target canvas, the data to be processed will occupy a plurality of pixels in the target canvas, and the pixels occupied by the data to be processed in the target canvas are used as target pixels. Figure 4 FIG. 1 is a flow chart of a method for determining a target pixel provided by an embodiment of the present application, and the method for determining a target pixel is applied to an electronic device. Figure 4 As shown, the following steps are included:
[0062] S21, traverse the pixel attributes corresponding to each pixel in the target canvas.
[0063] In at least one embodiment of the present application, each pixel in the target canvas has a corresponding pixel attribute, which may be transparency. For example, before the data to be processed is rendered and displayed on the target canvas, the transparency of each pixel in the target canvas is 0. When the data to be processed is rendered and displayed on the target canvas, the transparency of some pixels in the target canvas changes, for example, to a transparency greater than 0. In this case, the pixels with the changed transparency can be regarded as the pixels rendered by the data to be processed, i.e., the target pixels.
[0064] S22 , determining target pixels occupied by the data to be processed from all pixels according to pixel attributes, and determining first coordinate information of each target pixel.
[0065] Continuing with the above embodiment, after the target pixel occupied by the data to be processed is selected, since the first coordinate information of each pixel in the target canvas can be determined according to the pre-constructed coordinate system, the first coordinate information of each target pixel can be determined.
[0066] In the data processing method provided in the embodiment of the present application, the target pixel occupied by the data to be processed is determined from all pixels based on the pixel attributes of each pixel in the target canvas, which can quickly and accurately determine the target pixel and improve the speed and accuracy of pixelated graphics determination.
[0067] In at least one embodiment of the present application, the grid where the target pixel is located can be determined based on a collision detection method, wherein the collision detection method is used to detect whether there is contact or overlap between two or more objects. In some embodiments, the target grid is determined based on the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas, including: performing collision detection on the second coordinate information based on the first coordinate information, determining the second coordinate information that collides with any first coordinate information as the target coordinate information, and determining the grid corresponding to the target coordinate information as the target grid.
[0068] In some embodiments, the second coordinate information of each grid represents a collection of first coordinate information of multiple pixels within the grid. During the collision detection process, if the second coordinate information of the grid contains any first coordinate information, it is determined that the pixel corresponding to the first coordinate information is within the grid, and the grid is determined as the target grid, and the second coordinate information corresponding to the target grid is determined as the target coordinate information; if the second coordinate information of the grid does not contain any first coordinate information, it is determined that there is no target pixel in the grid, and the grid does not need to be used as the target grid.
[0069] In other embodiments, the second coordinate information of each grid represents the vertex coordinate information of the grid. During the collision detection process, the range covered by the grid can be determined based on the vertex coordinate information of the grid and the grid side length of the grid. In this case, if any first coordinate information is included in the range covered by the grid, the pixel corresponding to the first coordinate information is determined to be within the grid, and the grid is determined to be the target grid, and the second coordinate information corresponding to the target grid is determined to be the target coordinate information. If any first coordinate information is not included in the range covered by the grid, it is determined that the target pixel does not exist in the grid, and the grid does not need to be used as the target grid.
[0070] The embodiment of the present application uses a collision detection method to quickly determine the grid where the target pixel is located, thereby improving the speed of pixelated graphics construction.
[0071] Figure 5 FIG is a flow chart of a collision detection method provided in an embodiment of the present application, and the collision detection method is applied to electronic equipment. Figure 5 As shown, the following steps are included:
[0072] S31 : Determine a first bounding box according to first coordinate information and a preset pixel side length.
[0073] In at least one embodiment of the present application, the preset pixel side length is the pixel side length of the target pixel. During collision detection, corresponding first bounding boxes can be determined based on the first coordinate information of each target pixel and the preset pixel side length. The number of first bounding boxes corresponds to the number of target pixels. The shape of the first bounding boxes can be a regular shape, such as a rectangle, or other irregular shapes, without limitation herein.
[0074] S32: Determine a second bounding box according to the second coordinate information and a preset grid side length.
[0075] In at least one embodiment of the present application, the preset grid side length may represent the side length of the grids in the target canvas. A second bounding box is constructed for each grid in the target canvas based on the second coordinate information and the preset grid side length. The number of second bounding boxes is the same as the number of grids in the target canvas.
[0076] Continuing with the above example, assuming that the size of each grid is 9*9, the side length of each grid (i.e., the preset grid side length) is the sum of the side lengths of 9 pixels. The second bounding box of each grid can be determined based on the second coordinate information and the preset grid side length.
[0077] S33: Determine a second bounding box that intersects with any first bounding box as a collision bounding box, and determine second coordinate information corresponding to the collision bounding box as target coordinate information.
[0078] In at least one embodiment of the present application, when a second bounding box intersects any first bounding box, if the second coordinate information of the grid corresponding to the second bounding box is determined to contain the first coordinate information of at least one target pixel, the second bounding box is used as the collision bounding box. In some embodiments, a correspondence exists between the collision bounding box and the grid of the target canvas. By querying this correspondence, the grid corresponding to the collision bounding box can be determined, and the second coordinate information corresponding to the grid can be determined as the target coordinate information.
[0079] In the data processing method provided in an embodiment of the present application, a first bounding box is determined based on first coordinate information and a preset pixel side length, and a second bounding box is determined based on second coordinate information and a preset grid side length. Subsequently, by determining whether the first bounding box and the second bounding box intersect, it is possible to quickly determine whether the target pixel is contained in the grid corresponding to the second bounding box, thereby improving the rate of determining the target coordinate information and thus improving the rate of determining the pixelated graphics.
[0080] In at least one embodiment of the present application, to improve data processing performance of an electronic device, an auxiliary thread may be established to determine a target grid. In some embodiments, determining the target grid based on first coordinate information of each target pixel and second coordinate information of each grid in the target canvas includes: transmitting the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas to the auxiliary thread; and processing the first coordinate information and the second coordinate information by the auxiliary thread to determine the target grid.
[0081] Combine Figure 6 The following is a flow chart illustrating the target grid determination process provided by the embodiment of the present application. Figure 6 As shown, a main thread and an auxiliary thread are established within the electronic device. The main thread is used to respond to display commands issued by the user, receive data to be processed, and render the processed data into a target canvas. The main thread determines the target pixels occupied by the data to be processed in the target canvas and the first coordinate information of each target pixel. The main thread determines the second coordinate information of each grid in the target canvas and transmits the first and second coordinate information to the auxiliary thread. The auxiliary thread processes the first and second coordinate information, determines the target grid, and transmits the target grid to the main thread. The main thread converts the data to be processed into a pixelated graphic based on the target coordinate information corresponding to the target grid.
[0082] The steps for determining the first coordinate information are described in detail in S11 to S12 of the specification, the steps for determining the pixelated graphics are described in detail in S14 of the specification, and the steps for determining the target grid are described in detail in S13 of the specification, which will not be repeated here.
[0083] In the data processing method provided by the embodiments of the present application, an auxiliary thread is created to perform collision detection based on the first coordinate information and the second coordinate information to determine the target grid. Since the amount of data processing for collision detection is large and requires a certain amount of processing time, an auxiliary thread is created to execute the calculation work of collision detection, and after the calculation is completed, the result is fed back to the main thread, so that the main thread can continue to respond to user operations during the calculation process of collision detection, avoiding the problem of interface jamming of the electronic device and improving the data processing performance.
[0084] In at least one embodiment of the present application, by displaying a custom graphic in the grid corresponding to the target coordinate information, the pixelated graphic of the data to be processed meets the user's requirements. In some embodiments, converting the data to be processed into a pixelated graphic according to the target coordinate information corresponding to the target grid includes: displaying preset graphic information in the grid corresponding to the target coordinate information to obtain the pixelated graphic corresponding to the data to be processed. The preset graphic information can be set according to actual needs. For example, the preset graphic information can include, but is not limited to, a combination of one or more of a circle, a rectangle, a triangle, or other user-defined shapes or images, and no limitation is made here.
[0085] Combined with 7A to 7C Illustrate the schematic diagram of the pixelated graphic provided by the embodiments of the present application. As 7A to 7C shown, all the data to be processed is "Li". Through the data processing method provided by the embodiments of the present application, the text "Li" is converted into a pixelated graphic. As Figure 7A shown, a rectangle is displayed in the grid corresponding to the target coordinate information to obtain the pixelated graphic. Figure 7B shown, a circle is displayed in the grid corresponding to the target coordinate information to obtain the pixelated graphic. As Figure 7C shown, a triangle is displayed in the grid corresponding to the target coordinate information to obtain the pixelated graphic.
[0086] In the data processing method provided by the embodiments of the present application, by displaying preset graphic information in the grid corresponding to the target coordinate information, the pixelated graphic corresponding to the data to be processed can meet the user's requirements.
[0087] In at least one embodiment of the present application, after the electronic device converts the data to be processed into a pixelated graphic, it can preview the pixelated graphic on the display screen. If the pixelated graphic meets the user's requirements, the target coordinate information is transmitted to the designated device, so that the designated device displays the pixelated graphic. By converting the data to be processed into a pixelated graphic and transmitting the pixelated graphic to the designated device for display, the embodiments of the present application enable the designated device with limited display precision to display the corresponding pixelated graphic.
[0088] In at least one embodiment of the present application, for texts or characters with relatively small amounts of data, such as the English letters az, AZ, Arabic numbers 0-9, etc., the data processing method provided in the embodiment of the present application can be used to pre-determine the target coordinate information of the above texts or characters, so that when the data to be processed is the above texts or characters, the predetermined target coordinate information is directly sent to the designated device, which can improve the display rate of pixelated graphics.
[0089] See also Figure 8 , Figure 8 1 is a schematic diagram of the structure of the data processing device provided in the embodiment of the present application. In some embodiments, the data processing device 100 may include multiple functional modules composed of computer program segments. The computer program of each program segment in the data processing device 100 may be stored in the memory of the electronic device and executed by at least one processor to perform (see Figure 2 Description) Data processing functions.
[0090] In this embodiment, the data processing device 100 can be divided into multiple functional modules according to the functions they perform. The functional modules may include: a data rendering module 101, a pixel determination module 102, a grid determination module 103, and a pixel processing module 104. A module as referred to herein refers to a series of computer program segments that can be executed by at least one processor and can perform fixed functions, and is stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0091] The data rendering module 101 is used to render and display the data to be processed into a target canvas. The target canvas includes a plurality of grids, each grid does not overlap, and each grid includes at least one pixel.
[0092] The pixel determination module 102 is used to determine the target pixels occupied by the data to be processed in the target canvas and the first coordinate information of each target pixel.
[0093] The grid determination module 103 is configured to determine a target grid according to the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas.
[0094] The pixel processing module 104 is used to convert the data to be processed into pixelated graphics according to target coordinate information corresponding to the target grid.
[0095] It can be understood that the data processing device 100 and the data processing method of the above embodiment belong to the same inventive concept, and the specific implementation method of each module of the data processing device 100 corresponds to the various steps of the data processing method in the above embodiment, which will not be repeated in this application.
[0096] The module division described above is a logical functional division, and other division methods may be used in actual implementation. In addition, the functional modules in the various embodiments of the present application can be integrated into the same processing unit, or each module can exist physically separately, or two or more modules can be integrated into the same unit. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0097] Figure 9 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 9 As shown, the electronic device 10 includes a memory 11, at least one processor 12, and at least one communication bus 13. The at least one processor 12 is configured to execute a data processing method implemented by a computer program stored in the memory 11, and the at least one communication bus 13 is configured to enable communication between the memory 11 and the at least one processor 12.
[0098] Those skilled in the art should understand that Figure 9 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present application. The electronic device 10 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.
[0099] In some embodiments, electronic device 10 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. Electronic device 10 may also be connected to client devices, including, but not limited to, any electronic product capable of human-computer interaction with a client via a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as personal computers, tablet computers, smartphones, and digital cameras.
[0100] It should be noted that the electronic device 10 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the scope of protection of the present application and incorporated herein by reference.
[0101] Although not shown, the power supply connected to the electronic device 10 may include any of one or more DC or AC power supplies, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device 30 may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be described in detail here.
[0102] In some embodiments, the memory 11 stores a computer program that implements all or part of the steps in the data processing method when executed by at least one processor 12. The memory 11 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0103] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device 10, etc.
[0104] In some embodiments, at least one processor 12 is the control core (Control Unit) of the electronic device 10, which uses various interfaces and lines to connect the various components of the entire electronic device 10, and executes various functions and processes data of the electronic device 10 by running or executing programs or modules stored in the memory 11, and calling data stored in the memory 11. For example, when the at least one processor 12 executes the computer program stored in the memory, it implements all or part of the steps of the data processing method in the embodiment of the present application; or implements all or part of the functions of the data processing device. At least one processor 12 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors and a combination of various control chips.
[0105] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for causing an electronic device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute parts of the methods of various embodiments of the present application.
[0106] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is only a logical function division, and other division methods may be used in actual implementation.
[0107] Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, and may be located in one place or distributed across multiple network elements. Some or all of these modules may be selected to achieve the objectives of this embodiment based on actual needs.
[0108] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0109] It is obvious to those skilled in the art that the present application is not limited to the details of the above-mentioned exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic characteristics of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "including" does not exclude other units or, and the singular does not exclude the plural. Multiple units or devices stated in the specification may also be implemented by one unit or device through software or hardware. Words such as first, second, etc. are used to indicate names and do not indicate any particular order.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A data processing method, applied to an electronic device, characterized in that: The method comprises: Rendering and displaying the data to be processed into a target canvas; the target canvas includes a plurality of grids, each of the grids does not overlap, and each of the grids includes at least one pixel; Determining target pixels occupied by the data to be processed in the target canvas and first coordinate information of each target pixel; determining a target grid according to the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas; The data to be processed is converted into a pixelated graphic according to target coordinate information corresponding to the target grid.
2. The data processing method according to claim 1, wherein: Rendering and displaying the data to be processed on the target canvas includes: The data to be processed is displayed in the target canvas according to preset size information.
3. The data processing method according to claim 2, wherein: The data to be processed includes text; Displaying the data to be processed in the target canvas according to the preset size information includes: The text in the data to be processed is displayed in the target canvas according to a preset font size.
4. The data processing method according to claim 1, wherein: The determining of target pixels occupied by the to-be-processed data in the target canvas and first coordinate information of each target pixel includes: Traversing pixel attributes corresponding to each pixel in the target canvas; According to the pixel attributes, target pixels occupied by the to-be-processed data are determined from all pixels, and first coordinate information of each target pixel is determined.
5. The data processing method according to claim 1, wherein: Determining the target grid according to the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas includes: The second coordinate information is subjected to collision detection based on the first coordinate information, the second coordinate information that collides with any of the first coordinate information is determined as the target coordinate information, and the grid corresponding to the target coordinate information is determined as the target grid.
6. The data processing method according to claim 5, wherein: The performing collision detection on the second coordinate information based on the first coordinate information and determining the second coordinate information that collides with any of the first coordinate information as the target coordinate information includes: Determining a first bounding box according to the first coordinate information and a preset pixel side length; Determining a second bounding box according to the second coordinate information and a preset grid side length; The second bounding box intersecting with any of the first bounding boxes is determined as a collision bounding box, and second coordinate information corresponding to the collision bounding box is determined as the target coordinate information.
7. The data processing method according to claim 1, wherein: Determining the target grid according to the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas includes: Passing the first coordinate information of each target pixel and the second coordinate information of each grid in the target canvas into the auxiliary thread; The first coordinate information and the second coordinate information are processed according to an auxiliary thread to determine the target grid.
8. The data processing method according to claim 1, wherein: The step of converting the data to be processed into pixelated graphics according to target coordinate information corresponding to the target grid includes: Preset graphic information is displayed in a grid corresponding to the target coordinate information to obtain a pixelated graphic corresponding to the data to be processed.
9. The data processing method according to claim 1, wherein: The method further comprises: The target coordinate information is transmitted to a designated device, so that the designated device displays the pixelated graphic.
10. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is configured to implement the data processing method according to any one of claims 1 to 9 when executing a computer program stored in the memory.