Method for generating control state image, method of using, device and electronic device
By using preset templates to generate control state images of different states, the problem of low efficiency in the design and use of control state images in the prior art is solved, and convenient batch modification and style conversion are achieved.
Patent Information
- Application Number
- CN202011566224.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-25
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-12-25
AI Technical Summary
In the prior art, the design and use of control state images are inefficient and are not convenient for modification. Artists need to readjust the image corresponding to each state, resulting in a long adjustment period and low efficiency.
By obtaining the original image of the target control, using preset templates to generate images corresponding to different states, the design efficiency of the control state image is improved and batch modification is facilitated.
It realizes batch generation or modification of control state images by modifying templates, improving design efficiency and facilitating style conversion and state image management.
Smart Images

Figure CN112650493B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer software technology, and in particular relates to a method for generating a control state image, a method for using the same, an apparatus, an electronic device, and a storage medium. Background Art
[0002] In human-computer interaction applications, controls, such as buttons, icons, and selection boxes, are often used to prompt users to perform actions. Controls typically have three states: normal, pressed, and disabled. The images of graphical controls corresponding to these three states are called tri-state diagrams, or control state images.
[0003] Currently, the control state images used in programs are designed by artists and then imported into the target program. When the target program runs, the corresponding control state image is displayed to the user based on the current state of the target control.
[0004] However, the above method of designing and using control state images is inefficient and inconvenient to modify. Summary of the Invention
[0005] The embodiments of the present application provide a method for generating a control status image, a method for using the control status image, an apparatus, an electronic device, and a storage medium, which can solve at least part of the above problems.
[0006] In a first aspect, an embodiment of the present application provides a method for generating a control state image, comprising:
[0007] Acquire a first image of a target control, the target control having a first number of states;
[0008] Based on the first image, a second number of second images are obtained using a second number of preset templates, each of the preset templates corresponds to a state of the target control, and the second number is less than or equal to the first number.
[0009] It should be understood that by generating the second image according to the template through the first image, that is, the original image, batch generation or modification of the second image can be conveniently achieved by modifying the template, thereby improving the design efficiency of the control state image and facilitating batch modification of the control state image.
[0010] In a second aspect, an embodiment of the present application provides a device for generating a control state image, comprising:
[0011] A first image acquisition module is used to acquire a first image of a target control, where the target control has a first number of states;
[0012] A second image acquisition module is used to obtain the second number of second images based on the first image using a second number of preset templates, each preset template corresponds to a state of the target control, and the second number is less than or equal to the first number.
[0013] In a third aspect, an embodiment of the present application provides a method for displaying a control status image, comprising:
[0014] In response to a detected refresh event of a target control, obtaining a current state of the target control;
[0015] According to the current state, obtaining a second image generated according to the method for generating a control state image according to the first aspect above;
[0016] The second image is displayed at the display position of the target control.
[0017] In a fourth aspect, an embodiment of the present application provides a device for displaying a control status image, comprising:
[0018] A state acquisition module, configured to acquire a current state of a target control in response to a detected refresh event of the target control;
[0019] A control state image acquisition module, configured to acquire, based on the current state, a second image generated according to the control state image generation method described in the first aspect above;
[0020] The control state image display module is used to display the second image at the display position of the target control.
[0021] In a fifth aspect, an embodiment of the present application provides an electronic device, including:
[0022] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method steps described in the first or third aspect above.
[0023] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising: the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in the first aspect or the third aspect are implemented.
[0024] In a seventh aspect, an embodiment of the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the method steps described in the first or third aspect above.
[0025] It can be understood that the beneficial effects of the second to seventh aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] 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 embodiments or descriptions of the prior art. 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.
[0027] Figure 1 This is a schematic diagram of a system provided by an embodiment of the present application;
[0028] Figure 2 This is a flowchart of a method for generating a control state image according to an embodiment of the present application;
[0029] Figure 3 is a flowchart of a method for generating a control state image provided by another embodiment of the present application;
[0030] Figure 4 This is a schematic diagram of an XML file of a method for generating a control state image provided by another embodiment of the present application;
[0031] Figure 5 is a flowchart of a method for generating a control state image provided by another embodiment of the present application;
[0032] Figure 6 is a flowchart of a method for generating a control state image provided by another embodiment of the present application;
[0033] Figure 7 This is a flowchart of a method for displaying a control status image provided by an embodiment of the present application;
[0034] Figure 8 Schematic diagram of the structure of a device for generating a control state image provided by an embodiment of the present application;
[0035] Figure 9 Schematic diagram of the structure of a display device for a control status image provided by an embodiment of the present application;
[0036] Figure 10 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0038] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0039] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0040] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0041] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0042] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0043] Human-computer interaction applications often use controls, such as buttons, icons, and selection boxes, to prompt users to perform actions. Controls typically have three states: normal, pressed, and disabled. Graphical controls that represent these three states are called tri-state images, or control state images. In some application scenarios, controls can have two or more states.
[0044] Currently, the control state images used in programs are designed by artists and then imported into the target program. When the target program runs, the corresponding control state image is displayed to the user based on the current state of the target control.
[0045] However, the above method of designing and using control state images is inefficient and difficult to modify. This is because when the control style needs to be changed, the artist needs to readjust the image corresponding to each state of the control, resulting in a long adjustment cycle and low efficiency.
[0046] Figure 1 1 . A control state image processing system 100 provided in an embodiment of the present application is shown. The system includes a control state image generating unit 110 and a control state image display unit 120 .
[0047] The control state image generating unit 110 is configured to generate one or more state images 130 corresponding to various states of the control according to the original image (or first image).
[0048] The control state image display unit 120 is configured to call the target state image generated by the control state image generation unit 110 according to the current state of the target control in response to a detected refresh event of the target control, and display the target state image.
[0049] The control state image generating unit 110 and the control state image displaying unit 120 may be the same electronic device or different electronic devices.
[0050] The state image 130 may be stored in a storage medium of the widget state image generating unit 110 or the widget state image displaying unit 120 , or may be stored in a storage medium independent of the image generating unit 110 and the widget state image displaying unit 120 .
[0051] It should be understood that the control state image generating unit 110 and the control state image displaying unit 120 may work in coordination or independently.
[0052] Figure 2 The method for generating a control state image provided by the embodiment of the present application is shown, which is applied to the above Figure 1The control state image generating unit 110 in the control state image processing system 100 shown in FIG. 1 may be implemented by software and / or hardware of the control state image generating unit 110. Figure 2 As shown, the method includes steps S110 to S120. The specific implementation principles of each step are as follows:
[0053] S110: Acquire a first image of a target control, where the target control has a first number of states.
[0054] In some embodiments, the first image can be an original image provided by an artist. In some embodiments, the first image, i.e., the original image, corresponds to a state of the target control. For example, when the target state has three states: normal, clicked, and disabled, the first image is the image displayed when the target control is in the normal state. In other embodiments, the first image does not correspond to any state of the target control; the first image serves as the basis for obtaining images corresponding to each state of the target control.
[0055] In some embodiments, the target control has a first number of states, and the first number can be one or more. Exemplarily, in the case where the target control has only one state, it can be that the target control has only one normal state, and no matter what operation the user performs on the target control, the display state of the target control does not change. In other embodiments, the target state has three states: normal state, click state, and unavailable state. The normal state is the state in which the target control is displayed when the user does not operate the target control. The click state is the state in which the target control is displayed in response to the click operation when the user clicks the target control. The unavailable state is the state in which the target control is displayed when it does not respond to the user's operation.
[0056] S120: Based on the first image, obtain a second number of second images using a second number of preset templates, each of the preset templates corresponds to a state of the target control, and the second number is less than or equal to the first number.
[0057] In particular, corresponding to each state of the target control, preset templates corresponding to these states are pre-set. In some embodiments, the target control has three different states. If the first image corresponds to a state of the target control, such as the normal state, two templates corresponding to the clicked state and the disabled state are pre-set. In other embodiments, if the target control has three different states and the first image does not correspond to any state of the target control, three templates corresponding to the normal state, the clicked state, and the disabled state are pre-set.
[0058] The preset template includes at least one of parameters such as a size parameter, a brightness offset parameter, a transparency offset parameter, an RGB offset parameter, and an RGB conversion parameter.
[0059] In a specific example, the first image is the original image, and the preset template corresponding to the click state includes parameters such as a transparency offset parameter and an RGB offset parameter. Obtaining the second image based on the first image, that is, obtaining the click state image through the original image, may include adjusting the RGB parameters of each pixel of the original image based on the original image according to the RGB offset parameter. Exemplarily, if the offset value of the preset R component in the preset template is positive 100, then the parameter indicates that the value of the R component of each pixel of the original image is increased by 100. The same can be said for the case where the RGB offset parameter is a negative value. Exemplarily, when the image transparency parameter is 0, it is fully transparent, and when it is 255, it is opaque. When the transparency offset parameter is positive 10, the parameter indicates that the transparency of each pixel of the original image is adjusted based on the original image, and the transparency parameter is increased by 10. The same can be said for the case where the transparency offset parameter is a negative value. It should be understood that if the above parameters reach the upper and lower limits of the image parameters, the parameter values of the adjusted second image can be the upper and lower limits of the image parameters.
[0060] In a specific example, the first image is the original image, and the preset template corresponding to the unavailable state includes parameters such as RGB conversion parameters. The RGB conversion parameters include the original color and the target color. Exemplarily, the preset template includes two groups of RGB conversion parameters, the first group: the original color is magenta and the target color is white; the second group: the original color is non-magenta and the target color is black. Obtaining the second image based on the first image, that is, obtaining the unavailable state image through the original image, may include converting the original color non-magenta in the original image to the target color black, and converting the original color magenta in the original image to the target color white. Thus, a black and white image is obtained to represent the unavailable state of the control.
[0061] In some embodiments, the first image does not correspond to a state of the target control, and a preset template is required to convert the first image to a state of the target control, such as the normal state. The template setting and conversion methods can refer to the above examples. In some specific examples, converting the first image to an image corresponding to the normal state also includes cropping the first image according to the size parameters of the preset template. In this case, the first number is equal to the second number.
[0062] It can be understood that if the target control has a first number of states, when the first image is the original image, and the first image corresponds to a state of the target control, a second number of preset templates is required to obtain second images corresponding to different states based on the original image, and the second number is equal to the first number minus one.
[0063] If the target control has a first number of states, when the first image is the original image and the first image does not correspond to a state of the target control, a second number of preset templates is required to obtain second images corresponding to different states based on the original image, and the second number is equal to the first number.
[0064] In some embodiments, using each of a second number of preset templates to obtain a second image based on the first image includes: using the first image to obtain a second number of to-be-converted images, and adjusting each of the to-be-converted images to the second images based on each of the second number of preset templates, each preset template corresponding to a state of the target control. The to-be-converted images are copies of the first image.
[0065] It should be understood that by generating the second image according to the template through the first image, that is, the original image, batch generation or modification of the second image can be conveniently achieved by modifying the template, thereby improving the design efficiency of the control state image and facilitating batch modification of the control state image.
[0066] In the above Figure 2 Based on the embodiment of the method for generating the control state image shown in FIG, in step S120, after obtaining the second image according to the first image using each preset template in the second number of preset templates, as shown in FIG. Figure 3 As shown, it also includes steps S310 to S330:
[0067] S310, merging the state images in a preset order to obtain and store a combined image; the state image includes the first image and the second images, or the state image includes the second images.
[0068] In some embodiments, the first image corresponds to a state of the target control, and the state image includes the first image and each second image.
[0069] In other embodiments, the first image does not correspond to a state of the target control, and the state image includes each second image.
[0070] In one specific example, the images corresponding to each state of the target control are in the form of separate image files. The images for each state are merged in a predetermined order to obtain a single image file containing the images for each state. For example, the target control has a normal state, a clicked state, and a disabled state. The predetermined order may be to arrange the normal state image, the clicked state image, and the disabled state image in order from left to right.
[0071] S320: Acquire attribute information of the combined image, and generate an Extensible Markup Language (XML) element according to the attribute information.
[0072] The attribute information of the combined image includes the storage path of the combined image, the offsets of each state image, and also includes at least one of the combined image description information, image index information, state image width information, and state image height information.
[0073] Exemplarily, the XML element generated according to the storage path path, the offsets offset of each state image, the combined image description information desc, the image index information key, the image width information width, and the image height information height can be:
[0074] <res key = "aaa" offset = "0,0;828,0;1656,0" path = "0104f2cf63a1d61ef87fcaf5eade7f2c.png" height = "960" desc = "啊啊啊" width = "828">.
[0075] Exemplarily, the image index information key corresponds to a target control and is used to search for other information attribute information of the state diagram of the target control.
[0076] Exemplarily, the offsets offset of each state image represent the starting coordinates of each state diagram of the target control. "0,0" represents the starting coordinates of the normal state image, "828,0" represents the starting coordinates of the click state, and "1656,0" represents the starting coordinates of the unavailable state image. It should be understood that by setting the state image offsets and the corresponding relationship between the preset offsets and states, support for multiple different states of the control can be achieved.
[0077] Exemplarily, the storage path path is the file name of the combined image. In some embodiments, it may also include the path where the combined image file is located.
[0078] Exemplarily, the image width information width and the image height information height are used to identify the width and height of each state image.
[0079] When displaying the state image corresponding to the current state of the target control, the target element of the XML file corresponding to the target control can be queried according to the image index information key, and the combined image can be obtained according to the path attribute of the target element. According to the corresponding relationship between the preset state of the target control and the order of each state image in the combined image, the offsets offset of each state image, as well as the image width information width and the image height information height, the combined image is intercepted to obtain the state image corresponding to the current state of the target control.
[0080] In some embodiments, obtaining attribute information of the combined image and generating an extended markup language XML element based on the attribute information includes: obtaining a storage path of the combined image; obtaining the offset of each state image in the combined image; and generating an XML element based on the storage path and the offset of each state image.
[0081] In some embodiments, obtaining the storage path of the combined image includes: generating a check value of the first image according to a preset algorithm; using the check value as the file name of the combined image; and determining the path of the combined image according to the file name. The preset algorithm may be a file check algorithm. Exemplarily, the preset algorithm may be an MD5 algorithm. Determining the path of the combined image according to the file name includes but is not limited to using the file name as the path, or a path in the form of a path plus a file name. It should be understood that by generating the check value of the first image according to the preset algorithm, the file corresponding to the XML file element can be made unique. When batch processing the first images of multiple target controls, the check value of the first image can be used to distinguish whether the first image is an image for which a state diagram has been generated, thereby avoiding repeated processing and improving processing efficiency.
[0082] S330: Write the XML element into an XML file.
[0083] Figure 4 The figure shows an XML file diagram of a method for generating a control state image provided by another embodiment of the present application. Figure 4 After generating the combined images for each state of the target control and the XML elements, you can add the corresponding XML elements to the XML file using a preset arrangement rule. The preset arrangement rule can be alphabetical order of the image index key or the priority order of the target controls, but this is not specifically limited here.
[0084] It should be understood that merging multiple state images into a combined image and coordinating it with the indexing function of the XML file can reduce the number of resource files called by users of the state images, such as the control state display unit, and facilitate style conversion and management of state images.
[0085] In the above Figure 2 Based on the embodiment of the method for generating the control state image shown in FIG, in step S110, after obtaining the first image of the target control, as shown in FIG. Figure 5 As shown, it also includes steps S510 to S540:
[0086] S510: Obtain a verification value of the first image according to the preset algorithm.
[0087] S520: Query the check value in an XML file. The XML file includes one or more XML elements, each of which includes a check value of a first image corresponding to a control state image.
[0088] The preset algorithm is the same file verification algorithm as the preset algorithm in the example of step S320 above. For example, the preset algorithm may be an MD5 algorithm.
[0089] S530: If the XML file contains an element containing a check value, the step of obtaining the second image based on the first image using each preset template in the second number of preset templates and subsequent steps are no longer performed.
[0090] S540: If the XML file does not contain an element containing a check value, executing the step of using each preset template in the second number of preset templates to obtain a second image according to the first image and subsequent steps.
[0091] In some embodiments, after obtaining the checksum of the first image through the MD5 algorithm, the XML elements corresponding to each control are searched in the pre-stored XML file. If the path attribute of any of these elements does not contain the checksum information, it means that the first image is a new original image and needs to be converted to generate the state diagram of the control. If there are elements containing checksums among some of these elements, it means that this original image has been used to generate the state diagram of the control and the original image can be ignored to avoid repeated operations. It should be understood that through Figure 5 The example shown can quickly export state diagrams of multiple target controls for the first image legend, thereby improving processing efficiency. It should be understood that in some embodiments, steps S510 to S540 may be omitted, and only steps S510, S520, and S540 may be included to achieve the same effect.
[0092] In the above Figure 2 、 3 Based on the embodiment of the method for generating the control state image shown in FIG5, if it is detected that there are multiple first images, each of which corresponds to a target control, the above-mentioned steps are performed for each first image. Figure 2 、 3 or the various steps of the method for generating a control state image shown in 5.
[0093] by Figure 2 For example, see the embodiment shown in Figure 6After step S120, step S610 is executed to determine whether there are any unprocessed first images. If it is detected that there are any unprocessed first images, steps S110 and S120 are executed for the unprocessed first images to process all the first images, that is, to generate state diagrams of each target control according to all the first images.
[0094] by Figure 3 Taking the embodiment shown as an example, step S610 is executed after step S330 to determine whether there is any unprocessed first image. If it is detected that there is still an unprocessed first image, steps S110 and S120, as well as steps S310 to S330 are executed for the unprocessed first image to process all the first images, that is, to generate a state diagram of each target control based on all the first images.
[0095] Figure 7 The display method of the control state image provided by the embodiment of the present application is shown, which is applied to the above Figure 1 The control state image display unit 120 in the control state image processing system 100 shown in FIG. 1 may be implemented by software and / or hardware of the control state image display unit 120. Figure 7 As shown, the method includes steps S710 to S730. The specific implementation principles of each step are as follows:
[0096] S710 : In response to a detected refresh event of a target control, obtain a current state of the target control.
[0097] In some embodiments, the refresh event of the target control may be an operation of the user on the target control, such as a click operation. The click operation includes but is not limited to clicking the target control by a mouse and clicking the target control by touch.
[0098] In other embodiments, the refresh event of the target control may be an update display operation automatically performed by the control state image display unit. The update display operation includes but is not limited to regularly updating the state of each control in the current display interface.
[0099] In a specific example, the control state image display unit detects a click operation of the user, queries the control state corresponding to the operation, and uses the state as the current state of the target control.
[0100] S720, according to the current state, obtain the Figure 2 、 3 , 5 or 6, the second image generated by the method for generating the control state image.
[0101] S730: Display the second image at the display position of the target control.
[0102] In some embodiments, the method for generating the control state image is as described above. Figure 2 The control state image generation method shown in the figure uses a state image generated by this method as an independent image file. The control state image display unit searches for the corresponding state image, that is, the second image described in the above embodiments, based on the pre-stored correspondence between the control state and the state image, and displays the second image of the state.
[0103] In some embodiments, if the method for generating the control state image is as described above Figure 2 Or the control state image generation method shown in 5, the state image generated by this method is a combined image composed of the first image and the second image, or the second image. The attribute information of the combined image is saved in an XML file. Exemplarily, the control state image display unit can query the target element of the XML file corresponding to the target control based on the image index information key, and obtain the combined image based on the path attribute of the target element. According to the correspondence between the preset state of the target control and the order of each state image in the combined image, the offset of each state image, and the image width information width and image height information height, the combined image is intercepted to obtain the state image corresponding to the current state of the target control.
[0104] The same steps included in the above embodiments are not described in detail here. Please refer to the corresponding description of the corresponding embodiment.
[0105] Corresponding to the above Figure 2 The method for generating the control state image shown in Figure 8 The figure shows a device M100 for generating a control state image provided by an embodiment of the present application, including:
[0106] A first image acquisition module M110 is configured to acquire a first image of a target control, where the target control has a first number of states;
[0107] The second image acquisition module M120 is used to obtain the second number of second images based on the first image using a second number of preset templates, each preset template corresponds to a state of the target control, and the second number is less than or equal to the first number.
[0108] It can be understood that the various implementation methods and implementation combinations and their beneficial effects in the above embodiments are also applicable to this embodiment and will not be described in detail here.
[0109] Corresponding to the above Figure 6 The display method of the control state image shown in Figure 9 The figure shows a control status image display device M700 provided by an embodiment of the present application, including:
[0110] A state acquisition module M710 is configured to acquire the current state of a target control in response to a detected refresh event of the target control;
[0111] A control state image acquisition module M720 is configured to acquire, according to the current state, a second image generated by the control state image generation method described in the first aspect above;
[0112] The control state image display module M730 is configured to display the second image at the display position of the target control.
[0113] It can be understood that the various implementation methods and implementation combinations and their beneficial effects in the above embodiments are also applicable to this embodiment and will not be described in detail here.
[0114] Figure 10 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. Figure 1 At least one of the widget state image generating unit 110 and the widget state image displaying unit 120 in the widget state image processing system 100.
[0115] like Figure 10 As shown, the electronic device D10 of this embodiment includes: at least one processor D100 ( Figure 10 (Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100. When the processor D100 executes the computer program D102, the steps of any of the above-described method embodiments are implemented. Alternatively, when the processor D100 executes the computer program D102, the functions of the modules / units in the above-described apparatus embodiments are implemented.
[0116] The electronic device D10 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will understand that Figure 10 This is merely an example of the electronic device D10 and does not constitute a limitation on the electronic device D10 . The electronic device D10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device D10 may also include input and output devices, network access devices, etc.
[0117] The processor D100 may be a central processing unit (CPU), or may be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0118] In some embodiments, the memory D101 may be an internal storage unit of the electronic device D10, such as a hard disk or memory of the electronic device D10. In other embodiments, the memory D101 may also be an external storage device of the electronic device D10, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device D10. Furthermore, the memory D101 may also include both an internal storage unit of the electronic device D10 and an external storage device. The memory D101 is used to store an operating system, an application, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory D101 may also be used to temporarily store data that has been output or is to be output.
[0119] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0120] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0122] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps of any of the above-mentioned method embodiments when executing the computer program.
[0123] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0124] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0125] If the integrated unit is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process steps in the above-mentioned method embodiments by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can at least include: any entity or device capable of carrying computer program code to a camera / terminal device, a recording medium, computer memory, read-only memory (ROM), random access memory (RAM), an electric carrier signal, a telecommunications signal, and a software distribution medium. Examples include a USB flash drive, a removable hard drive, a magnetic disk, or an optical disk. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunications signals.
[0126] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0127] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0128] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0129] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0130] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for generating a control state image, characterized in that: include: Acquire a first image of a target control, the target control having a first number of states; According to a preset algorithm, obtaining a verification value of the first image; The check value is searched in an XML file, and if the element containing the check value does not exist in the XML file, the step of obtaining the second image according to the first image by using each preset template in the second number of preset templates and subsequent steps are performed; the XML file includes one or more XML elements, each of which includes a check value of the first image corresponding to a control state image; Based on the first image, respectively obtain the second number of second images using a second number of preset templates, each of the preset templates corresponds to a state of the target control, and the second number is less than or equal to the first number; the preset templates include size parameters, brightness offset parameters, transparency offset parameters, RGB offset parameters and RGB conversion parameters; Merging the state images in a preset order to obtain and store a combined image; the state image includes the first image and the second images, or the state image includes the second images; Acquire attribute information of the combined image, and generate an extended markup language XML element according to the attribute information; the attribute information of the combined image includes a storage path of the combined image, offsets of each state image, and at least one of combined image description information, image index information, state image width information, and state image height information; wherein, according to a preset algorithm, generate a check value of the first image; use the check value as a file name of the combined image; and determine a storage path of the combined image according to the file name; Write the XML element into the XML file.
2. The generation method according to claim 1, characterized in that: Acquiring attribute information of the combined image and generating an extended markup language XML element according to the attribute information includes: Obtaining a storage path of the combined image; Obtaining the offset of each state image in the combined image; An XML element is generated according to the storage path and the offset of each state image.
3. The generation method according to claim 1 or 2, characterized in that: If it is detected that there are multiple first images, each of which corresponds to a target control, the generation method described in claim 1 or 2 is executed for each of the first images.
4. A method for displaying a control status image, characterized in that: include: In response to a detected refresh event of a target control, obtaining a current state of the target control; According to the current state, obtaining a second image generated by the method for generating a control state image according to any one of claims 1 to 3; The second image is displayed at the display position of the target control.
5. A device for generating a control state image, characterized in that: include: A first image acquisition module, used to acquire a first image of a target control, wherein the target control has a first number of states; A second image acquisition module, configured to obtain the second number of second images by using a second number of preset templates based on the first image, each preset template corresponds to a state of the target control, and the second number is less than or equal to the first number; the preset template includes a size parameter, a brightness offset parameter, a transparency offset parameter, an RGB offset parameter, and an RGB conversion parameter; The generating device is also used for: After acquiring a first image of the target control, acquiring a verification value of the first image according to a preset algorithm; The check value is searched in an XML file, and if the element containing the check value does not exist in the XML file, the step of obtaining the second image according to the first image by using each preset template in the second number of preset templates and subsequent steps are performed; the XML file includes one or more XML elements, each of which includes a check value of the first image corresponding to a control state image; Merging the state images in a preset order to obtain and store a combined image; the state image includes the first image and the second images, or the state image includes the second images; Acquire attribute information of the combined image, and generate an extended markup language XML element according to the attribute information; the attribute information of the combined image includes a storage path of the combined image, offsets of each state image, and at least one of combined image description information, image index information, state image width information, and state image height information; wherein, according to a preset algorithm, generate a check value of the first image; use the check value as a file name of the combined image; and determine a storage path of the combined image according to the file name; Write the XML element into the XML file.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the generation method according to any one of claims 1 to 3 or the display method according to claim 4 is implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the generating method according to any one of claims 1 to 3 or the display method according to claim 4 is implemented.
