CN112306339B - Method and apparatus for displaying image - Google Patents

Method and apparatus for displaying image Download PDF

Info

Publication number
CN112306339B
CN112306339B CN202010903679.0A CN202010903679A CN112306339B CN 112306339 B CN112306339 B CN 112306339B CN 202010903679 A CN202010903679 A CN 202010903679A CN 112306339 B CN112306339 B CN 112306339B
Authority
CN
China
Prior art keywords
image
sub
displayed
images
graph
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010903679.0A
Other languages
Chinese (zh)
Other versions
CN112306339A (en
Inventor
曹博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010903679.0A priority Critical patent/CN112306339B/en
Publication of CN112306339A publication Critical patent/CN112306339A/en
Application granted granted Critical
Publication of CN112306339B publication Critical patent/CN112306339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

Embodiments of the present disclosure disclose methods and apparatus for displaying images. One embodiment of the method comprises: acquiring a sub-set corresponding to an image to be displayed and acquiring position information of sub-images in the sub-set, wherein the sub-images in the sub-set are obtained by segmenting the image to be displayed, and the position information of the sub-images is used for indicating the positions of the sub-images in the image to be displayed; drawing each subgraph in the subgraph set respectively according to the position information of the subgraph in the subgraph set so as to splice images to be displayed; and responding to the received display request aiming at the image to be displayed, and displaying the drawn subgraph in the subgraph set according to the display request. This embodiment enables low-latency display of an image to be displayed.

Description

Method and apparatus for displaying image
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and apparatus for displaying an image.
Background
At present, images are a common way of information presentation. For example, in the process of using a terminal application by a user, a large number of images are generally present in an application page. Generally, the server returns the page content (including text, image, video, etc.) requested by the user to the terminal according to the page loading request sent by the user, and then the terminal displays the page content to the user by means of rendering, etc.
In some scenes displaying images, the displayed image may be an image composed of several sub-images, such as a long image. In these cases, the user generally continues to request to load each sub-image by scrolling the page or the like until the display of the entire image is completed.
Disclosure of Invention
Embodiments of the present disclosure propose methods and apparatuses for displaying images.
In a first aspect, an embodiment of the present disclosure provides a method for displaying an image, the method including: acquiring a sub-set corresponding to an image to be displayed and acquiring position information of sub-images in the sub-set, wherein the sub-images in the sub-set are obtained by segmenting the image to be displayed, and the position information of the sub-images is used for indicating the positions of the sub-images in the image to be displayed; drawing each subgraph in the subgraph set respectively according to the position information of the subgraph in the subgraph set so as to splice images to be displayed; and responding to the received display request aiming at the image to be displayed, and displaying the drawn subgraph in the subgraph set according to the display request.
In some embodiments, the image to be displayed is a long map, wherein the display size of the long map exceeds the size of the display area.
In some embodiments, the method for displaying an image further includes: in response to receiving a storage request for a sub-graph in the displayed sub-graph set, the sub-graph set is stored.
In some embodiments, the width of the drawing region of the image to be displayed is the same as the width of the display region of the image to be displayed, and the height of the drawing region is the product of the ratio of the width of the display region of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed.
In some embodiments, drawing the sub-images in the sub-image set respectively according to the position information of the sub-images in the sub-image set to splice images to be displayed includes: the following drawing steps are performed: selecting unselected subgraphs from the subgraph set for drawing; determining whether the total height of each drawn sub-image exceeds the height of a drawing area of the image to be displayed; and in response to determining that the total height of the drawn sub-images does not exceed the height of the drawing area of the image to be displayed, continuing to perform the drawing step.
In some embodiments, drawing the sub-images in the sub-image set respectively according to the position information of the sub-images in the sub-image set to splice images to be displayed includes: and respectively drawing each sub-image in the sub-image set by using an image drawing method of a drawing class according to the position information of the sub-images in the sub-image set so as to splice the images to be displayed.
In a second aspect, an embodiment of the present disclosure provides an apparatus for displaying an image, the apparatus including: the acquisition unit is configured to acquire a sub-set corresponding to an image to be displayed and acquire position information of sub-images in the sub-set, wherein the sub-images in the sub-set are obtained by segmenting the image to be displayed, and the position information of the sub-images is used for indicating the positions of the sub-images in the image to be displayed; the drawing unit is configured to draw each sub-image in the sub-image set respectively according to the position information of the sub-images in the sub-image set so as to splice images to be displayed; and a display unit configured to display the drawn subgraph in the subgraph set according to a display request in response to receiving the display request for the image to be displayed.
In some embodiments, the image to be displayed is a long map, wherein the display size of the long map exceeds the size of the display area.
In some embodiments, the apparatus for displaying an image further includes: a storage unit configured to store the sub-graph set in response to receiving a storage request for a sub-graph in the displayed sub-graph set.
In some embodiments, the width of the drawing region of the image to be displayed is the same as the width of the display region of the image to be displayed, and the height of the drawing region is the product of the ratio of the width of the display region of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed.
In some embodiments, the rendering unit is further configured to: the following drawing steps are performed: selecting unselected subgraphs from the subgraph set for drawing; determining whether the total height of each drawn sub-image exceeds the height of a drawing area of the image to be displayed; and in response to determining that the total height of the drawn sub-images does not exceed the height of the drawing area of the image to be displayed, continuing to perform the drawing step.
In some embodiments, the rendering unit is further configured to: and respectively drawing each sub-image in the sub-image set by using an image drawing method of a drawing class according to the position information of the sub-images in the sub-image set so as to splice the images to be displayed.
In a third aspect, an embodiment of the present disclosure provides a terminal, where the electronic device includes: one or more processors; storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any implementation of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, which computer program, when executed by a processor, implements the method as described in any of the implementations of the first aspect.
According to the method and the device for displaying the image, before the image to be displayed is displayed, the sub-images are drawn in advance according to the positions corresponding to the sub-images, so that the sub-images corresponding to the drawn image can be directly displayed when a display request aiming at the image to be displayed is received, the time for loading and rendering the sub-images in the sub-image set according to the display request is saved, the image display speed is increased, the image display delay is avoided, and the fluency of the image display process is ensured.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for displaying an image according to the present disclosure;
FIG. 3 is a schematic illustration of one application scenario for a method of displaying an image according to an embodiment of the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method for displaying an image according to the present disclosure;
FIG. 5 is a schematic block diagram of one embodiment of an apparatus for displaying an image according to the present disclosure;
FIG. 6 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary architecture 100 to which embodiments of the method for displaying an image or the apparatus for displaying an image of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various client applications may be installed on the terminal devices 101, 102, 103. Such as browser-like applications, search-like applications, instant messaging tools, social platform software, payment-like applications, lifestyle service-like applications, information flow-like applications, and so forth.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as a backend server that provides support for client applications installed on the terminal devices 101, 102, 103. Server 105 may send the position information of the subgraph in the subgraph set and the subgraph corresponding to the image to be displayed to terminal devices 101, 102, and 103, and then terminal devices 101, 102, and 103 may display the image to be displayed according to the received position information of the subgraph in the subgraph set and the subgraph.
The position information of the subgraph and the subgraph in the subgraph set corresponding to the image to be displayed can also be directly stored locally in the terminal equipment 101, 102 and 103, the terminal equipment 101, 102 and 103 can directly extract the position information of the subgraph and the subgraph in the subgraph set corresponding to the image to be displayed and process the position information, and at this time, the server 105 does not exist.
It should be noted that the method for displaying an image provided by the embodiment of the present disclosure is generally performed by the terminal devices 101, 102, 103, and accordingly, the apparatus for displaying an image is generally disposed in the terminal devices 101, 102, 103.
It should be further noted that an image class application may also be installed in the server 105, and the server 105 may also display the image to be displayed according to the sub-image set corresponding to the image to be displayed and the position information of the sub-image in the sub-image set based on the image class application. At this time, the method for displaying the image may be executed by the server 105, and accordingly, the apparatus for displaying the image may be provided in the server 105. At this point, exemplary system architecture 100 may be absent of terminal devices 101, 102, 103 and network 104.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for displaying an image in accordance with the present disclosure is shown. The method for displaying an image includes the steps of:
step 201, obtaining a sub-set corresponding to an image to be displayed, and obtaining position information of sub-sets in the sub-set.
In the present embodiment, the image to be displayed may be an image of various formats, various contents. The sub-set corresponding to the image to be displayed may be composed of sub-images obtained by segmenting the image to be displayed.
Specifically, the image to be displayed may be segmented according to actual application requirements. For example, the image to be displayed may be divided into several equal parts from the height direction of the image to be displayed to obtain several sub-images.
For each sub-picture in the set of sub-pictures, the position information of the sub-picture may be used to indicate the position of the sub-picture in the image to be displayed. The position information of the subgraph can flexibly adopt various representation methods according to application requirements. For example, the position information of the subgraph can be characterized using its coordinates relative to the image to be displayed.
In this embodiment, an executing body (such as terminal devices 101, 102, 103 shown in fig. 1) of the method for displaying an image may acquire position information of a subgraph and a subgraph in a subgraph set corresponding to an image to be displayed from a server, a local device, a data source, or other storage devices.
Optionally, the service end may store a sub-set corresponding to the image to be displayed and position information of sub-images in the sub-set in advance. At this time, when receiving the request for indicating to display the image to be displayed, sent by the execution main body, the server may send the stored position information of the subgraph set and the subgraphs in the subgraph set to the execution main body.
In some optional implementations of the embodiment, the image to be displayed may be a long image. Wherein a long graph may refer to an image whose corresponding display size exceeds the size of the corresponding display area. The display size of the long figure may refer to the size of the long figure itself (e.g., the width and height of the long figure itself). The display area corresponding to the long map may refer to an area for displaying the long map. For example, the display area may be an area corresponding to a screen of a terminal device for displaying a long figure. At this time, the size of the display area may refer to the screen size (e.g., the width and height of the screen) of the terminal device for displaying the long figure.
When the image to be displayed is a long image, the display area usually cannot display the whole image to be displayed completely at a time, but only displays a partial area of the image to be displayed. For example, in some cases, the height of the image to be displayed is greater than the height of the display screen of the terminal. At this point, the user needs to continuously slide or scroll the display screen to view the complete image to be displayed.
In this case, the subgraph in the subgraph set can be obtained by segmenting the image to be displayed according to the height of the display area in the height direction of the image to be displayed. It should be understood that, at this time, only one of the subgraphs in the subgraph set has a height not greater than the height of the display area, and the remaining subgraphs have the same height as the display area.
At this time, numbers may be sequentially set for each sub-picture along the height direction of the image to be displayed, thereby obtaining a sequence of sub-pictures. At this time, the number of each sub-graph may also represent the position of the sub-graph in the image to be displayed.
And step 202, drawing each subgraph in the subgraph set respectively according to the position information of the subgraph in the subgraph set so as to splice images to be displayed.
In this embodiment, each sub-image is drawn according to a position of each sub-image in the image to be displayed, that is, the image to be displayed can be formed by the drawn sub-images. Under different application scenes, different drawing methods can be flexibly selected to draw the subgraph. For example, different methods for drawing subgraphs can be respectively adopted for execution subjects of different operating systems, applications in different programming languages in the execution subjects, and the like.
Step 203, responding to the received display request for the image to be displayed, and displaying the drawn subgraph in the subgraph set according to the display request.
In this embodiment, the to-be-displayed image spliced by the drawn sub-images may be displayed according to a received display request for the to-be-displayed image.
Optionally, the display request may also be used to instruct to display a sub-image in the image to be displayed, and at this time, the drawn sub-image indicated by the received display request may be displayed according to the display request.
For example, when the image to be displayed is a long image, the display screen of the execution main body cannot completely display the image to be displayed at a time, and only partial sub-images of the image to be displayed can be displayed. At this time, the user may send a display request through a slide operation or the like to request display of a sub-picture of an image to be displayed, which is not currently displayed.
As an example, if the subgraph in the subgraph set is obtained by dividing the image to be displayed according to the height of the display area in the height direction of the image to be displayed. In this case, the display screen of the execution main body can display at most one sub-image at a time. At this time, the user may request to display a sub-picture of the image to be displayed on the next screen through a slide operation. And then, displaying the sub-image which is not currently displayed in the image to be displayed and is positioned on the next screen of the current display screen according to the request of the user.
In the prior art, a lazy loading mode is generally adopted for an image to be displayed comprising a plurality of sub-images. That is, when a user requests to display a sub-image through a sliding operation, the sub-image is loaded from the server according to the request, and then the sub-image is rendered and displayed. For example, taking a long graph as an example, since the display screen can only display part of the sub-graph of the long graph, when a request is received from a user to display other part of the sub-graph of the long graph through, for example, a sliding operation, the other part of the sub-graph of the long graph is loaded from the server according to the request, and then the other part of the sub-graph of the loaded long graph is rendered and displayed. In the existing image display mode, a user often has higher image display delay in the process of browsing images.
According to the method for displaying the image, each sub-image is drawn in advance according to the position corresponding to the sub-image before the image to be displayed is displayed, namely the image to be displayed is drawn in advance, so that the sub-image corresponding to the drawn image can be directly displayed when a display request aiming at the image to be displayed is received, the time for loading and rendering the sub-images in the sub-image set according to the display request is saved, the image display speed is increased, and the image display delay is avoided.
Optionally, for an execution main body using an Android operating system, the sub-images in the sub-image set may be respectively drawn based on an image drawing method (such as a drawImage () method) provided by a Canvas class, so as to be spliced into images to be displayed.
As an example, the subgraph in the subgraph set can be loaded first by using an Image loading method (e.g., a new Image () method). And then drawing each subgraph in an onLoad method by using a Canvas class drawImage () method to splice images to be displayed.
Optionally, for an execution subject using the IOS operating system, the sub-images in the sub-image set may be respectively drawn based on an image drawing method (such as draw rect () method) provided by the uibezier path class, so as to be spliced into the image to be displayed.
Generally, an image drawing method is generally applied to image drawing, animation, or the like. The function of drawing an image by using an image drawing method is applied to image display to realize delay-free display of the image.
In some optional implementations of this embodiment, a width of the rendering region of the image to be displayed may be the same as a width of the display region of the image to be displayed. The height of the rendering region of the image to be displayed may be a product of a ratio of the width of the display region of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed.
It should be understood that the specific implementation of the rendering regions may vary from rendering approach to rendering approach. Taking the Android operating system as an example, a Canvas may be created with a Canvas class as a drawing area of an image to be displayed. At this time, if the width of the image to be displayed is W1, the height of the image to be displayed is H1, and the width of the display area (e.g., display screen) for displaying the image to be displayed is W2. Then when creating the rendering region, the width of the rendering region may be set to W2, while the height of the rendering region is set to (W2/W1) × H1.
Therefore, the size of the drawing area can be set according to the size of the display area of the image to be displayed and the size of the image to be displayed, so that the image to be displayed can be adapted to the size of the display area after the image to be displayed is drawn in the drawing area, and normal display of the image to be displayed is guaranteed.
In some optional implementations of this embodiment, the drawing of the image to be displayed may be completed by the following drawing steps:
step one, selecting unselected subgraphs from the subgraph set to draw.
In this step, each time, an unselected subgraph can be selected from the subgraph set for drawing. For example, a number may be set for each sub-picture in turn along the height direction of the image to be displayed in advance, thereby obtaining a sequence of sub-pictures. At this time, subgraphs can be sequentially selected according to the sequence in the subgraph sequence for drawing.
And step two, determining whether the total height of each drawn subgraph exceeds the height of the drawing area of the image to be displayed.
And step three, responding to the fact that the total height of each drawn subgraph does not exceed the height of the drawing area of the image to be displayed, and continuing to perform the drawing step.
In this step, if the total height of each drawn subgraph exceeds the height of the drawing area of the image to be displayed, it can be said that all the subgraphs in the subgraph set have been drawn, that is, the image to be displayed has been drawn. If the total height of each drawn subgraph does not exceed the height of the drawing area of the image to be displayed, it can be stated that there are subgraphs in the subgraph set which are not drawn, that is, the image to be displayed is not drawn. At this time, the above drawing steps may also be continued until the total height of the drawn sub-images exceeds the height of the drawing region of the image to be displayed, that is, until the drawing of the image to be displayed is completed.
By comparing the height of each drawn sub-image with the height of the drawing area, whether each sub-image in the sub-image set of the image to be displayed is drawn or not can be judged conveniently, and therefore the complete drawing of the image to be displayed and the complete display of the image to be displayed later are guaranteed.
With continued reference to fig. 3, fig. 3 is an illustrative application scenario 300 of the method for displaying an image according to the present embodiment. In the application scenario of fig. 3, a user may send a long-icon display request to a server 302 through a terminal 301 used by the user. The server may send sub-graph 3041 and sub-graph 3042 corresponding to the long graph 304 requested to be displayed by the long graph display request, and position information of the sub-graph 3041 and the sub-graph 3042 in the long graph 304 to the terminal 301. Specifically, as shown by reference numeral 303 in the figure, the long graph 304 is divided into a sub graph 3041 and a sub graph 3042 in advance, and the two sub graphs are numbered according to the positional relationship in the long graph 304. Sub-diagram 3041 is numbered "01" and sub-diagram 3042 is numbered "02".
Thereafter, as shown by reference numeral 305 in the diagram, the terminal 301 may first create a Canvas 306 by using a Canvas class, and then draw a sub-diagram 3041 and a sub-diagram 3042 in the Canvas 306 according to positions of the sub-diagram 3041 and the sub-diagram 3042 in the long diagram 304 by using a drawImage () method. At this time, as shown by reference numeral 307, drawing subgraph 3041 and subgraph 3042 can be spliced to long graph 304.
Afterwards, because the display screen of the terminal is limited, the drawn sub-image 3041 may be displayed on the terminal 301 directly, and if the user's sliding operation is received to request to view the sub-image 3042, the drawn sub-image 3042 is displayed on the terminal 301.
According to the method provided by the embodiment of the disclosure, before the image to be displayed is displayed, the image to be displayed is spliced in advance in a manner that each sub-image in the sub-image set of the image to be displayed is drawn according to the corresponding position. And furthermore, when a display request aiming at the image to be displayed is received, the drawn image to be displayed can be directly displayed, and the image display speed is improved. Particularly, when the display size of the image to be displayed (such as a long image) exceeds the size of the display area, each drawn sub-image of the image to be displayed can be directly displayed by the method, the time for loading and rendering the sub-image in real time according to the display request is saved, the situations of high delay, blockage and the like in the image display process are avoided, and the fluency of the image display process is ensured.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for displaying an image is shown. The flow 400 of the method for displaying an image comprises the steps of:
step 401, obtaining a sub-set corresponding to an image to be displayed, and obtaining position information of sub-sets in the sub-set.
And step 402, drawing each subgraph in the subgraph set respectively according to the position information of the subgraph in the subgraph set so as to splice the images to be displayed.
Step 403, in response to receiving a display request for the image to be displayed, displaying the drawn subgraph in the subgraph set according to the display request.
The specific implementation processes of the steps 401, 402, and 403 may refer to the related descriptions in the corresponding embodiment of fig. 2, and are not described herein again.
Step 404, in response to receiving a storage request for a sub-graph in the displayed sub-graph set, storing the sub-graph set.
In this embodiment, after displaying the subgraph in the subgraph set, the user may send a storage request for the displayed subgraph, and at this time, all the subgraphs in the subgraph set corresponding to the image to be displayed may be stored. According to different application scenes, all the subgraphs in the subgraph set corresponding to the image to be displayed can be cached or locally stored.
In the prior art, when an image to be displayed corresponds to a plurality of sub-images, each sub-image is sequentially loaded from a server and rendered for display, in this case, a user is usually required to send a storage request for each sub-image to store the sub-image, that is, each sub-image in a sub-image set corresponding to the image to be displayed is sequentially stored.
In the process of the method for displaying the image in the embodiment, because each sub-image in the sub-image set corresponding to the image to be displayed is drawn in advance, when a storage request of a user for the sub-images is received, all sub-images in the sub-image set corresponding to the image to be displayed can be stored at one time, the user is not required to store each sub-image in a time, and the image storage speed is increased. For the user, the time of user operation is saved, and the convenience of user operation is improved.
With further reference to fig. 5, as an implementation of the methods illustrated in the above figures, the present disclosure provides an embodiment of an apparatus for displaying an image, which corresponds to the method embodiment illustrated in fig. 2, and which is particularly applicable in various electronic devices.
As shown in fig. 5, the apparatus 500 for displaying an image provided by the present embodiment includes an acquisition unit 501, a rendering unit 502, and a display unit 503. The acquiring unit 501 is configured to acquire a sub-set corresponding to an image to be displayed and acquire position information of a sub-image in the sub-set, where the sub-image in the sub-set is obtained by segmenting the image to be displayed, and the position information of the sub-image is used to indicate a position of the sub-image in the image to be displayed; the drawing unit is configured to draw each sub-image in the sub-image set respectively according to the position information of the sub-images in the sub-image set so as to splice images to be displayed; and a display unit configured to display the drawn subgraph in the subgraph set according to a display request in response to receiving the display request for the image to be displayed.
In the present embodiment, in the apparatus 500 for displaying an image: the specific processing of the obtaining unit 501, the drawing unit 502, and the display unit 503 and the technical effects thereof can refer to the related descriptions of step 201, step 202, and step 203 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementations of the embodiment, the image to be displayed is a long image, wherein a display size of the long image exceeds a size of the display area.
In some optional implementations of the present embodiment, the apparatus 500 for displaying an image further includes: the storage unit (not shown in the figure) is configured to store the sub-graph set in response to receiving a storage request for a sub-graph in the displayed sub-graph set.
In some optional implementations of this embodiment, a width of a rendering region of the image to be displayed is the same as a width of a display region of the image to be displayed, and a height of the rendering region is a product of a ratio of the width of the display region of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed.
In some optional implementations of this embodiment, the drawing unit 502 is further configured to: the following drawing steps are performed: selecting unselected subgraphs from the subgraph set for drawing; determining whether the total height of each drawn sub-image exceeds the height of a drawing area of the image to be displayed; and in response to determining that the total height of the drawn sub-images does not exceed the height of the drawing area of the image to be displayed, continuing to perform the drawing step.
In some embodiments, the rendering unit 502 described above is further configured to: and respectively drawing each sub-image in the sub-image set by using an image drawing method of a drawing class according to the position information of the sub-images in the sub-image set so as to splice the images to be displayed.
The device provided by the above embodiment of the present disclosure acquires, by an acquisition unit, a sub-set corresponding to an image to be displayed, and acquires position information of a sub-image in the sub-set, where the sub-image in the sub-set is obtained by segmenting the image to be displayed, and the position information of the sub-image is used to indicate a position of the sub-image in the image to be displayed; the drawing unit respectively draws the subgraphs in the subgraph set according to the position information of the subgraph in the subgraph set so as to splice images to be displayed; the display unit responds to a display request for an image to be displayed and displays the drawn subgraphs in the subgraph set according to the display request, so that the subgraphs corresponding to the image to be displayed are drawn in advance, the drawn subgraphs of the image to be displayed can be directly displayed when the display request for the image to be displayed is received, time for loading and rendering the subgraphs in real time according to the display request is saved, the situations of high delay, blockage and the like in the image display process are avoided, and the smoothness of the image display process is ensured.
Referring now to fig. 6, shown is a schematic diagram of an electronic device (e.g., terminal device in fig. 1) 600 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle mounted terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the use range of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 6 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the terminal; or may exist separately and not be assembled into the terminal. The computer readable medium carries one or more programs which, when executed by the terminal, cause the terminal to: acquiring a sub-set corresponding to an image to be displayed and acquiring position information of sub-images in the sub-set, wherein the sub-images in the sub-set are obtained by segmenting the image to be displayed, and the position information of the sub-images is used for indicating the positions of the sub-images in the image to be displayed; drawing each subgraph in the subgraph set respectively according to the position information of the subgraph in the subgraph set so as to splice images to be displayed; and responding to the received display request aiming at the image to be displayed, and displaying the drawn subgraph in the subgraph set according to the display request.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a rendering unit, and a display unit. The names of these units do not in some cases constitute a limitation on the unit itself, and for example, the acquisition unit may also be described as a "unit that acquires a sub-set corresponding to an image to be displayed and acquires position information of a sub-set in the sub-set".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (9)

1. A method for displaying an image, comprising:
acquiring a sub-graph set corresponding to an image to be displayed and acquiring position information of a sub-graph in the sub-graph set, wherein the sub-graph in the sub-graph set is obtained by segmenting the image to be displayed, and the position information of the sub-graph is used for indicating the position of the sub-graph in the image to be displayed;
before the image to be displayed is displayed, drawing each sub-image in the sub-image set in advance according to the position information of the sub-image in the sub-image set so as to enable the drawn sub-images to be spliced into the image to be displayed, wherein the width of a drawing area of the image to be displayed is the same as the width of a display area of the image to be displayed, and the height of the drawing area is the product of the ratio of the width of the display area of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed;
and responding to the received display request aiming at the images to be displayed, and displaying the sub-images indicated by the display request in the spliced images to be displayed.
2. The method according to claim 1, wherein the image to be displayed is a long map, wherein a display size of the long map exceeds a size of the display area.
3. The method of claim 2, wherein the method further comprises:
storing the set of sub-graphs in response to receiving a storage request for a displayed sub-graph of the set of sub-graphs.
4. The method of claim 1, wherein the drawing the sub-images in the sub-image set respectively according to the position information of the sub-images in the sub-image set to splice the images to be displayed comprises:
the following drawing steps are performed:
selecting unselected subgraphs from the subgraph set for drawing;
determining whether the total height of each drawn sub-image exceeds the height of the drawing area of the image to be displayed;
and in response to determining that the total height of the drawn sub-images does not exceed the height of the drawing area of the image to be displayed, continuing to perform the drawing step.
5. The method according to one of claims 1 to 3, wherein the step of respectively drawing the sub-images in the sub-image set according to the position information of the sub-images in the sub-image set to splice the images to be displayed comprises the steps of:
and according to the position information of the subgraphs in the subgraph set, respectively drawing the subgraphs in the subgraph set by using a drawing method of a canvas class so as to splice the images to be displayed.
6. An apparatus for displaying an image, wherein the apparatus comprises:
the acquisition unit is configured to acquire a sub-graph set corresponding to an image to be displayed and acquire position information of a sub-graph in the sub-graph set, wherein the sub-graph in the sub-graph set is obtained by segmenting the image to be displayed, and the position information of the sub-graph is used for indicating the position of the sub-graph in the image to be displayed;
the drawing unit is configured to draw each sub-image in the sub-image set in advance according to position information of the sub-images in the sub-image set before the image to be displayed is displayed, so that the drawn sub-images are spliced into the image to be displayed, wherein the width of a drawing area of the image to be displayed is the same as the width of a display area of the image to be displayed, and the height of the drawing area is the product of the ratio of the width of the display area of the image to be displayed to the width of the image to be displayed and the height of the image to be displayed;
and the display unit is configured to respond to the received display request aiming at the images to be displayed, and display the sub-images indicated by the display request in the spliced images to be displayed.
7. The apparatus of claim 6, wherein the apparatus further comprises:
a storage unit configured to store a sub-graph set of the sub-graph set in response to receiving a storage request for the sub-graph displayed.
8. A terminal, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
9. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN202010903679.0A 2020-09-01 2020-09-01 Method and apparatus for displaying image Active CN112306339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010903679.0A CN112306339B (en) 2020-09-01 2020-09-01 Method and apparatus for displaying image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010903679.0A CN112306339B (en) 2020-09-01 2020-09-01 Method and apparatus for displaying image

Publications (2)

Publication Number Publication Date
CN112306339A CN112306339A (en) 2021-02-02
CN112306339B true CN112306339B (en) 2022-08-12

Family

ID=74483815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010903679.0A Active CN112306339B (en) 2020-09-01 2020-09-01 Method and apparatus for displaying image

Country Status (1)

Country Link
CN (1) CN112306339B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5509605B2 (en) * 2009-02-02 2014-06-04 凸版印刷株式会社 Image generation apparatus, image distribution system, and image generation method
CN109272448A (en) * 2018-08-21 2019-01-25 共享智能铸造产业创新中心有限公司 Draw the processing method of big pixel picture
CN109559322A (en) * 2018-11-30 2019-04-02 迈普通信技术股份有限公司 Image processing method, device, storage medium and electronic equipment
CN111435527A (en) * 2019-01-11 2020-07-21 北京京东尚科信息技术有限公司 Page picture display method and device, storage medium and electronic equipment
CN110322424B (en) * 2019-07-10 2022-12-09 安徽爱观视觉科技有限公司 High-resolution image processing method and device, VR image display method and VR equipment
CN110675465B (en) * 2019-09-23 2024-02-06 京东科技控股股份有限公司 Method and apparatus for generating image

Also Published As

Publication number Publication date
CN112306339A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
CN111399956B (en) Content display method and device applied to display equipment and electronic equipment
CN109976620B (en) Method, device, equipment and storage medium for determining list item display attribute information
CN111291244B (en) House source information display method, device, terminal and storage medium
CN109753332B (en) Method and device for displaying information
CN111339418A (en) Page display method and device, electronic equipment and computer readable medium
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN111324834B (en) Method, device, electronic equipment and computer readable medium for image-text mixed arrangement
CN114416261B (en) Information display method, device, equipment and medium
CN111273830A (en) Data display method and device, electronic equipment and computer readable medium
CN114417782A (en) Display method and device and electronic equipment
CN111259291B (en) View display method and device and electronic equipment
CN110069186B (en) Method and equipment for displaying operation interface of application
CN110134905B (en) Page update display method, device, equipment and storage medium
CN112256221A (en) Information display method and device and electronic equipment
CN111273884A (en) Image display method and device and electronic equipment
CN112306339B (en) Method and apparatus for displaying image
EP4207775A1 (en) Method and apparatus for determining object addition mode, electronic device, and medium
CN111290812B (en) Display method, device, terminal and storage medium of application control
CN111596987B (en) Page display method and device and electronic equipment
CN112068742A (en) Method, device, terminal and storage medium for controlling application window
CN113835792B (en) Method and device for drawing page element
US12020347B2 (en) Method and apparatus for text effect processing
CN113256659B (en) Picture processing method and device and electronic equipment
CN112380821B (en) Graphic display method and device and electronic equipment
CN112114723B (en) Page sliding method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant