Method and device for controlling watermark display
By dynamically setting the number of web page watermarks, the problem of improper watermark display caused by the difference in user privacy information length is solved, and the adaptive layout is realized and the anti-theft effect is improved.
Patent Information
- Application Number
- CN202310722872.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-16
- Publication Date
- 2024-12-17
AI Technical Summary
When adding watermarks to web pages, the watermark display is too dense or sparse due to the difference in length of user privacy information, which affects the reading and anti-theft effect.
By obtaining the display size and watermark content information of the target web page, dynamically set the number of row displays and column displays of the watermark to achieve adaptive layout and avoiding the situation where the watermark is too dense or sparse.
It effectively avoids the problem of too dense or sparse watermark display, ensuring the readability and anti-theft effect of web page information.
Smart Images

Figure CN119149841A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of web page processing, and in particular to a method and device for controlling watermark display. Background Art
[0002] Adding watermarks to web pages to prevent theft is becoming more and more common on the Internet. Most browsers now provide a custom watermark configuration interface, including: watermark content options (1-user name, 2-email, 3-mobile number, 4-user name + email) for generating watermark content information; pre-configuring the number of watermarks displayed per row and column; and other customized watermark beautification functions.
[0003] At present, if user privacy information (such as user name, email address, mobile phone number, etc.) is used to generate watermark content information, due to the different privacy information of different individuals, the characters of the generated watermark content information may be very long or very short. In other words, the character length of the watermark content information can change dynamically.
[0004] However, if the configuration has been completed on the custom watermark configuration interface, since the length of the watermark content information presented to different users is different, on the same web page, if the watermarks are presented too densely, it will interfere with the user's reading of the web page information, and if they are too sparse, it will not have an anti-theft effect on the web page itself. Summary of the invention
[0005] In view of this, the present application provides a method and device for controlling watermark display, the main purpose of which is to adapt to changes in screen size and changes in the length of characters in the watermark display size, and to dynamically set the number of rows and columns displayed in the target web page, thereby realizing adaptive layout display of watermarks in the target web page, which can effectively avoid the situation where the watermark display is too dense or sparse, and fully achieve the anti-theft effect of the watermark.
[0006] In order to achieve the above objectives, this application mainly provides the following technical solutions:
[0007] The first aspect of the present application provides a method for controlling watermark display, the method comprising:
[0008] In response to an operation of opening a target webpage, obtaining a first display size of a browser window where the target webpage is located, wherein the browser window is tiled to cover the entire display screen;
[0009] Determining content information and a second display size of the watermark to be displayed according to a preset watermark configuration rule;
[0010] Determining the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size;
[0011] According to the number of rows displayed and the number of columns displayed, a plurality of watermarks are displayed in an adaptive layout in the target web page.
[0012] A second aspect of the present application provides a device for controlling watermark display, the device comprising:
[0013] An acquisition unit, configured to acquire, in response to an operation of opening a target webpage, a first display size of a browser window where the target webpage is located, wherein the browser window is tiled to cover the entire display screen;
[0014] A first determining unit, configured to determine content information of a watermark to be displayed and a second display size according to a preset watermark configuration rule;
[0015] A second determining unit, configured to determine the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size;
[0016] A layout unit is used to adaptively layout and display the plurality of watermarks in the target web page according to the number of rows displayed and the number of columns displayed.
[0017] A third aspect of the present application provides a storage medium, which includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method for controlling watermark display as described above.
[0018] A fourth aspect of the present application provides an electronic device, the device comprising at least one processor, and at least one memory and a bus connected to the processor;
[0019] Wherein, the processor and the memory communicate with each other through the bus;
[0020] The processor is used to call the program instructions in the memory to execute the method for controlling watermark display as described above.
[0021] By means of the above technical solution, the technical solution provided by this application has at least the following advantages:
[0022] The present application provides a method and device for controlling watermark display. For an opened target web page, when the browser window is tiled across the entire display screen (i.e., the browser window is maximized), the display size of the target web page is obtained, and the content information and display size of a watermark are determined according to a preset watermark configuration rule. Then, based on the relationship between the two display sizes, the number of rows and columns of the watermark in the target web page are arranged to cover the entire target web page with the watermark. Compared with the prior art, the problem of too dense or diluted watermark display due to the fixed number of rows or columns of the pre-configured watermark is solved. The solution provided by the present application can adapt to the change of screen size and the change of character length of the watermark display size, and realize the dynamic setting of the number of rows and columns of the watermark in the target web page, thereby realizing the adaptive layout display of the watermark in the target web page, which can effectively avoid the situation where the watermark display is too dense or sparse, and fully achieve the anti-theft effect of the watermark.
[0023] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0025] Figure 1 A flow chart of a method for controlling watermark display provided in an embodiment of the present application;
[0026] Figure 2 A flow chart of another method for controlling watermark display provided in an embodiment of the present application;
[0027] Figure 3 A block diagram of a device for controlling watermark display provided in an embodiment of the present application;
[0028] Figure 4 A block diagram of another device for controlling watermark display provided in an embodiment of the present application;
[0029] Figure 5 An electronic device for controlling watermark display provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0031] Currently, for the operation of adding watermarks to web pages, most browsers provide a custom watermark configuration interface, such as pre-configuring the watermark display content to consist of privacy information such as "user name + email address", and pre-configuring the number of rows and columns displayed for the watermark.
[0032] However, the inventors have discovered that after habitually configuring the above data information, for different users, since the length of the privacy information varies, and may be too long or very short, the watermark will appear too dense or sparse when presented on the web page. If the presented watermark is too dense, it will interfere with the user's reading of the web page information, and if it is too sparse, it will not have an anti-theft effect on the web page itself.
[0033] To this end, after research, the inventors found that in order to avoid the situation where the watermark is displayed too densely or diluted, instead of pre-fixing the number of watermark rows and columns displayed in the custom watermark configuration interface, the watermark can be displayed in an adaptive layout in the web page. This will not only not affect or interfere with users' reading of the web page, but also use the watermark to achieve the desired anti-theft effect.
[0034] Therefore, based on the above considerations, the embodiment of the present application provides a method for controlling watermark display, such as Figure 1 , the present application embodiment provides the following specific steps:
[0035] 101. In response to an operation of opening a target webpage, a first display size of a browser window where the target webpage is located is obtained, where the browser window is tiled to cover the entire display screen.
[0036] The browser window is tiled across the entire display screen, which means that the browser window is maximized on the screen. The embodiment of the present application maximizes the display of the target web page on the screen by displaying the browser window in a maximized manner. Since, under the premise that the display of the target web page is maximized, if the watermark display does not appear too dense or sparse, then even if the display size of the target web page is changed based on the scaling of the browser window, the spacing state of the watermark in the target web page will not be changed. Accordingly, the embodiment of the present application performs the watermark layout operation under the premise that the display of the target web page is maximized, so that the watermark layout scheme is also applicable to the case where the browser window size changes.
[0037] In response to the operation of opening a target webpage, the embodiment of the present application starts a browser to display the target webpage in a browser window, and maximizes the browser window to adapt to the screen size, so as to obtain the display size of the target webpage under this premise.
[0038] It should be noted that in order to distinguish between the web page display size and the watermark display size, the embodiments of the present application use the words "first" and "second" for identification, such as identifying the web page display size as the "first display size" and identifying the display size of a watermark as the "second display size", and in the embodiments of the present application, the words "first" and "second" only serve as identification, and there is no other ambiguity such as sorting.
[0039] 102. Determine content information of the watermark to be displayed and a second display size according to a preset watermark configuration rule.
[0040] The preset watermark configuration rules may include, but are not limited to: watermark content options (1-user name, 2-email, 3-mobile phone number, 4-user name + email) for generating watermark content information; watermark display font size; watermark tilt angle; and other customized watermark beautification functions, etc. However, in the embodiment of the present application, the preset watermark configuration rules do not include pre-configuring the number of rows and columns displayed for the watermark.
[0041] For example, in the embodiment of the present application, watermark content information consisting of a user name and an email address can be generated based on the "4" determined by the watermark content option; further, the number of characters contained in the watermark can be determined based on the watermark content information, and by combining the watermark display font size, the watermark tilt angle, and the determined watermark beautification function, the display size of the watermark can be obtained.
[0042] 103. Determine the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size.
[0043] Based on the display size of the target web page and a watermark, it is equivalent to drawing two canvases, one large and one small. Based on the width and height of the large canvas and the small canvas, it is possible to further determine how many small canvases should be arranged in each row and each column in the large canvas, thereby obtaining the number of rows and columns displayed corresponding to the watermark in the target web page.
[0044] It should be noted that although the change in screen resolution will cause a difference in the maximum display size of the browser window, for example, for the same web page, when it is opened on a screen with a lower resolution (such as a laptop) or on a screen with a higher resolution (such as a desktop monitor), the maximum display size of the browser window will be different. However, the embodiment of the present application operates the watermark layout based on the comparison between the display size of the target web page and a watermark display size, that is, no matter how much the screen resolution changes, as long as the maximized display size of the browser window can be obtained, it will not affect the watermark adaptive layout solution provided by the embodiment of the present application, so that the watermark adaptive layout solution provided by the embodiment of the present application is also adapted to the situation where the screen resolution changes.
[0045] 104. Display multiple watermarks in a target web page in an adaptive layout according to the number of rows and columns of the watermarks.
[0046] The watermark adaptive layout scheme provided in the embodiment of the present application can not only adapt to the changes in the length of characters in a watermark display size, but also adapt to changes in the screen size, and dynamically set the number of rows and columns displayed for the watermark in the target web page, thereby realizing adaptive layout display of the watermark in the target web page, which can effectively avoid the situation where the watermark display is too dense or sparse, and fully achieve the anti-theft effect of the watermark.
[0047] In order to explain the above embodiment in more detail, the present application embodiment also provides another method for controlling watermark display, such as Figure 2 As shown, the present application embodiment provides the following specific steps:
[0048] 201. In response to an operation of opening a target webpage, a first display size of a browser window where the target webpage is located is obtained, where the browser window is tiled across the entire display screen.
[0049] In response to the operation of opening the target webpage, the embodiment of the present application obtains the display size of the target webpage under the premise of maximizing the browser window. For example, under the premise of maximizing the browser window:
[0050] Browser window pixel width = screen horizontal resolution;
[0051] The pixel height of the browser window = the vertical resolution of the screen – the height of the area occupied by the browser header column – the height of the area occupied by the system bottom toolbar.
[0052] 202. Determine content information of the watermark to be displayed and a second display size according to a preset watermark configuration rule.
[0053] This step can be further refined to include the following:
[0054] First, watermark content options are obtained from preset watermark configuration rules, and the watermark content options include at least account name, mobile phone number and email address; according to the watermark content options, the content information of the watermark to be displayed and the character length corresponding to the content information are determined.
[0055] For example, among the watermark content options (1-user name, 2-email, 3-mobile phone number, 4-user name + email), if "4" is selected, the watermark content information is generated based on the user name and email, and the character length of the watermark is obtained based on the number of characters it contains.
[0056] Secondly, the pixel length of the watermark is obtained by multiplying the character length by the preset watermark font size value; according to the preset tilt angle and the pixel length of the watermark, the pixel size corresponding to the watermark is determined as the second display size corresponding to the watermark.
[0057] For example, the pixel length of a watermark = the length of a watermark character * the watermark font size. After calculating the pixel length of a watermark, based on the inclination angle of the watermark required by the product, the Pythagorean theorem is used to calculate the horizontal pixel width and vertical pixel width of the watermark, that is, the width and height of the watermark, to obtain the display size of the watermark.
[0058] 203. Obtain pixel width values of the first display size and the second display size.
[0059] 204. Calculate a target ratio of the first display size to the second display size in terms of pixel width according to the pixel width value.
[0060] According to the customary layout of web page information and the public reading habits, it is usually read from left to right, and the next line is entered after one line is read. Correspondingly, the watermark content information is usually convenient for horizontal reading, so that the visual presentation of the watermark is consistent with the user's reading habit and will not interfere with the user's reading thinking. Therefore, the embodiment of the present application preferably calculates the target ratio based on the pixel width value in the display size of the target web page and a watermark as a reference factor for the watermark arrangement.
[0061] It should be noted that, according to different customary layout methods of web page information and public reading habits, the pixel height value in the display size may also be selected for calculation to obtain the target ratio, which is not specifically limited here.
[0062] 205. Determine a target watermark layout template corresponding to the target ratio by searching for a preset mapping relationship between the preset ratio interval and the preset watermark layout template.
[0063] In consideration of the moderate spacing of watermark layouts, the embodiment of the present application also adds some diverse watermark layout templates to enrich the diverse watermark arrangement effects.
[0064] Exemplarily, a mapping relationship between a preset ratio interval and a preset watermark layout template can be pre-constructed. For example, since the preferred implementation of the embodiment of the present application is a target ratio obtained based on the pixel width of the display size, the optimal number of watermarks arranged on the line display can be measured based on empirical values, such as 5, and a preset ratio interval is constructed based on the optimal number, such as: [3,4], [5,6] and [6,7], etc., wherein, since the target ratio may be a non-integer, the boundary value of the preset ratio interval is preferably a positive integer in the embodiment of the present application, so as to facilitate the standardized measurement of how many watermarks are suitable for layout on the line display.
[0065] Different preset ratio intervals can be pre-associated with different preset watermark layout templates. For example, based on the above-mentioned watermark row display number of 5 (judged to be better based on experience) and the preset ratio interval, since this better row display number (i.e., 5) is closer to the preset ratio interval [5,6], the preferred implementation is that, since the matrix layout is the most widely used and conventional layout method, the preset ratio interval [5,6] is associated with an XY matrix layout template (where X represents the number of row layouts, Y represents the number of column layouts, and X and Y are each positive integers).
[0066] To give a further example, since the preset ratio interval [6,7] is larger than the optimal number of rows displayed (i.e., 5), it means that under the premise that the anti-theft effect has been achieved, having more layouts will only result in additional costs. Therefore, the preferred implementation method is to select a watermark layout template that has a dense effect less than that presented by a matrix layout, such as a watermark layout with a difference in the number of odd and even rows and that can be arranged in staggered positions.
[0067] It should be noted that the above-mentioned matrix layout templates and layout templates with different numbers of odd and even rows are only illustrative examples of the embodiments of the present application. In order to achieve watermark layout diversity, moderate layout cost, and protect the complete display of watermark content information (i.e., avoid the situation where only half of the watermark content information can be displayed due to insufficient pixel width position on the row display), the embodiments of the present application can pre-design a variety of preset watermark layout templates, so that when the adaptive watermark layout is subsequently implemented, the watermark spacing is moderate (avoiding being too dense or sparse), and the anti-theft display effect is improved (i.e., ensuring the integrity of the watermark content information).
[0068] Example 1: For example, the preset ratio interval into which the target ratio falls complies with the matrix layout template of X times Y, where X is the number of row layouts, Y is the number of column layouts, and X and Y are positive integers. The specific implementation method for calculating the number of row and column display of the watermark is as follows:
[0069] First, the number of rows displayed for the watermark is determined based on the division and rounding operation between the pixel width value of the target web page display size and the pixel width value of the watermark display size; secondly, the number of columns displayed for the watermark is determined based on the division and rounding operation between the pixel height value of the target web page display size and the pixel height value of the watermark display size.
[0070] In addition, before using the target ratio and the preset ratio interval to find the required target watermark layout, the embodiment of the present application also provides the following preferred implementation scheme to facilitate a quick preliminary judgment of the required target watermark layout template. For example, Example 2: If the target ratio is an integer, the target watermark layout template is directly determined to be a matrix layout of X times Y.
[0071] After initially determining that the target watermark layout template is an XY matrix template, the present application embodiment also provides the following preferred superposition implementation scheme, which is as follows:
[0072] A first preset threshold value may be set to measure whether the target ratio is too small. If the target ratio is obtained based on the pixel width of the display size, then the target ratio is actually the number of watermark rows displayed under the premise of this watermark layout template. By comparing the target ratio with the first preset threshold value, if it is less than the first preset threshold value, it can be further determined that the number of rows displayed is too small, and then the reverse thinking should be considered: whether the current watermark display size is relatively large compared to the target web page size. In such a case, the embodiment of the present application adopts the following example 3 for improvement.
[0073] Example 3: Determine whether the target ratio is less than a first preset threshold; if so, reduce the second display size corresponding to the watermark to increase the number of rows and columns displayed for the watermark.
[0074] And, as a parallel preferred superposition implementation scheme, a second preset threshold (larger than the first preset threshold) can also be set to measure whether the target ratio is too large. If the target ratio is obtained based on the pixel width of the display size, then the target ratio is actually the number of watermark row displays obtained under the premise of this watermark layout template. If the target ratio is greater than the second preset threshold, it means that the determined number of watermark row displays is a bit too much, then the reverse thinking should be considered: whether the current watermark display size is relatively small compared to the target web page size. In such a case, the embodiment of the present application adopts the following example 4 for improvement.
[0075] Example 4: Improvements to the XY matrix layout to obtain different watermark layout templates for odd and even rows.
[0076] First, if it is determined that the target ratio is greater than the second preset threshold, and the second preset threshold is greater than the first preset threshold; then the number of rows displayed is determined as the first number of rows displayed, and the number of rows displayed is subtracted by one to obtain the second number of rows displayed.
[0077] Secondly, according to the number of displays in the first row and the number of displays in the second row, the matrix layout of X multiplied by Y is modified to obtain a new layout with different numbers of watermarks in odd rows and even rows; according to the new layout, the number of rows and columns corresponding to the watermarks in the target web page is re-determined.
[0078] 206. Determine the number of rows and columns corresponding to the watermark in the target webpage according to the target watermark layout template, the first display size, and the second display size.
[0079] In the embodiment of the present application, not only the size of the target web page and the display size of a watermark can be considered, but also a target watermark layout template can be further added as a constraint condition for the watermark adaptive layout, so as to obtain a watermark layout with moderate spacing and diversity on the target web page.
[0080] 207. Draw a picture containing multiple watermarks according to the number of rows and columns of the watermarks and the second display size of the watermarks.
[0081] 208. The image is displayed as a background image of the target webpage in a tiled manner, so as to display multiple watermarks in an adaptive layout in the target webpage.
[0082] As shown in steps 207-208, after determining the number of rows and columns of watermarks that can be adaptively arranged on the target web page, the embodiment of the present application constructs these watermarks into a canvas, and then uses Cascading Style Sheets (Css) to insert such a canvas as a background tile into the target web page to achieve the effect of adaptive display of watermarks.
[0083] Furthermore, as a response to the above Figure 1 , Figure 2 The embodiment of the present application provides a device for controlling watermark display. The device embodiment corresponds to the aforementioned method embodiment. For ease of reading, the device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. The device is used to realize the adaptive layout display of watermarks in the target web page, specifically as follows Figure 3 As shown, the device comprises:
[0084] An acquisition unit 31 is used for acquiring a first display size of a browser window where the target webpage is located in response to an operation of opening the target webpage, wherein the browser window is tiled to cover the entire display screen;
[0085] A first determining unit 32, configured to determine content information of a watermark to be displayed and a second display size according to a preset watermark configuration rule;
[0086] A second determining unit 33, configured to determine the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size;
[0087] The layout unit 34 is used to adaptively layout and display the plurality of watermarks in the target web page according to the number of rows and the number of columns.
[0088] Further, such as Figure 4 As shown, the second determining unit 33 includes:
[0089] A first acquisition module 331 is used to acquire pixel width values of the first display size and the second display size respectively;
[0090] A calculation module 332, configured to calculate a target ratio of the first display size to the second display size in terms of pixel width according to the pixel width value;
[0091] A first determination module 333 is used to determine a target watermark layout template corresponding to the target ratio by searching for a preset mapping relationship between a preset ratio interval and a preset watermark layout template;
[0092] The second determination module 334 is used to determine the number of rows and columns corresponding to the watermark in the target webpage according to the target watermark layout template, the first display size and the second display size.
[0093] Further, such as Figure 4 As shown, before determining the target watermark layout template corresponding to the target ratio by searching for a preset mapping relationship between the preset ratio interval and the preset watermark layout template, the second determining unit 33 further includes:
[0094] A third determining module 335 is configured to determine, if the target ratio is an integer, that the target watermark layout template is a matrix layout of X times Y, where X is the number of row layouts, Y is the number of column layouts, and X and Y are positive integers;
[0095] A judging module 336 is used to judge whether the target ratio is less than a first preset threshold;
[0096] The increasing module 337 is configured to increase the number of rows and columns displayed for the watermark by reducing the second display size corresponding to the watermark if it is determined that the target ratio is less than the first preset threshold.
[0097] Further, such as Figure 4 As shown, if it is determined that the target ratio is greater than a second preset threshold, and the second preset threshold is greater than the first preset threshold, then after determining the number of rows and columns displayed for the watermark, the second determining unit 33 further includes:
[0098] A fourth determining module 338, configured to determine the row display number as the first row display number;
[0099] The fourth determining module 338 is further configured to subtract one from the number of displayed rows to obtain the second number of displayed rows;
[0100] A modification module 339 is used to modify the X multiplied by Y matrix layout according to the first row display number and the second row display number to obtain a new layout with different numbers of watermarks in odd rows and even rows;
[0101] The fourth determination module 338 is further configured to re-determine the number of rows and columns corresponding to the watermark in the target webpage according to the new arrangement layout.
[0102] Further, such as Figure 4 As shown, the third determination module 335 is further specifically used for:
[0103] Determine the number of rows of the watermark to be displayed based on a division and rounding operation between the pixel width value of the first display size and the pixel width value of the second display size;
[0104] The number of columns of the watermark to be displayed is determined based on a division and rounding operation between a pixel height value of the first display size and a pixel height value of the second display size.
[0105] Further, such as Figure 4 As shown, the first determining unit 32 includes:
[0106] The second acquisition module 321 is used to acquire watermark content options from the preset watermark configuration rules, and the watermark content options at least include account name, mobile phone number and email address;
[0107] A fifth determining module 322, configured to determine content information of the watermark to be displayed and a character length corresponding to the content information according to the watermark content option;
[0108] The fifth determining module 322 is further configured to obtain the pixel length of the watermark by multiplying the character length by a preset watermark font size value;
[0109] The fifth determining module 322 is further configured to determine the pixel size covered by the watermark according to the preset tilt angle and the pixel length of the watermark as the second display size corresponding to the watermark.
[0110] Further, such as Figure 4 As shown, the layout unit 34 includes:
[0111] A drawing module 341, used for drawing a picture including a plurality of watermarks according to the number of rows displayed, the number of columns displayed and the second display size of the watermark;
[0112] The display module 342 is used to display the image as a background image of the target webpage in a tiled manner, so as to display multiple watermarks in an adaptive layout in the target webpage.
[0113] In summary, the embodiment of the present application provides a method and device for controlling watermark display. For an opened target web page, under the premise that the browser window is maximized, the display size of the target web page is obtained, and the content information and display size of a watermark are determined according to the preset watermark configuration rules. Then, based on the target ratio between the two display sizes in pixel width, the preset mapping relationship between the preset ratio interval and the preset watermark layout template is searched to obtain the target watermark layout template that matches the target ratio, so as to adaptively layout the number of rows and columns of the watermark in the target web page according to the display size of the target watermark layout template, the target web page and a watermark, so as to cover the entire target web page with the watermark. The scheme provided by the embodiment of the present application can adapt to the change of screen size and the change of character length of the watermark display size, and realize the dynamic setting of the number of rows and columns of the watermark in the target web page, so as to realize the adaptive layout display of the watermark in the target web page, which can effectively avoid the situation that the watermark display is too dense or sparse, and fully achieve the anti-theft effect of the watermark.
[0114] The device for controlling watermark display includes a processor and a memory. The acquisition unit, the first determination unit, the second determination unit and the layout unit are all stored in the memory as program units. The processor executes the program units stored in the memory to implement corresponding functions.
[0115] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to adapt to the changes in screen size and the length of characters in the watermark display size, so as to dynamically set the number of rows and columns displayed in the target web page, thereby realizing the adaptive layout display of the watermark in the target web page, which can effectively avoid the situation where the watermark display is too dense or sparse, and fully achieve the anti-theft effect of the watermark.
[0116] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the method for controlling watermark display is implemented.
[0117] An embodiment of the present application provides a processor, which is used to run a program, wherein the method for controlling watermark display is executed when the program is run.
[0118] The present application embodiment provides an electronic device 4, such as Figure 5 As shown, the device includes at least one processor 41, and at least one memory 42 and a bus 43 connected to the processor 41; wherein the processor 41 and the memory 42 communicate with each other through the bus 43; the processor 41 is used to call the program instructions in the memory 42 to execute the above-mentioned method for controlling the watermark display.
[0119] The device in this article can be a server, PC, etc.
[0120] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the method steps of controlling watermark display.
[0121] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0122] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0123] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0124] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0125] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0127] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for controlling watermark display, It is characterized in that The method comprises: In response to an operation of opening a target webpage, obtaining a first display size of a browser window where the target webpage is located, wherein the browser window is tiled to cover the entire display screen; Determining content information and a second display size of the watermark to be displayed according to a preset watermark configuration rule; Determining the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size; According to the number of rows displayed and the number of columns displayed, a plurality of watermarks are displayed in an adaptive layout in the target web page.
2. The method according to claim 1, It is characterized in that The determining, according to the first display size and the second display size, the number of rows and columns corresponding to the watermark in the target webpage for display includes: Obtaining pixel width values of the first display size and the second display size respectively; Calculating a target ratio of the first display size to the second display size in terms of pixel width according to the pixel width value; Determining a target watermark layout template corresponding to the target ratio by searching for a preset mapping relationship between a preset ratio interval and a preset watermark layout template; The number of rows and columns corresponding to the watermark in the target webpage is determined according to the target watermark layout template, the first display size, and the second display size.
3. The method according to claim 2, It is characterized in that Before determining the target watermark layout template corresponding to the target ratio by searching for a preset mapping relationship between the preset ratio interval and the preset watermark layout template, the method further includes: If the target ratio is an integer, the target watermark layout template is determined to be a matrix layout of X times Y, where X is the number of row layouts, Y is the number of column layouts, and X and Y are positive integers; Determining whether the target ratio is less than a first preset threshold; If so, the second display size corresponding to the watermark is reduced to increase the number of rows and columns displayed for the watermark.
4. The method according to claim 3, It is characterized in that If it is determined that the target ratio is greater than a second preset threshold, and the second preset threshold is greater than the first preset threshold, then after determining the number of rows and columns displayed for the watermark, the method further includes: Determine the row display number as the first row display number; Subtract one from the number of rows displayed, and use the number of rows displayed as the second row; Modify the X-by-Y matrix layout according to the first row display number and the second row display number to obtain a new layout with different numbers of watermarks in odd rows and even rows; According to the new arrangement layout, the number of rows and columns corresponding to the watermark in the target webpage is re-determined.
5. The method according to claim 3, It is characterized in that If the target watermark layout template is a matrix layout of X times Y, then determining the number of rows and columns corresponding to the watermark in the target webpage includes: Determine the number of rows of the watermark to be displayed based on a division and rounding operation between the pixel width value of the first display size and the pixel width value of the second display size; The number of columns of the watermark to be displayed is determined based on a division and rounding operation between a pixel height value of the first display size and a pixel height value of the second display size.
6. The method according to any one of claims 1 to 5, It is characterized in that The step of determining the content information of the watermark to be displayed and the second display size according to the preset watermark configuration rule includes: Obtaining watermark content options from the preset watermark configuration rules, wherein the watermark content options at least include an account name, a mobile phone number, and an email address; Determining content information of the watermark to be displayed and the character length corresponding to the content information according to the watermark content option; The pixel length of the watermark is obtained by multiplying the character length by the preset watermark font size value; According to the preset tilt angle and the pixel length of the watermark, the pixel size corresponding to the watermark is determined as the second display size corresponding to the watermark.
7. The method according to any one of claims 1 to 5, It is characterized in that The method of displaying the plurality of watermarks in an adaptive layout in the target webpage according to the number of rows displayed and the number of columns displayed comprises: Draw a picture including a plurality of the watermarks according to the number of rows displayed, the number of columns displayed, and the second display size of the watermark; The image is used as a background image of the target webpage for tiled display, so as to obtain a plurality of watermarks displayed in an adaptive layout in the target webpage.
8. A device for controlling watermark display, It is characterized in that The device comprises: An acquisition unit, configured to acquire, in response to an operation of opening a target webpage, a first display size of a browser window where the target webpage is located, wherein the browser window is tiled to cover the entire display screen; A first determining unit, configured to determine content information of a watermark to be displayed and a second display size according to a preset watermark configuration rule; A second determining unit, configured to determine the number of rows and columns corresponding to the watermark in the target webpage according to the first display size and the second display size; A layout unit is used to adaptively layout and display the plurality of watermarks in the target web page according to the number of rows displayed and the number of columns displayed.
9. A storage medium, It is characterized in that The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method for controlling watermark display according to any one of claims 1 to 7.
10. An electronic device, It is characterized in that The device includes at least one processor, and at least one memory and a bus connected to the processor; Wherein, the processor and the memory communicate with each other through the bus; The processor is used to call the program instructions in the memory to execute the method for controlling watermark display according to any one of claims 1 to 7.
Citation Information
Patent Citations
Webpage watermark rendering method and device
CN111026986A
Webpage watermark adding method and device, electronic equipment and storage medium
CN113095995A
Watermark processing method and device, electronic equipment and storage medium
CN113919997A
Cited By
Data watermark embedding and tracing method based on zero-width character
CN121167682A
