WO2021190335A1 - 拼图的生成方法、设备及存储介质 - Google Patents
拼图的生成方法、设备及存储介质 Download PDFInfo
- Publication number
- WO2021190335A1 WO2021190335A1 PCT/CN2021/080759 CN2021080759W WO2021190335A1 WO 2021190335 A1 WO2021190335 A1 WO 2021190335A1 CN 2021080759 W CN2021080759 W CN 2021080759W WO 2021190335 A1 WO2021190335 A1 WO 2021190335A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- puzzle
- unit
- value
- picture
- width
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000008859 change Effects 0.000 claims description 11
- 230000004044 response Effects 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 238000001514 detection method Methods 0.000 abstract 1
- 238000004891 communication Methods 0.000 description 11
- 238000012545 processing Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000010422 painting Methods 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4038—Image mosaicing, e.g. composing plane images from plane sub-images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/32—Indexing scheme for image data processing or generation, in general involving image mosaicing
Definitions
- the present disclosure relates to the field of image processing technology, and in particular to a method, equipment and storage medium for generating puzzles.
- the present disclosure provides a method for generating a puzzle, including: acquiring at least two initial images used to form a puzzle; acquiring size information of a puzzle template according to the at least two initial images; acquiring layout according to the size information of the puzzle template Data and canvas data; according to the at least two initial images, the size information, the canvas data, and the layout data, a unit sub-picture is generated, and the unit sub-picture is adapted to each of the puzzle templates
- the first puzzle is obtained; when the first editing operation based on the frame of the first puzzle is detected, the second is determined according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template.
- the width value of the frame of a puzzle is determined according to the width value of the frame of the first puzzle to determine the first layout information of the unit sub-picture; adjusted according to the width value of the frame of the first puzzle and the first layout information
- the first jigsaw puzzle obtains the second jigsaw puzzle.
- the method further includes: after obtaining the first puzzle, acquiring second layout information of the unit sub-picture; according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template
- the value determines the width value of the frame of the first puzzle
- the first layout information of the unit sub-picture is determined according to the frame value of the first puzzle, including: according to the minimum side length of the unit sub-picture and the puzzle
- the canvas frame width value of the template determines the maximum frame width value of the first puzzle; the frame width value of the first puzzle is determined according to the maximum frame width value; the canvas layout size of the first puzzle is subtracted from all According to the width value of the frame of the first puzzle, the converted canvas size is obtained; the size information of the unit sub-picture is determined according to the converted canvas size and the second layout information; according to the width value of the frame of the first puzzle and the The size information of the unit sub-picture determines the first layout information.
- the first layout information of the unit submap includes: the minimum coordinate value of the unit submap on the X axis is MinX+border/2, and the minimum coordinate value of the unit submap on the Y axis is MinY+border/2, the width of the unit submap is Width-border, and the height of the unit submap is Height-border, where MinX is the minimum coordinate value of the unit submap on the X axis, and MinY is The smallest coordinate value of the unit sub-image on the Y axis, Width is the width of the unit sub-image, Height is the height of the unit sub-image, and border is the width value of the border of the first puzzle.
- the maximum border width value of the first puzzle is determined according to the minimum side length of the unit sub-picture and the canvas border width value of the puzzle template, including, when the minimum side length is the height of the unit sub-picture Calculate the maximum border width value according to the following formula (1);
- maxBoder (pHeight*canvasFrame.height–MinHeight)/(1+pHeight) (1);
- maxBorder (pWidth*canvasFrame.width-MinWidth)/(1+pWidth) (2)
- maxBoder is the maximum frame width value
- pHeight is the ratio of the height of the smallest unit sub-image in the first puzzle to the height of the canvas
- canvasFrame.height is the height of the canvas
- pWidth is the smallest size in the first puzzle
- MinHeight is the rated minimum height value
- MinWidth is the rated minimum width value.
- the method further includes: when a second editing operation based on the rounding of the unit sub-picture is detected, determining a target rounding value corresponding to the second editing operation; and according to the unit sub-picture The minimum side length determines the maximum rounding value of the unit subgraph; when the target rounding value is not greater than the maximum rounding value, the second editing operation is performed for the unit subgraph, if the When the maximum rounding value is greater than the maximum rounding value, the second editing operation is not responded.
- the method further includes: after performing the second editing operation for the unit subgraph, re-determining the rated minimum side length of the unit subgraph according to the target fillet value; Recalculate the maximum frame width value of the second puzzle with the minimum side length; reset the second puzzle when the calculated maximum frame width of the second puzzle is less than the actual frame width of the second puzzle Layout information of all the unit sub-maps in.
- the method further includes: the first layout information and the second layout information include position information of each unit sub-picture, wherein the unit sub-picture includes an upper side, a lower side, a first side, and On the second side, the position information includes the index of the unit subgraph that is on the same line as the upper edge of the unit subgraph, the index of the unit subgraph that is on the same line as the lower edge of the unit subgraph, and The index of the unit subgraph whose first side is on the same straight line of the unit subgraph, and the index of the unit subgraph which is on the same straight line with the second side of the unit subgraph.
- the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the following when the program is executed:
- a unit sub-picture is generated, and the unit sub-picture is adapted to each unit of the puzzle template to obtain the first A puzzle
- the width value of the frame of the first puzzle is determined according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template, Determining the first layout information of the unit sub-picture according to the width value of the frame of the first puzzle;
- the first puzzle is adjusted according to the width value of the frame of the first puzzle and the first layout information to obtain the second puzzle.
- the width value of the frame of the first puzzle is determined according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template, and the first of the unit sub-picture is determined according to the frame value of the first puzzle.
- Layout information including:
- the first layout information is determined according to the width value of the frame of the first puzzle and the size information of the unit sub-picture.
- the first layout information of the unit sub-picture includes:
- the minimum coordinate value of the unit subgraph on the X axis is MinX+border/2
- the minimum coordinate value of the unit subgraph on the Y axis is MinY+border/2
- the width of the unit subgraph is Width-border
- the height of the unit subgraph is Height-border
- MinX is the minimum coordinate value of the unit subgraph on the X axis
- MinY is the minimum coordinate value of the unit subgraph on the Y axis
- Width is the minimum coordinate value of the unit subgraph on the Y axis.
- the width of the unit sub-picture, Height the height of the unit sub-picture, and the border is the width value of the border of the first puzzle.
- the maximum border width value of the first puzzle is determined according to the minimum side length of the unit sub-picture and the canvas border width value of the puzzle template, including, when the minimum side length is the height of the unit sub-picture Calculate the maximum border width value according to the following formula (1);
- maxBoder (pHeight*canvasFrame.height–MinHeight)/(1+pHeight) (1);
- maxBorder (pWidth*canvasFrame.width-MinWidth)/(1+pWidth) (2)
- maxBoder is the maximum frame width value
- pHeight is the ratio of the height of the smallest unit sub-image in the first puzzle to the height of the canvas
- canvasFrame.height is the height of the canvas
- pWidth is the smallest size in the first puzzle
- MinHeight is the rated minimum height value
- MinWidth is the rated minimum width value.
- the second editing operation is performed for the unit sub-picture, and if the maximum rounded corner value is greater than the maximum rounded corner value, no response will be taken. Describe the second editing operation.
- determining the maximum rounding value of the unit subgraph according to the minimum side length of the unit subgraph includes calculating the maximum rounding value according to the following formula:
- maxCorner MinSide/2, where maxCorner is the maximum fillet value, and MinSide is the minimum side length.
- the first layout information and the second layout information include position information of each unit sub-picture, where the unit sub-picture includes an upper side, a lower side, a first side, and a second side, and the position information includes ,
- the index of the unit subgraph that is on the same line as the upper edge of the unit subgraph, the index of the unit subgraph that is on the same line as the lower edge of the unit subgraph, and the first side edge of the unit subgraph The index of the unit subgraph that is on the same straight line, and the index of the unit subgraph that is on the same straight line as the second side of the unit subgraph.
- the first editing operation is an operation of dragging the frame of the first puzzle
- the second editing operation is an operation of dragging the rounded corners to change the size of the rounded corners
- the rounded corner value of the rounded corner of the unit sub-picture performs a setting operation to change the size of the rounded corner.
- the present disclosure also provides a non-transitory computer-readable storage medium that stores computer instructions for causing the computer to execute the generation method described above.
- Fig. 1 is a flowchart of a method for generating a puzzle according to some embodiments of the present disclosure
- FIG. 2 is a sequence diagram of a method for generating a puzzle according to some embodiments of the present disclosure
- FIG. 3 is a block diagram of an electronic device according to some embodiments of the disclosure.
- Fig. 1 is a flowchart of a method for generating a puzzle according to some embodiments of the present disclosure. As shown in Fig. 1, the method includes:
- Step 102 Obtain at least two initial images used to form a puzzle
- the above-mentioned at least two initial images may be a set of initial images input by the user to the puzzle software for performing puzzles, and the set of initial images may be provided to the puzzle software in the form of an image array, for example.
- Step 104 Obtain size information of the puzzle template according to the at least two initial images
- the size information of the puzzle template can be obtained from the database according to the size of the image array.
- the database may store template information corresponding to 2-8 images, for example, the template information may be an array.
- Step 106 Obtain layout data and canvas data according to the size information of the puzzle template
- the layout array (an example of the above-mentioned layout data) and the background frame (an example of the above-mentioned canvas data) can be obtained according to the size information of the puzzle template.
- Step 108 Generate a unit sub-picture according to the at least two initial images, the size information, the canvas data, and the layout data, and adapt the unit sub-picture to each unit of the puzzle template , Get the first puzzle;
- the layout array an example of the above at least two initial images
- the layout array an example of the above at least two initial images
- the background frame a new frame is generated through the comparison calculation, and the generated new frame is adapted to each cell in the puzzle template In, you get the first puzzle.
- Step 110 When the first editing operation based on the frame of the first puzzle is detected, determine the size of the frame of the first puzzle according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template. A width value, determining the first layout information of the unit sub-picture according to the width value of the border of the first puzzle;
- the user can drag the frame of the first puzzle to edit the frame.
- the first editing operation is, for example, dragging the frame of the first puzzle.
- the content of the puzzle template is displayed tiled with template ratio information. Therefore, when the user sets the frame, it is necessary to calculate the layout of all sub-unit diagrams in the current puzzle template and the frame value of the template.
- the minimum side length of the above unit subgraph is the minimum value among the side lengths of all the unit subgraphs in the first puzzle.
- the maximum border width value maxBorder that can be set for the first puzzle can be determined according to the minimum side length of the unit sub-picture and the width of the border of the puzzle template, and a value smaller than maxBorder can be taken as the border width value of the first puzzle, where, Determine the maximum border width value of the first puzzle according to the minimum side length of the unit sub-picture and the canvas border width value of the puzzle template, which may include, when the minimum side length is the height of the unit sub-picture, according to The following formula (1) calculates the maximum border width value;
- maxBoder (pHeight*canvasFrame.height–MinHeight)/(1+pHeight) (1);
- maxBorder (pWidth*canvasFrame.width-MinWidth)/(1+pWidth) (2)
- maxBoder is the maximum frame width value
- pHeight is the ratio of the height of the smallest unit sub-image in the first puzzle to the height of the canvas
- canvasFrame.height is the height of the canvas
- pWidth is the smallest size in the first puzzle
- MinHeight is the rated minimum height value
- MinWidth is the rated minimum width value.
- Step 112 Adjust the first puzzle according to the width value of the frame of the first puzzle and the first layout information to obtain a second puzzle.
- the width value of the frame can be modified according to the editing operation based on the first puzzle, and each unit in the puzzle can be dynamically adjusted according to the modified frame width value
- the layout information of the sub-pictures realizes the purpose of quickly constructing the puzzle and automatically adjusting the puzzle, which improves the efficiency of constructing the puzzle.
- the method for generating the above-mentioned puzzle may further include:
- the second layout information of the unit sub-picture is obtained; after the first puzzle is obtained, the second layout information of each unit sub-picture in the puzzle has been determined. After being edited, when re-determining the first layout information of each unit submap, the second layout information is needed. Therefore, after obtaining the first puzzle, the second layout information of each unit submap can be obtained. For example, a copy of Current layout information can be copied through the NSCopy protocol. Based on this, the width value of the frame of the first puzzle is determined according to the minimum side length of the unit sub-picture and the width of the frame of the puzzle template, and the unit sub-picture is determined according to the frame value of the first puzzle
- the first layout information of can include:
- the maximum frame width value of the first puzzle is determined according to the minimum side length of the unit sub-picture and the canvas frame width value of the puzzle template.
- the maximum frame width value can be calculated by the above formula (1).
- the width value of the border of the first puzzle is determined according to the maximum border width value; for example, the width value border of the border of the first puzzle is set within a range less than the maximum border width value.
- the sub-picture refers to that in the puzzle template, there is no interval between the unit sub-pictures, and the frame of each unit sub-pic
- the first layout information of the unit sub-picture is determined, for example, the first layout information of the unit sub-picture may include :
- the minimum coordinate value of the unit subgraph on the X axis is MinX+border/2
- the minimum coordinate value of the unit subgraph on the Y axis is MinY+border/2
- the width of the unit subgraph is Width-border
- the height of the unit subgraph is Height-border
- MinX is the minimum coordinate value of the unit subgraph on the X axis
- MinY is the minimum coordinate value of the unit subgraph on the Y axis
- Width is the minimum coordinate value of the unit subgraph on the Y axis.
- the width of the unit sub-picture, Height the height of the unit sub-picture, and the border is the width value of the border of the first puzzle.
- the configuration of the frame of the puzzle is completed, but because the frame configuration is carried out at the same time as the rounded corners, when the rounded corners exceed 1/2 of the minimum side length of the current unit sub-pictures, the problem of sharp rounded corners will be caused. .
- the rounded corner value can also be reconfigured. Based on this, the method for generating the above-mentioned puzzle may further include:
- determining the maximum rounding value of the unit subgraph according to the minimum side length of the unit subgraph may be calculating the maximum rounding value according to the following formula:
- maxCorner MinSide/2, where maxCorner is the maximum fillet value, and MinSide is the minimum side length.
- the second editing operation is performed for the unit sub-picture, and if the maximum rounded corner value is greater than the maximum rounded corner value, no response is made Describe the second editing operation.
- the minimum side length of the unit subgraph is taken into consideration, and the maximum rounded corner value and the maximum border width are determined based on the minimum side length Value, based on the maximum rounded value to limit the target rounded corner value, and based on the maximum border width value to determine the target width of the frame, so that the layout of all unit submaps can be corrected quickly and efficiently, and the frame and rounded corners are guaranteed Uniqueness and unity.
- the editing operation for the rounded corners can occur in any process of constructing the puzzle.
- the editing operation for the rounded corners is detected as an exemplary situation, but in the construction Any editing operation of rounded corners detected during the puzzle must meet the above conditions.
- the calculation of the rounded corners of the frame is only a logical judgment of a single operation when no rounded corners of the frame are operated after the first puzzle is obtained.
- the border value will be recalculated.
- the rated minimum side length of each unit subgraph is cornerValue (rounded corner value)*2.
- the width value of the border is determined based on the rounded corners, and when the original side width box value (refers to When the width of the border before the width of the border is not changed according to the rounded corner value) exceeds the calculated maximum border width, the layout of all sub-pictures in the puzzle is reset and determined.
- the method for generating the above-mentioned puzzle may further include: after performing the second editing operation for the unit sub-image, determining the value of the unit sub-image according to the target rounding value.
- autoresizeingMask is a relative layout setting. After enabling autoresizeingMask, the relative layout of the child view and the parent view can be automatically set.
- the method for generating the above-mentioned puzzle may further include: the first layout information and the second layout information include position information of each unit sub-picture, wherein the unit sub-picture includes the upper edge, the The position information includes the index of the unit subgraph that is on the same line as the upper edge of the unit subgraph, and the index of the unit subgraph that is on the same line as the lower edge of the unit subgraph.
- the index of the unit subgraph, the index of the unit subgraph that is on the same line as the first side of the unit subgraph, and the index of the unit subgraph that is on the same line as the second side of the unit subgraph .
- the original layout information of the template view model there are eight variables declared as NSSet. The eight variables are:
- topSet record the indices of all unit subgraphs whose minY of the current unit subgraph is maxY
- topSameSet record the indices of all unit subgraphs whose minY of the current unit subgraph is minY
- leftSet record the leftX of the current unit subgraph Is the index of all unit subgraphs of maxX
- leftSameSet records the indices of all unit subgraphs whose leftX of the current unit subgraph is minX
- bottomSet records the indices of all unit subgraphs whose maxY of the current unit subgraph is minY
- bottomSameSet record the indices of all unit subgraphs whose maxY of the current unit subgraph is maxY
- rightSet record the indices of all unit subgraphs whose maxX of the current unit subgraph is minX
- rightSameSet record the maxX of the current unit subgraph It is the index of all unit subgraphs of maxX.
- minY represents the minimum value of the current unit subgraph on the Y axis
- maxY represents the maximum value of the current unit subgraph on the Y axis
- maxX represents the maximum value of the current unit subgraph on the X axis
- leftX represents the current unit subgraph The minimum value on the X axis.
- each unit subgraph can support the logic of dragging and exchanging the unit subgraph, after the exchange is completed, the previous animation is deleted, and the current and original positions are exchanged. In this way, the sub-picture of the unit is shifted.
- Some embodiments of the present disclosure provide a method for generating puzzles based on the MVVM architecture.
- the MVVM architecture is divided into a Model (model) layer, a ViewModel (view model) layer, a View (view) layer, and a Controller (control) layer.
- Model layer involves the layout ratio, page logic, and the preservation of the border Model.
- Controller layer Used to bind the ViewModel and the View, connect the communication between the Controller and the Controller, and the external association between the View and the View.
- View layer template view, gesture view, and all interfaces involved in each sub-module function.
- View-Model layer template singleton ViewModel (view model), scale Model, background Model, layout Model, border ViewModel.
- the control layer may include TemplateVC (template control) and BorderVC (border control
- the view layer may include TemplateView (template view) and GestureView.
- the model layer can include: ViewModel (view model) and BorderViewModel (border view model), this method can be implemented by calling a custom class BIPOperationPublicManager (hereinafter referred to as Manager), where the input of Manager is multiple images ,
- Manager custom class BIPOperationPublicManager
- the input of Manager is multiple images
- the output is a puzzle based on the multiple image components, as shown in Figure 2, the method includes:
- Step 1 Call the Manager and pass in an image array NSArray whose content is UIImage;
- Step 2 Manager passes the image array NSArray to TemplateVC
- Step 3 TemplateVC obtains the proportion information of the template from the database according to the size of the image array (an example of the size information of the above puzzle template), initializes the proportion information and the image array, and sends it to TemplateView;
- Step 4 TemplateView sends the image array, layout array, and canvas array (an example of the above-mentioned painting data) to the ViewModel that uniformly manages all template operations;
- Step 5 ViewModel initializes the image array, layout array, and canvas array and sends it to GestureView; among them, the ViewModel layer mainly contains the original layout information, and the ViewModel layer compares the image array, layout array, and canvas array based on the above ratio information. Generate a new frame to fit each unit submap, and save it as the original canvas layout array;
- Step 6 Copy a copy of Current layout information (an example of the above-mentioned second layout information) to ViewModel through the NSCopy protocol;
- the reserved statement is the BIPTemplateBorderModel border model, which involves the rounded corner value, border value (that is, the border value of the above border) and gradient value, while retaining the template ratio interface, the maximum border value, and the minimum border Value and background image.
- Step 7 ViewModel sends the current layout information to TemplateView
- Step 8 TemplateVC binds the ViewModel to the TemplateView, displays the interface, passes the data into the TemplateView, and provides an interface for configuring borders, rounded corners, and gradients;
- Step 9 Re-match the canvasFrame (canvas information) of the TemplateView every time the view inside the TemplateView appears, recalculate the content in the GestureView through the Current layout information in the ViewModel, and bind all the GestureViews to the TemplateView to obtain the above first puzzle.
- Step 10 The border-based editing operation is detected, the editing command is obtained, and the editing command is sent to BorderVC;
- Step 11 BorderVC sends a message to modify the canvas layout to the ViewModel
- Step 12 ViewModel sends a reset message to TemplateView
- Step 13 TemplateView performs re-layout calculation: compare the difference between the actual height value of the smallest size GestureView and the rated minimum side, the difference may be greater than 0 and less than 100, and the maximum border width value maxBorder is calculated. After calculation, when the minimum value in gestureView.frame (the side length of the unit subgraph) is height (height), there is the following formula:
- maxBoder (layoutModel.pHeight*canvasFrame.height–MinHeight)/(1+layoutModel.pHeight);
- pHeight is the ratio of the height of the current smallest unit sub-image in canvasFrame.height (canvas height), and its value is less than 1.
- maxBorder (layoutModel.pWidth*canvasFrame.width-MinWidth)/(1+layoutModel.pWidth);
- pWidth is the ratio of the width of the current smallest unit sub-image to the width of the canvas, and its value is also less than 1.
- Step 14 In the range less than the maxBorder value, set the border width and border value. First, subtract the border value from the canvasFrame (canvas frame) saved in the ViewModel, and re-output. The new value of canvasFrame is not saved, just as convertFrame (converted frame). ) To facilitate re-layout
- Step 15 Traverse the current layout array, take out the layoutModel of gestureView, and output the assumed borderless gesuterFrame according to the proportion of the above recalculated convertFrame;
- Step 16 Put the border width box value in gestureFrame and re-modify it as follows:
- gestureView.frame CGRectMake(MinX(gestureFrame)+border/2, MinY(gestureFrame)+border/2, Width(gesutreFrame)-border, Height(gestureFrame)-border).
- Step 17 Modify the border value to boder.
- Step 19 Save maxCorner to ViewModel. When the rounded corner value exceeds maxCorner, no operation is performed.
- Step 20 BorderVC detects the operation of modifying the rounded corner value, and sends a message to modify the rounded corner value to BorderViewModel;
- Step 21 BorderViewModel sets the rounded corner value and calculates the maximum border value.
- the border width value When entering the borderVC and operating the rounded corners, the border width value will be recalculated. At this time, the minimum rated size of the gestureView is cornerValue*2, and the calculated maximum border width value is also changed. The maximum border width value is determined based on the rounded corners. When the original border value exceeds the maximum border width value, all layouts of the puzzle are reset.
- the exported UIImage picture is rotated and saved with cgImageCopy (redrawn picture), causing the picture
- cgImageCopy redrawn picture
- Some embodiments of the present disclosure also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
- the processor executes the program, it implements any of the above-mentioned puzzles.
- the method of generation is also provided.
- Some embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to cause the computer to execute any of the above-mentioned puzzles. Generation method.
- the methods in some embodiments of the present disclosure may be executed by a single device, such as a computer or a server.
- the method in this embodiment can also be applied in a distributed scenario, and multiple devices cooperate with each other to complete.
- one of the multiple devices can only perform one or more steps in the methods of some embodiments of the present disclosure, and the multiple devices will interact with each other to complete The method described.
- the apparatus of the foregoing embodiment is used to implement the corresponding method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
- FIG. 3 shows a more specific schematic diagram of the hardware structure of an electronic device provided by this embodiment.
- the device may include a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050.
- the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040 realize the communication connection between each other in the device through the bus 1050.
- the processor 1010 may be implemented by a general CPU (Central Processing Unit, central processing unit), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., for execution related Programs to implement the technical solutions provided by the embodiments of the present disclosure.
- CPU Central Processing Unit
- ASIC Application Specific Integrated Circuit
- the memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc.
- the memory 1020 may store an operating system and other application programs.
- related program codes are stored in the memory 1020 and called and executed by the processor 1010.
- the input/output interface 1030 is used to connect an input/output module to realize information input and output.
- the input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions.
- the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and an output device may include a display, a speaker, a vibrator, an indicator light, and the like.
- the communication interface 1040 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices.
- the communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
- the bus 1050 includes a path to transmit information between various components of the device (for example, the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040).
- the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include the equipment necessary for normal operation. Other components.
- the above-mentioned device may also include only the components necessary to implement the solutions of some embodiments of the present disclosure, and not necessarily include all the components shown in the figures.
- the computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
- the 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, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
- PRAM phase change memory
- SRAM static random access memory
- DRAM dynamic random access memory
- RAM random access memory
- ROM read-only memory
- EEPROM electrically erasable programmable read-only memory
- flash memory or other memory technology
- the figures provided may or may not show the well-known power supply associated with integrated circuit (IC) chips and other components. / Ground connection.
- the devices may be shown in the form of block diagrams in order to avoid making some embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details about the implementation of these block diagram devices are highly dependent on the implementation of some embodiments of the present disclosure. Examples of the platform (that is, these details should be fully within the understanding of those skilled in the art).
- DRAM dynamic RAM
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
Description
Claims (19)
- 一种拼图的生成方法,包括:获取用于构成拼图的至少两个初始图像;根据所述至少两个初始图像获取拼图模板的尺寸信息;根据所述拼图模板的尺寸信息获取布局数据以及画布数据;根据所述至少两个初始图像、所述尺寸信息、所述画布数据以及所布局数据,生成单元子图,并将所述单元子图适配至所述拼图模板的每个单元中,得到第一拼图;在检测到基于所述第一拼图的边框的第一编辑操作时,根据所述单元子图的最小边长以及所述拼图模板的边框的宽度值确定所述第一拼图的边框的宽度值,根据所述第一拼图的边框的宽度值确定所述单元子图的第一布局信息;根据所述第一拼图的边框的宽度值以及所述第一布局信息调整所述第一拼图,得到第二拼图。
- 根据权利要求1所述的方法,还包括:在得到所述第一拼图之后,获取所述单元子图的第二布局信息;根据所述单元子图的最小边长以及所述拼图模板的边框的宽度值确定所述第一拼图的边框的宽度值,根据所述第一拼图的边框值确定所述单元子图的第一布局信息,包括:根据所述单元子图的最小边长以及所述拼图模板的画布边框宽度值确定所述第一拼图的最大边框宽度值;根据所述最大边框宽度值确定所述第一拼图的边框的宽度值;将所述第一拼图的画布布局尺寸减去所述第一拼图的边框的宽度值,得到转换画布尺寸;根据转换画布尺寸以及所述第二布局信息确定所述单元子图的尺寸信息;根据所述第一拼图的边框的宽度值以及所述单元子图的尺寸信息,确定所述第一布局信息。
- 根据权利要求2所述的方法,其中,所述单元子图的第一布局信息, 包括:所述单元子图在X轴的最小坐标值为MinX+border/2,所述单元子图的在Y轴的最小坐标值为MinY+border/2,所述单元子图的宽度为Width-border,所述单元子图的高度为Height-border,其中,MinX为所述单元子图在X轴上的最小坐标值,MinY为所述单元子图在Y轴上的最小坐标值,Width为所述单元子图的宽度,Height所述单元子图的高度,border为所述第一拼图的边框的宽度值。
- 根据权利要求2所述的方法,其中,根据所述单元子图的最小边长以及所述拼图模板的画布边框宽度值确定所述第一拼图的最大边框宽度值,包括,当所述最小边长为单元子图的高时,根据如下公式(1)计算所述最大边框宽度值;maxBoder=(pHeight*canvasFrame.height–MinHeight)/(1+pHeight)(1);当所述最小边长为单元子图的宽时,根据如下公式(2)计算所述最大边框宽度值;maxBorder=(pWidth*canvasFrame.width-MinWidth)/(1+pWidth)(2)其中,maxBoder为所述最大边框宽度值,pHeight为所述第一拼图中尺寸最小的单元子图的高度占画布高度的比例,canvasFrame.height为画布高度,pWidth为所述第一拼图中尺寸最小的单元子图的宽度,MinHeight为额定最小高度值,MinWidth为额定最小宽度值。
- 根据权利要求1所述的方法,还包括:在检测到基于所述单元子图的圆角的第二编辑操作时,确定与所述第二编辑操作对应的目标圆角值;根据所述单元子图的最小边长确定所述单元子图的最大圆角值;当所述目标圆角值不大于所述最大圆角值时,为所述单元子图执行所述第二编辑操作,若所述最大圆角值大于所述最大圆角值时,不响应所述第二编辑操作。
- 根据权利要求5所述的方法,其中,根据所述单元子图的最小边长确定所述单元子图的最大圆角值,包括根据如下公式计算所述最大圆角值:maxCorner=MinSide/2,其中,maxCorner为所述最大圆角值,MinSide 为所述最小边长。
- 根据权利要求5所述的方法,还包括:在为所述单元子图执行所述第二编辑操作之后,根据所述目标圆角值重新确定所述单元子图的额定最小边长;根据所述额定最小边长重新计算所述第二拼图的最大边框宽度值;当计算得到的所述第二拼图的最大边框宽度值小于所述第二拼图的实际边框宽度值时,重置所述第二拼图中的所有单元子图的布局信息。
- 根据权利要求2至7任一项所述的方法,还包括:所述第一布局信息以及所述第二布局信息中包括各单元子图的位置信息,其中,所述单元子图包括上边、下边、第一侧边以及第二侧边,所述位置信息包括,与所述单元子图的上边处于同一直线上的单元子图的索引,与所述单元子图的下边处于同一直线上的单元子图的索引,与所述单元子图的第一侧边处于同一直线上的单元子图的索引,以及与所述单元子图的第二侧边处于同一直线上的单元子图的索引。
- 根据权利要求5所述的方法,其中,所述第一编辑操作为拖拽所述第一拼图的边框的操作,所述第二编辑操作为对所述圆角的拖拽操作以改变所述圆角的大小,或对所述单元子图的圆角的圆角值进行设置的操作以改变所述圆角的大小。
- 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现:获取用于构成拼图的至少两个初始图像;根据所述至少两个初始图像获取拼图模板的尺寸信息;根据所述拼图模板的尺寸信息获取布局数据以及画布数据;根据所述至少两个初始图像、所述尺寸信息、所述画布数据以及所布局数据,生成单元子图,并将所述单元子图适配至所述拼图模板的每个单元中,得到第一拼图;在检测到基于所述第一拼图的边框的第一编辑操作时,根据所述单元子图的最小边长以及所述拼图模板的边框的宽度值确定所述第一拼图的边框的宽度值,根据所述第一拼图的边框的宽度值确定所述单元子图的第一布局信 息;根据所述第一拼图的边框的宽度值以及所述第一布局信息调整所述第一拼图,得到第二拼图。
- 根据权利要求10所述的电子设备,其中,所述处理器执行所述程序时实现:在得到所述第一拼图之后,获取所述单元子图的第二布局信息;根据所述单元子图的最小边长以及所述拼图模板的边框的宽度值确定所述第一拼图的边框的宽度值,根据所述第一拼图的边框值确定所述单元子图的第一布局信息,包括:根据所述单元子图的最小边长以及所述拼图模板的画布边框宽度值确定所述第一拼图的最大边框宽度值;根据所述最大边框宽度值确定所述第一拼图的边框的宽度值;将所述第一拼图的画布布局尺寸减去所述第一拼图的边框的宽度值,得到转换画布尺寸;根据转换画布尺寸以及所述第二布局信息确定所述单元子图的尺寸信息;根据所述第一拼图的边框的宽度值以及所述单元子图的尺寸信息,确定所述第一布局信息。
- 根据权利要求11所述的电子设备,其中,所述单元子图的第一布局信息,包括:所述单元子图在X轴的最小坐标值为MinX+border/2,所述单元子图的在Y轴的最小坐标值为MinY+border/2,所述单元子图的宽度为Width-border,所述单元子图的高度为Height-border,其中,MinX为所述单元子图在X轴上的最小坐标值,MinY为所述单元子图在Y轴上的最小坐标值,Width为所述单元子图的宽度,Height所述单元子图的高度,border为所述第一拼图的边框的宽度值。
- 根据权利要求11所述的电子设备,其中,根据所述单元子图的最小边长以及所述拼图模板的画布边框宽度值确定所述第一拼图的最大边框宽度值,包括,当所述最小边长为单元子图的高时,根据如下公式(1)计算所述最大边框宽度值;maxBoder=(pHeight*canvasFrame.height–MinHeight)/(1+pHeight)(1);当所述最小边长为单元子图的宽时,根据如下公式(2)计算所述最大边框宽度值;maxBorder=(pWidth*canvasFrame.width-MinWidth)/(1+pWidth)(2)其中,maxBoder为所述最大边框宽度值,pHeight为所述第一拼图中尺寸最小的单元子图的高度占画布高度的比例,canvasFrame.height为画布高度,pWidth为所述第一拼图中尺寸最小的单元子图的宽度,MinHeight为额定最小高度值,MinWidth为额定最小宽度值。
- 根据权利要求10所述的电子设备,其中,所述处理器执行所述程序时实现:在检测到基于所述单元子图的圆角的第二编辑操作时,确定与所述第二编辑操作对应的目标圆角值;根据所述单元子图的最小边长确定所述单元子图的最大圆角值;当所述目标圆角值不大于所述最大圆角值时,为所述单元子图执行所述第二编辑操作,若所述最大圆角值大于所述最大圆角值时,不响应所述第二编辑操作。
- 根据权利要求14所述的电子设备,其中,根据所述单元子图的最小边长确定所述单元子图的最大圆角值,包括根据如下公式计算所述最大圆角值:maxCorner=MinSide/2,其中,maxCorner为所述最大圆角值,MinSide为所述最小边长。
- 根据权利要求14所述的电子设备,其中,所述处理器执行所述程序时实现:在为所述单元子图执行所述第二编辑操作之后,根据所述目标圆角值重新确定所述单元子图的额定最小边长;根据所述额定最小边长重新计算所述第二拼图的最大边框宽度值;当计算得到的所述第二拼图的最大边框宽度值小于所述第二拼图的实际边框宽度值时,重置所述第二拼图中的所有单元子图的布局信息。
- 根据权利要求11至16任一项所述的电子设备,其中,所述处理器 执行所述程序时实现:所述第一布局信息以及所述第二布局信息中包括各单元子图的位置信息,其中,所述单元子图包括上边、下边、第一侧边以及第二侧边,所述位置信息包括,与所述单元子图的上边处于同一直线上的单元子图的索引,与所述单元子图的下边处于同一直线上的单元子图的索引,与所述单元子图的第一侧边处于同一直线上的单元子图的索引,以及与所述单元子图的第二侧边处于同一直线上的单元子图的索引。
- 根据权利要求14所述的电子设备,其中,所述第一编辑操作为拖拽所述第一拼图的边框的操作,所述第二编辑操作为对所述圆角的拖拽操作以改变所述圆角的大小,或对所述单元子图的圆角的圆角值进行设置的操作以改变所述圆角的大小。
- 一种非暂态计算机可读存储介质,其中,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1至9任一项所述的拼图的生成方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010225897.3 | 2020-03-26 | ||
CN202010225897.3A CN113450251A (zh) | 2020-03-26 | 2020-03-26 | 拼图的生成方法、设备及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021190335A1 true WO2021190335A1 (zh) | 2021-09-30 |
Family
ID=77807397
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/080759 WO2021190335A1 (zh) | 2020-03-26 | 2021-03-15 | 拼图的生成方法、设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113450251A (zh) |
WO (1) | WO2021190335A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105046678A (zh) * | 2012-11-12 | 2015-11-11 | 北京奇虎科技有限公司 | 一种实现图片拼接的装置、方法和图片处理系统 |
CN105867951A (zh) * | 2016-06-20 | 2016-08-17 | 中国建设银行股份有限公司 | 数据处理方法、装置及屏幕设计器 |
CN106296622A (zh) * | 2015-05-27 | 2017-01-04 | 阿里巴巴集团控股有限公司 | 一种自动布局的拼图方法及装置 |
CN106886418A (zh) * | 2017-03-27 | 2017-06-23 | 湛江市霞山区新软佳科技有限公司 | Html界面控件贴 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108897826B (zh) * | 2018-06-22 | 2021-09-14 | 上海哔哩哔哩科技有限公司 | 横幅图片快速生成方法、系统及存储介质 |
-
2020
- 2020-03-26 CN CN202010225897.3A patent/CN113450251A/zh active Pending
-
2021
- 2021-03-15 WO PCT/CN2021/080759 patent/WO2021190335A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105046678A (zh) * | 2012-11-12 | 2015-11-11 | 北京奇虎科技有限公司 | 一种实现图片拼接的装置、方法和图片处理系统 |
CN106296622A (zh) * | 2015-05-27 | 2017-01-04 | 阿里巴巴集团控股有限公司 | 一种自动布局的拼图方法及装置 |
CN105867951A (zh) * | 2016-06-20 | 2016-08-17 | 中国建设银行股份有限公司 | 数据处理方法、装置及屏幕设计器 |
CN106886418A (zh) * | 2017-03-27 | 2017-06-23 | 湛江市霞山区新软佳科技有限公司 | Html界面控件贴 |
Also Published As
Publication number | Publication date |
---|---|
CN113450251A (zh) | 2021-09-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10761721B2 (en) | Systems and methods for interactive image caricaturing by an electronic device | |
WO2014059886A1 (zh) | 获取图像的方法和装置 | |
JP6401855B2 (ja) | Uiコントロールの背景を設定するための方法及び装置、並びに端末 | |
TW201426493A (zh) | 自繪控制項的螢幕適配方法及裝置 | |
WO2014117559A1 (en) | 3d-rendering method and device for logical window | |
JP2020533710A (ja) | 画像ステッチング方法および装置、記憶媒体 | |
KR102646977B1 (ko) | 증강 현실에 기반한 디스플레이 방법 및 장치, 및 저장 매체 | |
WO2017088605A1 (zh) | 图片编辑中的图片显示控制方法及装置 | |
CN111445566B (zh) | 一种信息处理方法、装置及计算机可读存储介质 | |
WO2018010440A1 (zh) | 一种投影画面调整方法、装置和投影终端 | |
US20140325404A1 (en) | Generating Screen Data | |
CN113538623A (zh) | 确定目标图像的方法、装置、电子设备及存储介质 | |
WO2021190335A1 (zh) | 拼图的生成方法、设备及存储介质 | |
WO2023103684A1 (zh) | 人像头发流动特效处理方法、装置、介质和电子设备 | |
CN106354381B (zh) | 图像文件的处理方法及装置 | |
JP6287498B2 (ja) | 電子ホワイトボード装置、電子ホワイトボードの入力支援方法、及びプログラム | |
CN111563956A (zh) | 一种二维图片的三维显示方法、装置、设备及介质 | |
WO2023077650A1 (zh) | 三色图生成方法及相关设备 | |
CN114185472B (zh) | 一种幻灯片放映方法、装置、电子设备及存储介质 | |
WO2023134537A1 (zh) | 分屏特效道具生成方法、装置、设备和介质 | |
CN114201251A (zh) | 降低书写痕迹显示延时的方法、装置、设备及介质 | |
CN114159782A (zh) | 游戏模型摆放位置的确定方法、装置、终端和存储介质 | |
CN114972701A (zh) | 后处理区域的确定方法、装置、计算机设备及存储介质 | |
CN115222867A (zh) | 重叠检测方法、装置、电子设备和存储介质 | |
CN115501589A (zh) | 模型渲染方法、装置、电子设备和存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21777175 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21777175 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 15.05.2023) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21777175 Country of ref document: EP Kind code of ref document: A1 |