Visual element display method, device and terminal
By calculating the number of independent pixels of the device and controlling the display of visual elements, it solves the problem of inconsistent display sizes on different terminals, simplifies interface design and improves user experience.
Patent Information
- Application Number
- CN201911345449.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-24
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2039-12-24
Smart Images

Figure CN113032060B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a visual element display method, device and terminal. Background Art
[0002] With the development of communication technology, mobile terminals such as mobile phones and tablet computers have become popular. For mobile phones or tablet computers of different sizes, the sizes of visual elements such as text, symbols, and pictures displayed on their screens will also be different, which will cause inconvenience to the design of mobile phone interfaces. Summary of the invention
[0003] The present invention provides a visual element display method, device and terminal, which make the target display size of the visual element in the interface of the display device consistent with the actual display size, making the interface design of the display device more convenient.
[0004] In a first aspect, the present invention provides a visual element display method, the visual element display method comprising:
[0005] Obtain a target display size of the visual element on the screen of the first display device;
[0006] Obtaining dots per inch and pixel density of the screen of the first display device;
[0007] Calculate the number of first device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size;
[0008] The visual element is controlled to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
[0009] In some embodiments of the present invention, calculating the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size includes:
[0010] Calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch;
[0011] Calculate the length of the pixel point according to the pixel density;
[0012] Calculating the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0013] A first ratio of the target display size to the length of the first device-independent pixel is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
[0014] In some embodiments of the present invention, obtaining a target size of the visual element in the first display device includes:
[0015] The actual display size of the visual element on the screen of the second display device is obtained as the target display size.
[0016] In some embodiments of the present invention, the actual display size includes the number of second-device independent pixels of the visual element in the screen of the second display device; and calculating the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size includes:
[0017] The number of first device-independent pixels of the visual element in the first display device is calculated according to the number of the second device-independent pixels, the dots per inch, and the pixel density.
[0018] In some embodiments of the present invention, calculating the number of first device independent pixels of the visual element in the first display device according to the number of second device independent pixels, the dots per inch, and the pixel density includes:
[0019] Calculating a second ratio of the dots per inch to the pixel density;
[0020] The product of the second ratio and the second device-independent pixel is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
[0021] In some embodiments of the present invention, calculating the number of first device independent pixels of the visual element in the first display device according to the number of second device independent pixels, the dots per inch, and the pixel density includes:
[0022] Calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch;
[0023] Calculate the length of the pixel point according to the pixel density;
[0024] Calculating the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0025] Get the length of the second device's independent pixel;
[0026] calculating a third ratio of the length of the second device-independent pixel to the length of the first device-independent pixel;
[0027] The product of the third ratio and the number of the second device-independent pixels is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
[0028] In some embodiments of the present invention, the number of first device independent pixels of the visual element in the first display device is stored in the blockchain in the form of blocks.
[0029] In a second aspect, the present invention provides a visual element display device, the visual element display device comprising:
[0030] A first acquisition unit, configured to acquire a target display size of a visual element on a screen of a first display device;
[0031] A second acquisition unit, configured to acquire dots per inch and pixel density of a screen of the first display device;
[0032] a calculation unit, configured to calculate the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size;
[0033] A control unit is used to control the visual element to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
[0034] In some embodiments of the present invention, the computing unit comprises:
[0035] A first calculation subunit, configured to calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch;
[0036] A second calculation subunit, used for calculating the length of the pixel point according to the pixel density;
[0037] A third calculation subunit, configured to calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0038] The fourth calculation subunit is used to calculate a first ratio of the target display size to the length of the first device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0039] In some embodiments of the present invention, the first acquisition unit is used to acquire the actual display size of the visual element on the screen of the second display device as the target display size.
[0040] In some embodiments of the present invention, the actual display size includes the number of second-device independent pixels of the visual element in the screen of the second display device; the calculation unit is used to calculate the number of first-device independent pixels of the visual element in the first display device based on the number of second-device independent pixels, the dots per inch and the pixel density.
[0041] In some embodiments of the present invention, the computing unit comprises:
[0042] a fifth sub-calculation unit, configured to calculate a second ratio of the dots per inch to the pixel density;
[0043] The sixth sub-calculation unit is used to calculate the product of the second ratio and the second device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0044] In some embodiments of the present invention, the computing unit comprises:
[0045] A first quantity calculation unit, configured to calculate the number of pixel points contained in each independent pixel of the first device according to the dots per inch;
[0046] A first length calculation unit, used for calculating the length of the pixel point according to the pixel density;
[0047] A second length calculation unit, configured to calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0048] A third acquisition unit, used to acquire the length of the independent pixel of the second device;
[0049] a third ratio calculation unit, configured to calculate a third ratio of the length of the second device independent pixel to the length of the first device independent pixel;
[0050] The second quantity calculation unit is used to calculate the product of the third ratio and the number of the second device independent pixels to obtain the number of the first device independent pixels of the visual element in the first display device.
[0051] In some embodiments of the present invention, the visual element display device also includes a blockchain unit, which is used to save the number of first device independent pixels of the visual element in the first display device in the blockchain in the form of blocks.
[0052] In a third aspect, the present invention provides a terminal comprising: a processor and a memory; the memory stores a plurality of instructions, and the processor loads the instructions stored in the memory to execute the steps in the visual element display method described in any one of the first aspects.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is loaded by a processor to execute the steps in the visual element display method as described in any one of the first aspects.
[0054] In the embodiment of the present invention, the target display size of the visual element in the screen of the first display device is obtained; and the dots per inch and pixel density of the screen of the first display device are obtained; then, according to the dots per inch, pixel density and target display size, the number of first device independent pixels of the visual element in the first display device is calculated; finally, the visual element is controlled to be displayed on the screen of the first display device according to the number of first device independent pixels. In the embodiment of the present invention, according to the dots per inch, pixel density and target display size of the first display device, the number of first device independent pixels of the visual element in the first display device can be accurately calculated, and then according to the number of first device independent pixels, the actual display size of the visual element on the screen of the first display device can be accurately controlled, so that the actual display size of the visual element is consistent with the target display size, thereby making the interface design of the first display device more convenient, compressing the physical display size, and improving the reading and viewing effect of the user. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0056] Figure 1 is a schematic diagram of an application scenario of the visual element display method provided by an embodiment of the present invention;
[0057] Figure 2 It is a structural diagram of an embodiment of the distributed system provided in the embodiment of the present invention applied to a blockchain system;
[0058] Figure 3 is a structural diagram of an embodiment of a block structure provided in an embodiment of the present invention;
[0059] Figure 4 is a schematic flow chart of an embodiment of a method for displaying visual elements provided in an embodiment of the present invention;
[0060] Figure 5 is a flowchart of an embodiment of calculating the number of first device independent pixels of a visual element in a first display device provided in an embodiment of the present invention;
[0061] Figure 6 is a schematic structural diagram of a screen of a first display device in an embodiment of the present invention;
[0062] Figure 7 is a schematic structural diagram of a screen of a second display device in an embodiment of the present invention;
[0063] Figure 8 is a structural schematic diagram of an embodiment of a visual element display device provided in an embodiment of the present invention;
[0064] Fig. 9 It is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0066] In the following description, specific embodiments of the present invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise specified. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and computer execution referred to herein includes operations by a computer processing unit of electronic signals representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.
[0067] The term "module" or "unit" used herein can be regarded as a software object executed on the computing system. The different components, modules, engines and services described herein can be regarded as implementation objects on the computing system. The apparatus and method described herein are preferably implemented in software, but can also be implemented in hardware, all within the scope of protection of the present invention.
[0068] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0069] To facilitate understanding of the embodiments of the present invention, several basic concepts that will be introduced in the description of the embodiments of the present invention are first introduced here:
[0070] 1) px (pixel).
[0071] Pixel, also known as image element, is the unit of resolution. A pixel is actually a color point, so it is also called pixel point. Its physical size is not fixed. In electronic devices, a large number of different color points make up an image. The image size and display resolution are mainly expressed by pixels. For example, when the resolution of the screen of an electronic device is 1920×1080px, it means that the number of pixels in the horizontal direction (length direction) of the screen is 1920, and the number of pixels in the vertical direction (width direction) is 1080.
[0072] 2)pt (point, device independent pixel).
[0073] Device-independent pixel, also known as point or absolute length, is a unit of length used in iOS system development. The length of device-independent pixel (pt) is a fixed value and does not change with the change of screen pixel density. In iOS system, 1pt = 1 / 163 inch. When the screen of the display device is a normal screen, the length of 1 device-independent pixel (pt) is equal to the length of 1 pixel (px); when the screen of the display device is a high-definition screen, the length of 1 device-independent pixel (pt) is equal to the length of 2 pixels (px).
[0074] 3)dp (Density-independent pixel, device independent pixel).
[0075] Device-independent pixel is a unit of length used in Android system development. The length of device-independent pixel (dp) is a fixed value and does not change with the change of screen pixel density. In the Android system, 1dp = 1 / 160 inch. According to the pixel density of the screen of different display devices, the length of device-independent pixel (dp) and the length of pixel (px) have different multiples. When the pixel density of the screen is 160ppi, the length of 1 device-independent pixel (dp) is equal to the length of 1 pixel (px). When the screen of the display device is a medium-definition screen, the length of 1 device-independent pixel (dp) is equal to the length of 1 pixel (px); when the screen of the display device is a high-definition screen, the length of 1 device-independent pixel (dp) is equal to the length of 1.5 pixels (px); when the screen of the display device is an ultra-definition screen, the length of 1 device-independent pixel (dp) is equal to the length of 2 pixels (px).
[0076] 4) dpi (Dots Per Inch)
[0077] Dots per inch is a unit of measurement used in dot matrix digital images, which refers to the number of sampled, displayable or output dots in each inch. For example, a 160dpi screen means that one inch contains 160 dots, and a 320dpi screen means that one inch contains 320 dots. For screens with different dots per inch, the size of the dots on them is also different.
[0078] 5) ppi (pixels per inch, pixel density)
[0079] Pixel density is a unit of density that indicates the number of pixels displayed on a 1-inch screen. The higher the pixel density of a screen, the higher the density at which the screen can display images, and the finer the details of the images displayed on the screen.
[0080] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0081] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0082] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0083] The solution provided in the embodiment of the present application may be a visual element display method involving artificial intelligence, that is, an artificial intelligence-based visual element display method is provided in the embodiment of the present application, the method comprising: using machine learning to obtain a target display size of the visual element on the screen of the first display device; obtaining the dots per inch and pixel density of the screen of the first display device; calculating the number of independent pixels of the first device of the visual element in the first display device according to the dots per inch, pixel density and target display size; controlling the visual element to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
[0084] An embodiment of the present invention provides a visual element display method, and the executor of the visual element display method may be a visual element display device provided by an embodiment of the present invention, or a terminal integrating the visual element display device, wherein the visual element display device may be implemented in hardware or software.
[0085] See also Figure 1 , Figure 1 This is a schematic diagram of an application scenario of the visual element display method provided in an embodiment of the present invention. Taking the visual element display device integrated in a terminal as an example, the terminal and the server are connected through a network. The server can be a working platform server (i.e., a server loaded with a working platform). The terminal can access the server, obtain display information such as pictures, texts, and videos from the server, and after processing the display information, convert it into a visual element of a preset size for display in a display device.
[0086] In an embodiment of the present invention, the server may be an independent server, or a server network or server cluster composed of servers. For example, the server described in the embodiment of the present invention includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing). In an embodiment of the present invention, communication between the server and the terminal can be achieved through any communication method, including but not limited to mobile communications based on the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on TCP / IP Protocol Suite (TCP / IP), User Datagram Protocol (UDP) and the like.
[0087] It is understandable that the terminal used in the embodiments of the present invention can be understood as a client device, which includes both receiving and transmitting hardware, that is, a device with receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such client devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The specific terminal can be a desktop terminal or a mobile terminal, such as: a mobile phone, a tablet computer, a laptop computer, etc.
[0088] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the solution of the present invention and does not constitute a limitation on the application scenario of the solution of the present invention. Other application environments may also include Figure 1 More or fewer servers, or server network connections, as shown in Figure 1 Only one server and one terminal are shown. It can be understood that one or more other servers and / or one or more terminals connected to the server network may also be included, which is not specifically limited here.
[0089] In addition, the system applied to the visual element display method involved in the embodiment of the present invention can be a distributed system formed by connecting a first display device and multiple nodes (any form of computing devices in the access network, such as servers and user terminals) through network communication.
[0090] Take the distributed system as the blockchain system as an example, see Figure 2 , Figure 2 This is an optional structural diagram of the distributed system 500 provided by the embodiment of the present invention applied to the blockchain system, which is formed by multiple nodes 600 (any form of computing devices in the access network, such as servers, user terminals) and clients, and a peer-to-peer (P2P) network is formed between the nodes 600. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In the distributed system, any machine such as a server or a terminal can join and become a node 600. The node 600 includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0091] See also Figure 2 The functions of each node in the blockchain system shown include:
[0092] 1) Routing: a basic function of a node, used to support communication between nodes.
[0093] In addition to the routing function, the node can also have the following functions:
[0094] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0095] For example, the services implemented by the application include:
[0096] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0097] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.
[0098] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0099] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0100] See also Figure 3 , Figure 3 This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0101] When the system used by the visual element display method in the embodiment of the present invention is a blockchain system, and the first display device in the embodiment of the present invention is a node in the blockchain system, the number of independent pixels of the first device of the visual element can be saved in the blockchain. Specifically, in the embodiment of the present invention, the visual element display method also includes: saving the number of independent pixels of the first device of the visual element in the first display device in the blockchain in the form of blocks. The specific method of adding a new block can refer to the description of the above-mentioned blockchain system, which will not be repeated here.
[0102] The following describes it in detail with reference to specific embodiments.
[0103] An embodiment of the present invention provides a visual element display method, which includes: obtaining a target display size of the visual element on the screen of a first display device; obtaining the dots per inch and the pixel density of the screen of the first display device; calculating the number of first device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size; and controlling the visual element to be displayed on the screen of the first display device according to the number of first device independent pixels.
[0104] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of an embodiment of a method for displaying visual elements provided in an embodiment of the present invention. The method for displaying visual elements includes:
[0105] 101. Obtain a target display size of a visual element on a screen of a first display device.
[0106] In some embodiments of the present invention, the visual element includes a picture, text, symbol, etc. displayed on the screen of the first display device. Obtaining the target display size of the visual element on the screen of the first display device may be the length, width, diameter, etc. of the visual element to be displayed on the screen of the first display device.
[0107] Specifically, taking the visual element as a picture as an example, the target display size of the visual element on the screen of the first display device may include the target display length and target display width of the picture on the screen of the first display device. The target display length and target display width can be determined according to the size of the screen of the first display device, so that the picture can be clearly displayed on the screen of the first display device.
[0108] In some embodiments of the present invention, acquiring the target size of the visual element in the first display device may include: acquiring the actual display size of the visual element in the screen of the second display device as the target display size.
[0109] The actual display size of the visual element on the screen of the second display device may be the length, width, diameter, etc. of the visual element actually displayed on the screen of the second display device. Taking the visual element as a picture as an example, the actual display size of the visual element on the screen of the second display device may include the actual display length and actual display width of the picture on the screen of the second display device. By using the actual display size of the visual element on the screen of the second display device as the target display size, the size of the visual element displayed on the screens of different display devices can be made the same.
[0110] In some embodiments of the present invention, the first display device may be a display device based on the Android system, and the second display device may be a display device based on the iOS system. Of course, the first display device may be a display device based on the iOS system, and the second display device may be a display device based on the Android system, or both the first display device and the second display device may be a display device based on the iOS system or a display device based on the Android system.
[0111] In addition, the first display device and the second display device may also be display devices based on Windows Phone system or other systems.
[0112] 102. Obtain dots per inch and pixel density of a screen of a first display device.
[0113] In some embodiments of the present invention, the screen model information of the first display device may be obtained, and then the dots per inch and pixel density of the screen of the first display device may be obtained from the screen model information. In addition, the pixel density of the screen of the first display device may also be calculated by obtaining the screen size and resolution of the first display device, and the specific calculation method is as follows:
[0114] ppi=M / Z=√(X 2 +Y 2 ) / Z;
[0115] Among them, ppi is the screen pixel density of the first display device; M is the number of pixels on the diagonal of the screen of the first display device; Z is the diagonal length of the screen of the first display device or the screen size (inch); X is the number of pixels in the horizontal direction (length direction) of the screen of the first display device; Y is the number of pixels in the vertical direction (width direction) of the screen of the first display device.
[0116] Taking the screen resolution of the first display device as 3120×1440px and the size of 6.39 inches as an example, the pixel density of the screen ppi=√(3120 2 +1440 2 ) / 6.39=538.
[0117] 103. Calculate the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size.
[0118] In some embodiments of the present invention, the first device-independent pixel may be a length unit used for Android system development, or may be a length unit used for iOS system or other system development, and the length of the first device-independent pixel is a fixed value and does not change with the change of screen pixel density. The number of first device-independent pixels of the visual element in the first display device may include: the number of first device-independent pixels of the visual element in the horizontal direction (length direction) of the screen of the first display device, and the number of first device-independent pixels in the vertical direction (width direction).
[0119] In some embodiments of the present invention, after obtaining the dots per inch and pixel density of the first display device and the target display size of the visual element, the number of first device independent pixels of the visual element in the first display device can be accurately calculated.
[0120] In some embodiments of the present invention, a method for calculating the number of first device independent pixels of a visual element in a first display device according to dots per inch, pixel density and target display size is as follows: Figure 5 As shown, the process may further include steps 301 to 304, which are described in detail as follows:
[0121] 301. Calculate the number of pixels contained in each independent pixel of the first device according to dots per inch.
[0122] In some embodiments of the present invention, the dots per inch of the screen of the first display device are different, and the number of pixels contained in the first device independent pixel of the screen is also different. Taking the first display device as a display device based on the Android system as an example, the number of pixels contained in the first device independent pixel is the ratio of the dots per inch to 160. When the dots per inch of the first display device is 160, it means that each inch contains 160 dots, and 1 first device independent pixel contains 1 pixel; when the dots per inch of the first display device is 320, it means that each inch contains 320 dots, and 1 first device independent pixel contains 2 pixels.
[0123] 302. Calculate the length of the pixel according to the pixel density.
[0124] In some embodiments of the present invention, the length of a pixel of the first display device is inversely proportional to the pixel density. Also, taking the first display device as a display device based on the Android system as an example, the length of its pixel is the ratio of 1 to the pixel density. For example, when the pixel density of the first display device is 538ppi, the length of a single pixel is 1 / 538 inch.
[0125] 303. Calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel.
[0126] In some embodiments of the present invention, the length of the first device independent pixel can be obtained by calculating the number of pixels contained in each first device independent pixel by calculating the dots per inch and multiplying the number by the length of the pixel.
[0127] 304. Calculate a first ratio of the target display size to the length of the first device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0128] In some embodiments of the present invention, a first ratio of the target display size to the length of the first device independent pixel can be calculated, and the ratio can be used as the number of first device independent pixels of the visual element in the first display device, so that the actual display size of the visual element on the screen of the first display device can be consistent with the target display size.
[0129] The specific calculation method of the number of first device independent pixels of the visual element in the first display device is as follows:
[0130] N = 160L*ppi / dpi;
[0131] Wherein, N is the number of first device independent pixels of the visual element in the first display device; L is the target display size of the visual element; ppi is the screen pixel density of the first display device; and dpi is the dots per inch of the screen of the first display device.
[0132] The following is a detailed description of the derivation steps for calculating the number of first device-independent pixels of the visual element in the first display device:
[0133] It is known that the dots per inch of the screen of the first display device is dpi; the pixel density is ppi; and the target display size is L. The number of pixels contained in an independent pixel of the first device is dpi / 160, and the length of a pixel is 1 / ppi. By calculating the product of the number of pixels contained in an independent pixel of the first device and the length of a pixel, the length of an independent pixel of the first device can be calculated to be dpi / (160*ppi).
[0134] Assuming that the number of first device independent pixels displayed on the screen of the first display device of the visual element is N, the product of N and the length of a first device independent pixel N*dpi / (160*ppi) is the actual display size of the visual element on the screen of the first display device. By making the actual display size equal to the target display size, that is: N*dpi / (160*ppi)=L; it can be calculated that N=160L*ppi / dpi.
[0135] It should be noted that the above step 301 may be performed before step 302 or after step 302, or step 301 and step 302 may be performed simultaneously, which is not limited here.
[0136] 104. Control the visual element to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
[0137] In some embodiments of the present invention, the above-mentioned calculation method can be used to respectively calculate the number of first device independent pixels of the visual element in the horizontal and vertical directions of the screen of the first display device, and then control the visual element to be displayed on the screen of the first display device according to the horizontal and vertical numbers, so that the actual display size of the visual element on the screen of the first display device is consistent with the target display size.
[0138] The embodiment of the present invention can accurately calculate the number of first device independent pixels of the visual element in the first display device based on the dots per inch, pixel density, and target display size of the visual element of the first display device, and then accurately control the actual display size of the visual element on the screen of the first display device based on the number of independent pixels of the first device, so that the actual display size of the visual element is consistent with the target display size, thereby making the interface design of the first display device more convenient, compressing the physical display size, and improving the reading and viewing effects of users.
[0139] It should be noted that the above-mentioned steps 101 and 102 can be executed simultaneously, or step 101 can be executed first and then step 102, or step 102 can be executed first and then step 101. That is, the target display size of the visual element on the screen of the first display device can be obtained first, and then the dots per inch and pixel density of the screen of the first display device can be obtained; the dots per inch and pixel density of the screen of the first display device can be obtained first, and then the target display size of the visual element on the screen of the first display device can be obtained; or, the dots per inch and pixel density of the screen of the first display device can be obtained while obtaining the target display size of the visual element on the screen of the first display device, and both of them can calculate the number of independent pixels of the first device of the visual element in the first display device.
[0140] In other embodiments of the present invention, the actual display size may include the number of second device independent pixels of the visual element in the screen of the second display device, and then the number of first device independent pixels of the visual element in the first display device is calculated according to the number of second device independent pixels, dots per inch and pixel density. In this way, the display size of the visual element in the screen of the first display device can be made the same as the display size in the screen of the second display device.
[0141] In some embodiments of the present invention, the above-mentioned calculation of the number of first device independent pixels of the visual element in the first display device according to the number of second device independent pixels, dots per inch and pixel density may include the following steps:
[0142] (1) Calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch.
[0143] In some embodiments of the present invention, the dots per inch of the screen of the first display device are different, and the number of pixels contained in the independent pixels of the first device is also different. Taking the first display device as a display device based on the Android system as an example, the number of pixels contained in each independent pixel of the first device is the ratio of dots per inch to 160. That is, X=dpi / 160, where X is the number of pixels contained in the independent pixels of the first device of the first display device; dpi is the dots per inch of the screen of the first display device.
[0144] For example, when the screen of the first display device is 160 dpi, the number of pixels contained in each independent pixel of the first device is 1; when the screen of the first display device is 320 dpi, the number of pixels contained in each independent pixel of the first device is 2.
[0145] (2) Calculate the length of the pixel based on the pixel density.
[0146] In some embodiments of the present invention, the length of a pixel of the screen of the first display device is inversely proportional to the pixel density, that is, the greater the pixel density of the screen of the first display device, the smaller the length of the pixel.
[0147] Optionally, the formula may be: D1 = 1 / ppi (inch), wherein D1 is the length of a pixel of the screen of the first display device, and ppi is the pixel density of the screen of the first display device. For example, when the pixel density of the screen of the first display device is 538ppi, the length of a single pixel is 1 / 538 inch.
[0148] Of course, the length of the pixel of the screen of the first display device may also be known. In this case, the length of the pixel may be directly obtained from the first display device without calculation.
[0149] (3) Calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel.
[0150] In some embodiments of the present invention, the length of the first device-independent pixel may be obtained by calculating the product of the number of pixels included in the first device-independent pixel and the length of the pixel.
[0151] Optionally, the formula can be followed: D2=X*D1=(dpi / 160)*(1 / ppi)=dpi / (160*ppi)(inch), wherein D2 is the length of an independent pixel of the first device, D1 is the length of a pixel of the screen of the first display device, ppi is the pixel density of the screen of the first display device, and dpi is the dots per inch of the screen of the first display device.
[0152] (4) Get the length of the second device independent pixel.
[0153] In some embodiments of the present invention, the length of the second device independent pixel of the second display device can be calculated in accordance with the length of the second device independent pixel of the first display device, or can be a length known in advance. For example, the second display device is a display device based on the iOS system, and the length of its second device independent pixel is 1 / 163 inch.
[0154] (5) Calculate a third ratio of the length of the second device-independent pixel to the length of the first device-independent pixel.
[0155] In some embodiments of the present invention, when the first display device is a display device based on the Android system and the second display device is a display device based on the iOS system, a third ratio of the length of an independent pixel of the second device to the length of an independent pixel of the first device is (1 / 163) / (dpi / (160*ppi))=(160*ppi) / (163*dpi).
[0156] Of course, when the first display device and the second display device are both display devices based on the Android system, or both display devices based on the iOS system, the third ratio of the length of the independent pixel of the second device to the length of the independent pixel of the first device is 1.
[0157] (7) Calculate the product of the third ratio and the number of second device-independent pixels to obtain the number of first device-independent pixels of the visual element in the first display device.
[0158] In some embodiments of the present invention, by calculating the product of the third ratio and the number of independent pixels of the second device, the number of independent pixels of the first device of the visual element in the first display device can be accurately obtained, so that the display size of the visual element in the first display device is consistent with the display size in the second display device.
[0159] The following is a detailed description of the derivation steps for calculating the number of first device-independent pixels of the visual element in the first display device:
[0160] It is known that the dots per inch of the screen of the first display device is dpi; the pixel density is ppi; the number of independent pixels of the second device is P; and the length of the independent pixel of the second device is 1 / 163 inch. The number of pixels contained in an independent pixel of the first device is dpi / 160, and the length of a pixel is 1 / ppi. By calculating the product of the number of pixels contained in an independent pixel of the first device and the length of a pixel, the length of an independent pixel of the first device can be calculated as dpi / (160*ppi).
[0161] Assuming that the number of first device independent pixels displayed on the screen of the first display device is N, the product of N and the length of a first device independent pixel, N*dpi / (160*ppi), is the actual display size of the visual element on the screen of the first display device. The actual display size of the visual element on the screen of the second display device is the product of the number of second device independent pixels and the length of the second device independent pixel, that is, P / 163 inches.
[0162] By making the actual display size of the visual element in the screen of the first display device equal to the actual display size of the visual element in the screen of the second display device, the following equation can be obtained:
[0163] N*dpi / (160*ppi)=P / 163;
[0164] By converting the above equation, we can obtain the number of first device independent pixels displayed by the visual element on the screen of the first display device, N = P*(160*ppi) / (163*dpi), which is the product of the third ratio and the number of second device independent pixels.
[0165] In some other embodiments of the present invention, the method for calculating the number of first device independent pixels of a visual element in a first display device according to the number of second device independent pixels, dots per inch, and pixel density may also include the following steps:
[0166] (1) Calculate a second ratio of dots per inch to pixel density.
[0167] In some embodiments of the present invention, a second ratio of dots per inch to pixel density of the first display device may be calculated. Taking the first display device based on an Android system as an example, the second ratio of dots per inch to pixel density is dpi / ppi.
[0168] (2) Calculate the product of the second ratio and the second device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0169] In some embodiments of the present invention, by calculating the product of the second ratio and the second device independent pixels, the number of first device independent pixels of the visual element in the first display device can be obtained more accurately, so that the display size of the visual element in the first display device is basically consistent with the display size in the second display device.
[0170] It can be understood that, in the above formula: N=P*(160*ppi) / (163*dpi)=P*(160 / 163)*(ppi / dpi), 160 / 163=0.98≈1, therefore, (160 / 163) in the formula can be omitted, and the number of first device independent pixels of the visual element in the first display device can be obtained directly by calculating the product of the second ratio and the second device independent pixels. This can simplify the calculation steps and more accurately obtain the number of first device independent pixels of the visual element in the first display device, so that the display size of the visual element in the first display device is basically consistent with the display size in the second display device.
[0171] The following takes the first display device being a display device based on the Android system and the second display device being a display device based on the iOS system as an example to illustrate the display of visual elements in the first display device.
[0172] Figure 6 is a schematic structural diagram of a screen of a first display device in an embodiment of the present invention; Figure 7 is a schematic diagram of the structure of the screen of the second display device in an embodiment of the present invention. Figure 6 , the visual element is displayed as a square on the screen of the first display device, and the number of first device independent pixels (dp) in the horizontal (length direction) and vertical (width direction) directions of the screen is N. Figure 7 The visual element is displayed as a square in the screen of the second display device, and the number of independent pixels (pt) of the second device in the horizontal direction (length direction) and the vertical direction (width direction) of the screen is P.
[0173] The pixel density of the screen of the first display device is 538ppi, and the pixel density of the screen of the second display device is 326ppi. If the visual element is displayed on the screen of the first display device according to N equal to 100, the actual display length (or width) of the visual element on the screen of the first display device is length = N*(dpi / 160)*(1 / 538) = 100*(538 / dpi)*(dpi / 160)*(1 / 538) = 100 / 160 = 0.625 inches. If the visual element is displayed on the screen of the second display device according to P equal to 100, the actual display length (or width) of the visual element on the screen of the second display device is length = 200 / 326 = 0.613 inches.
[0174] Obviously, the size of the visual element displayed on the screen of the first display device is smaller than the size displayed on the screen of the second display device.
[0175] In order to make the size of the visual element displayed on the screen of the first display device equal to the size of the visual element displayed on the screen of the second display device. The number of first device independent pixels of the visual element in the first display device can be calculated according to the formula N = P*(160*ppi) / (163*dpi), so that the size of the visual element displayed on the screen of the first display device is equal to the size of the visual element displayed on the screen of the second display device. Alternatively, the number of first device independent pixels of the visual element in the first display device can be calculated according to the formula N = (P*ppi) / dpi, so that the size of the visual element displayed on the screen of the first display device is approximately equal to the size of the visual element displayed on the screen of the second display device.
[0176] To facilitate better implementation of the visual element display method provided in the embodiment of the present invention, the embodiment of the present invention also provides a device based on the visual element display method. The meanings of the terms are the same as those in the visual element display method, and the specific implementation details can refer to the description in the method embodiment.
[0177] See also Figure 8 , Figure 8 A schematic diagram of the structure of a visual element display device provided in an embodiment of the present invention, wherein the visual element display device is applied to a terminal, wherein the visual element display device 300 may include a first acquisition unit 310, a second acquisition unit 320, a calculation unit 330 and a control unit 340, as follows:
[0178] The first acquisition unit 310 is configured to acquire a target display size of a visual element on a screen of a first display device.
[0179] In some embodiments of the present invention, the visual element includes a picture, text, symbol, etc. displayed on the screen of the first display device. Obtaining the target display size of the visual element on the screen of the first display device may be the length, width, diameter, etc. of the visual element to be displayed on the screen of the first display device.
[0180] The second acquisition unit 320 is used to acquire dots per inch and pixel density of the screen of the first display device.
[0181] In some embodiments of the present invention, the visual element display apparatus 300 may obtain screen model information of the first display device, and then obtain dots per inch and pixel density of the screen of the first display device from the screen model information.
[0182] The calculation unit 330 is used to calculate the number of first device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size.
[0183] In some embodiments of the present invention, the number of first device-independent pixels of a visual element in a first display device may include: the number of first device-independent pixels of the visual element in the horizontal direction (length direction) of the screen of the first display device, and the number of first device-independent pixels in the vertical direction (width direction).
[0184] The control unit 340 is used to control the visual element to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
[0185] In the embodiment of the present invention, the target display size of the visual element in the screen of the first display device is obtained by the first acquisition unit, and the dots per inch and pixel density of the screen of the first display device are obtained by the second acquisition unit. Then, the number of first device independent pixels of the visual element in the first display device is calculated by the calculation unit according to the dots per inch, pixel density and target display size. Finally, the control unit controls the visual element to be displayed on the screen of the first display device according to the number of first device independent pixels. The embodiment of the present invention can accurately calculate the number of first device independent pixels of the visual element in the first display device according to the dots per inch, pixel density and target display size of the visual element of the first display device, and then can accurately control the actual display size of the visual element on the screen of the first display device according to the number of first device independent pixels, so that the actual display size of the visual element is consistent with the target display size, thereby making the interface design of the first display device more convenient, compressing the physical display size, and improving the reading and viewing effect of the user.
[0186] In some embodiments of the present invention, the calculation unit 330 includes:
[0187] A first calculation subunit, configured to calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch;
[0188] A second calculation subunit, used to calculate the length of the pixel point according to the pixel density;
[0189] A third calculation subunit, configured to calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0190] The fourth calculation subunit is used to calculate a first ratio of the target display size to the length of the first device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0191] In some embodiments of the present invention, the visual element display device 300 can calculate a first ratio of the target display size to the length of the first device independent pixel, and use the ratio as the number of first device independent pixels of the visual element in the first display device, so that the actual display size of the visual element on the screen of the first display device is consistent with the target display size.
[0192] In some embodiments of the present invention, the first acquisition unit 310 is used to acquire the actual display size of the visual element on the screen of the second display device as the target display size.
[0193] In some embodiments of the present invention, the actual display size includes the number of second-device independent pixels of the visual element in the screen of the second display device; the calculation unit 330 is used to calculate the number of first-device independent pixels of the visual element in the first display device based on the number of second-device independent pixels, the dots per inch and the pixel density.
[0194] In some embodiments of the present invention, the calculation unit 330 includes:
[0195] a fifth sub-calculation unit, configured to calculate a second ratio of the dots per inch to the pixel density;
[0196] The sixth sub-calculation unit is used to calculate the product of the second ratio and the second device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
[0197] In the embodiment of the present invention, the visual element display device 300 can relatively accurately obtain the number of independent pixels of the first device of the visual element in the first display device by calculating the product of the second ratio and the independent pixels of the second device, so that the display size of the visual element in the first display device is basically consistent with the display size in the second display device.
[0198] In some other embodiments of the present invention, the calculation unit 330 includes:
[0199] A first quantity calculation unit, configured to calculate the number of pixel points contained in each independent pixel of the first device according to the dots per inch;
[0200] A first length calculation unit, used to calculate the length of a pixel point according to the pixel density;
[0201] A second length calculation unit, configured to calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel;
[0202] A third acquisition unit, used to acquire the length of the independent pixel of the second device;
[0203] a third ratio calculation unit, configured to calculate a third ratio of the length of the second device independent pixel to the length of the first device independent pixel;
[0204] The second quantity calculation unit is used to calculate the product of the third ratio and the number of the second device independent pixels to obtain the number of the first device independent pixels of the visual element in the first display device.
[0205] In the embodiment of the present invention, by calculating the product of the third ratio and the number of independent pixels of the second device, the number of independent pixels of the first device of the visual element in the first display device can be accurately obtained, so that the display size of the visual element in the first display device is consistent with the display size in the second display device.
[0206] In some embodiments of the present invention, the visual element display device also includes a blockchain unit, which is used to save the number of independent pixels of the first device of the visual element in the first display device in the blockchain in the form of blocks.
[0207] The embodiment of the present invention further provides a terminal, such as Fig. 9 As shown, it shows a schematic diagram of the structure of the terminal involved in the embodiment of the present invention, specifically:
[0208] The terminal may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will appreciate that Fig. 9 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0209] The processor 401 is the control center of the terminal, and uses various interfaces and lines to connect various parts of the entire terminal. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the terminal and processes data, thereby monitoring the terminal as a whole. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operation storage medium, user interface and application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0210] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating storage medium, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0211] The terminal also includes a power supply 403 for supplying power to each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management storage medium, so as to manage charging, discharging, and power consumption management through the power management storage medium. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharge storage media, power failure detection circuits, power converters or inverters, and power status indicators.
[0212] The terminal may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0213] Although not shown, the terminal may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 401 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 will run the application stored in the memory 402 to achieve various functions, as follows:
[0214] Obtain a target display size of the visual element on the screen of the first display device; obtain the dots per inch and the pixel density of the screen of the first display device; calculate the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size; control the visual element to be displayed on the screen of the first display device according to the number of first-device independent pixels.
[0215] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0216] To this end, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in any of the visual element display methods provided in the embodiments of the present invention. For example, the computer program can be loaded by the processor to execute the following steps:
[0217] Obtain a target display size of the visual element on the screen of the first display device; obtain the dots per inch and the pixel density of the screen of the first display device; calculate the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size; control the visual element to be displayed on the screen of the first display device according to the number of first-device independent pixels.
[0218] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0219] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0220] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the visual element display methods provided in the embodiments of the present invention, the beneficial effects that can be achieved by any one of the visual element display methods provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0221] The above is a detailed introduction to a visual element display method, device and terminal provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for displaying visual elements, characterized in that: The visual element display method comprises: Acquire the actual display size of the visual element on the screen of the second display device as the target display size; the second device independent pixel of the second display device is different from the first device independent pixel of the first display device; the second device independent pixel is a length unit used for IOS system development, and the first device independent pixel is a length unit used for Android system development; Obtaining dots per inch and pixel density of the screen of the first display device; Calculate the number of first device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density and the target display size; The visual element is controlled to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
2. The visual element display method according to claim 1, characterized in that: The calculating, according to the dots per inch, the pixel density and the target display size, the number of first device independent pixels of the visual element in the first display device comprises: Calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch; Calculate the length of the pixel point according to the pixel density; Calculating the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel; A first ratio of the target display size to the length of the first device-independent pixel is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
3. The visual element display method according to claim 2, characterized in that: The actual display size includes the number of second device independent pixels of the visual element in the screen of the second display device; and calculating the number of first device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size includes: The number of first device-independent pixels of the visual element in the first display device is calculated according to the number of the second device-independent pixels, the dots per inch, and the pixel density.
4. The visual element display method according to claim 3, characterized in that: The calculating the number of first device independent pixels of the visual element in the first display device according to the number of second device independent pixels, the dots per inch and the pixel density includes: Calculating a second ratio of the dots per inch to the pixel density; The product of the second ratio and the second device-independent pixel is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
5. The visual element display method according to claim 3, characterized in that: The calculating the number of first device independent pixels of the visual element in the first display device according to the number of second device independent pixels, the dots per inch and the pixel density includes: Calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch; Calculate the length of the pixel point according to the pixel density; Calculating the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel; Get the length of the second device's independent pixel; calculating a third ratio of the length of the second device-independent pixel to the length of the first device-independent pixel; The product of the third ratio and the number of the second device-independent pixels is calculated to obtain the number of first device-independent pixels of the visual element in the first display device.
6. The visual element display method according to any one of claims 1 to 5, characterized in that: The method further comprises: The number of first device independent pixels of the visual element in the first display device is stored in the blockchain in the form of blocks.
7. A visual element display device, characterized in that: The visual element display device comprises: A first acquisition unit is used to acquire an actual display size of the visual element on the screen of a second display device as a target display size; a second device-independent pixel of the second display device is different from a first device-independent pixel of the first display device; the second device-independent pixel is a length unit used for IOS system development, and the first device-independent pixel is a length unit used for Android system development; A second acquisition unit, configured to acquire dots per inch and pixel density of a screen of the first display device; a calculation unit, configured to calculate the number of first-device independent pixels of the visual element in the first display device according to the dots per inch, the pixel density, and the target display size; A control unit is used to control the visual element to be displayed on the screen of the first display device according to the number of independent pixels of the first device.
8. The visual element display device according to claim 7, characterized in that: The computing unit comprises: A first calculation subunit, configured to calculate the number of pixels contained in each independent pixel of the first device according to the dots per inch; A second calculation subunit, used for calculating the length of the pixel point according to the pixel density; A third calculation subunit, configured to calculate the length of the first device independent pixel according to the number of pixels included in the first device independent pixel and the length of the pixel; The fourth calculation subunit is used to calculate a first ratio of the target display size to the length of the first device-independent pixel to obtain the number of the first device-independent pixels of the visual element in the first display device.
9. A terminal, characterized in that: include: Processor and memory; The memory medium stores a plurality of instructions, and the processor loads the instructions stored in the memory to execute the steps in the visual element display method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Drawing method for application program interface adaptive to mobile terminals with different resolutions
CN103473044A
Text display method and device
CN104238890A
Interaction object control method and device
CN107450841A
Font display method and device applied to Android system and terminal device
CN108519962A
