CN117036174A - Scaling control method, scaling control device, computer apparatus, storage medium, and program product - Google Patents

Scaling control method, scaling control device, computer apparatus, storage medium, and program product Download PDF

Info

Publication number
CN117036174A
CN117036174A CN202311101224.7A CN202311101224A CN117036174A CN 117036174 A CN117036174 A CN 117036174A CN 202311101224 A CN202311101224 A CN 202311101224A CN 117036174 A CN117036174 A CN 117036174A
Authority
CN
China
Prior art keywords
scaling
target
rectangle
coordinate point
scaled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311101224.7A
Other languages
Chinese (zh)
Inventor
刘楠楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhouming Technology Co Ltd
Original Assignee
Shenzhen Zhouming Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhouming Technology Co Ltd filed Critical Shenzhen Zhouming Technology Co Ltd
Priority to CN202311101224.7A priority Critical patent/CN117036174A/en
Publication of CN117036174A publication Critical patent/CN117036174A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present application relates to a zoom control method, apparatus, computer device, storage medium, and program product, including: determining an object to be scaled, and acquiring an original coordinate point of the object to be scaled; acquiring a target rectangle containing the object to be scaled based on a preset function; determining a scaling parameter of the object to be scaled according to the scaling action of the target rectangle and the rectangle parameter of the target rectangle; performing preset scaling transformation on each original coordinate point based on the scaling parameters to obtain target coordinate points; and drawing a target object based on the target coordinate point. According to the method, the scaling parameters of each coordinate point of the object to be scaled are obtained through calculation through scaling actions of the target rectangle, scaling transformation is carried out on each original coordinate point according to the scaling parameters, the target object with a new coordinate point is obtained, scaling effects of the object to be scaled are guaranteed, and meanwhile operability of the target object is effectively improved.

Description

Scaling control method, scaling control device, computer apparatus, storage medium, and program product
Technical Field
The present application relates to the field of vector graphics editing technology, and in particular, to a scaling control method, apparatus, computer device, storage medium, and program product.
Background
In the process of making electronic whiteboards or drawing boards, it is often seen that certain lines or graphics are enlarged or reduced. For user experience, reducing the graphics can effectively save canvas space, while enlarging the graphics is beneficial to the user to obtain better viewing experience. For products, enlarging or reducing the brush object can better enrich the functions of the brush object, and has a certain expansion meaning.
When the existing scheme performs scaling processing in a scalable vector graphics (Scalable Vector Graphics, abbreviated as SVG) canvas, a scale method is applied to zoom in and zoom out on lines or graphics in the horizontal or vertical direction through a transform attribute. The existing scaling scheme lacks a transformation process of track coordinates, so that operations such as more transformation based on scaled SVG objects or erasure based on coordinate points cannot be performed, and operability is poor.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a scaling control method, apparatus, computer device, storage medium, and program product that can increase the operability of SVG objects.
In a first aspect, the present application provides a zoom control method, including:
determining an object to be scaled, and acquiring an original coordinate point of the object to be scaled;
acquiring a target rectangle containing the object to be scaled based on a preset function;
determining a scaling parameter of the object to be scaled according to the scaling action of the target rectangle and the rectangle parameter of the target rectangle;
performing preset scaling transformation on each original coordinate point based on the scaling parameters to obtain target coordinate points;
and drawing a target object based on the target coordinate point.
In one embodiment, the object to be zoomed is a zoomable vector graphic or a brush object, and determining the zoom parameter of the image to be zoomed according to the zoom action of the target rectangle and the rectangle parameter of the target rectangle includes:
acquiring a real-time coordinate point and an initial coordinate point of a cursor;
calculating a cursor displacement value and a cursor displacement direction based on the real-time coordinate point and the initial coordinate point;
determining a scaling direction and a scaling reference point of the scaling action according to the cursor displacement direction;
and calculating the scaling parameters of the image to be scaled in each scaling direction according to the rectangular parameters, the cursor displacement value, the scaling direction and the scaling reference point, wherein the scaling parameters comprise an X-axis scaling scale, a Y-axis scaling scale, an X-axis offset and a Y-axis offset.
In one embodiment, the rectangle parameters include a rectangle width and a rectangle height, and the scaling parameters are calculated in the following manner:
x-axis scaling= (rectangular width of the target rectangle+cursor displacement value in X-axis direction)/rectangular width of the target rectangle;
y-axis scaling= (rectangle height of the target rectangle+cursor displacement value in Y-axis direction)/rectangle height of the target rectangle;
x-axis offset = original coordinate point X value X-axis scale-original coordinate point X value;
y-axis offset = original coordinate point Y value x Y-axis scale-original coordinate point Y value.
In one embodiment, before the scaling parameters are used for performing preset scaling transformation on each original coordinate point to obtain the target coordinate point, the method further includes:
and carrying out preset scaling transformation on the target rectangle based on the scaling parameters, and redrawing the target rectangle.
In one embodiment, the performing the preset scaling transformation on the target rectangle based on the scaling parameter and redrawing the target rectangle further includes:
if the scaling ratio of the scaling parameter is positive, drawing the target rectangle according to the anticlockwise sequence;
and if the scaling ratio of the scaling parameter is negative, drawing the target rectangle according to the clockwise sequence.
In one embodiment, the method further comprises:
if the width of the target rectangle of the object to be scaled is 0, determining scaling parameters of the object to be scaled according to the preset width and the actual height;
if the height of the target rectangle of the object to be zoomed is 0, determining a zoom parameter of the object to be zoomed according to the actual width and the preset height;
and if the width and the height of the target rectangle of the object to be zoomed are both 0, determining the zoom parameter of the object to be zoomed according to the preset width and the preset height.
In a second aspect, the present application also provides a zoom control apparatus, including:
the object determining module is used for determining an object to be scaled and acquiring an original coordinate point of the object to be scaled;
the rectangle acquisition module is used for acquiring a target rectangle containing the object to be scaled based on a preset function;
the parameter determining module is used for determining the scaling parameter of the object to be scaled according to the scaling action of the target rectangle;
the coordinate transformation module is used for carrying out preset scaling transformation on each original coordinate point based on the scaling parameters to obtain a target coordinate point;
and the object drawing module is used for drawing the target object based on the target coordinate point.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the zoom control method of the first aspect when the processor executes the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the zoom control method of the first aspect.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of the zoom control method according to the first aspect.
In summary, embodiments of the present application provide a zoom control method, apparatus, computer device, storage medium, and program product, including: determining an object to be scaled, and acquiring an original coordinate point of the object to be scaled; acquiring a target rectangle containing the object to be scaled based on a preset function; determining a scaling parameter of the object to be scaled according to the scaling action of the target rectangle and the rectangle parameter of the target rectangle; performing preset scaling transformation on each original coordinate point based on the scaling parameters to obtain target coordinate points; and drawing a target object based on the target coordinate point. According to the method, the scaling parameters of each coordinate point of the object to be scaled are obtained through calculation through scaling actions of the target rectangle, scaling transformation is carried out on each original coordinate point according to the scaling parameters, the target object with a new coordinate point is obtained, scaling effects of the object to be scaled are guaranteed, and meanwhile operability of the target object is effectively improved.
Drawings
FIG. 1 is a flow chart of a zoom control method according to an embodiment;
FIG. 2 is a flowchart illustrating steps for determining scaling parameters in one embodiment;
FIG. 3 is a schematic diagram of an application scenario in which an object to be scaled is scaled according to an embodiment;
FIG. 4 is a block diagram of a zoom control device according to an embodiment;
fig. 5 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
When the drawing board is manufactured, the Canvas which is commonly used comprises Canvas and SVG Canvas, in order to enable the brush objects in the Canvas to have better operability, after the brush objects are required to be scaled and controlled, the brush objects are required to be kept clear, and the attributes of the brush objects are required to be changed according to the actual application requirements. The graphics drawn in Canvas are scalar figures, and after graphics are rendered, object attributes inside the graphics cannot be operated continuously. If the graphic structure in the Canvas needs to be changed, rendering can only be redrawn, and after scaling control is performed on lines or graphics in the Canvas, the images become distorted and blurred.
And the graph drawn in the SVG canvas is a vector graph, after the graph is generated, scaling control is carried out on the graph, the situation that the graph is distorted and blurred is avoided, and definition of the brush object can be effectively ensured by adopting the SVG canvas to manufacture the custom brush object.
The embodiment provides a scaling control method, which is different from the scaling control of the line or the graph in the horizontal or vertical direction by adopting the scale method in the prior art, and can improve the operability of the object to be scaled after scaling while guaranteeing the definition requirement of the scaling control.
In one embodiment, as shown in fig. 1, a zoom control method is provided, and the method is applied to an SVG canvas for illustration, and includes the following steps:
s101, determining an object to be scaled, and acquiring an original coordinate point of the object to be scaled.
In particular, the object to be scaled may be a brush object or an editable vector diagram in the SVG canvas.
Before executing the zoom control method of this embodiment, it is necessary to create an SVG canvas, and make the canvas coordinates correspond to the cursor coordinates one by one, so as to form a canvas coordinate system having an X axis and a Y axis. The cursor coordinates are real-time coordinates of the cursor in the screen, the cursor can also be called a cursor, and the movement of the cursor can be controlled by a mouse or by touch operation.
Specifically, the movement control of the cursor may be adaptively set according to the terminal device used in the actual application scenario, which is not limited herein.
After confirming the object to be scaled through cursor locking, all original coordinate points forming the object to be scaled are directly collected. For example, for a brush object, a select element, all of the original coordinate points on the select element are collected, making up an array, oiginPoint. Any original coordinate point on the selected element can be obtained by calling an array oiginPoint.
In a specific embodiment, when the original coordinate points are acquired, the recording may be performed according to a preset direction, for example, the original coordinate points of the brush object may be recorded in a counterclockwise direction from outside to inside.
S102, acquiring a target rectangle containing the object to be scaled based on a preset function.
Specifically, the edges of the target rectangle will contain the complete object to be scaled. The preset function is used to return a target rectangle that corresponds to the path tracing.
In the practical application process, the preset function can be adaptively adjusted, so that the target rectangle returned by the target function has preset width and height.
In some embodiments, the preset function may be a getbbox function that is used to return a minimum rectangle that fits the path tracing. For objects to be scaled having a width and a height, the target rectangle is the smallest rectangle that conforms to the path tracing.
In the practical application process, after the target rectangle is obtained, the rectangle parameters of the target rectangle can be obtained, wherein the rectangle parameters at least comprise height, width and coordinates of each vertex. The obtained target rectangle at least comprises Northwest (NW) vertexes, northeast (NE) vertexes, southeast (SE) vertexes and Southwest (SW) vertexes.
In a specific embodiment, the target rectangle is stretched by controlling the cursor, so that scaling control on the object to be scaled included in the target rectangle can be realized.
S103, determining the scaling parameters of the object to be scaled according to the scaling action of the target rectangle and the rectangle parameters of the target rectangle.
Specifically, the user can operate the cursor to lock any vertex in the target rectangle, and stretch the target rectangle in any direction to execute the zooming action on the target rectangle.
In the practical application process, the zoom actions in this embodiment at least include zoom actions in four directions, i.e. north-west zoom, north-east zoom, south-east zoom and south-west zoom.
Specifically, the scaling action of the target rectangle is consistent with the scaling action of the object to be scaled, and the scaling parameter of the object to be scaled is consistent with the scaling parameter of the target rectangle.
In the process of determining the scaling parameters of the object to be scaled, the scaling parameters in the corresponding scaling action direction are obtained based on the scaling transformation of the target rectangle to the rectangle parameters when the scaling action is performed, wherein the scaling parameters comprise an X-axis scaling scale, a Y-axis scaling scale, an X-axis offset and a Y-axis offset. After the scaling parameters of the target rectangle are calculated, the scaling parameters of the object to be scaled are determined.
It should be noted that, one scaling action may include scaling in only one direction, or scaling in multiple directions, and scaling parameters in different directions may be the same or different, and adaptive transformation is performed according to an actual application scenario, which is not limited herein.
And S104, performing preset scaling transformation on each original coordinate point based on the scaling parameters to obtain a target coordinate point.
Specifically, the preset scaling transformation in this embodiment may be matrix scaling transformation, specifically, transform: the matrix (scaleX, 0, scaleY, -offsetX, -offsetY) realizes the preset scaling transformation of each original coordinate point, and the target coordinate point of the scaled object to be scaled can be obtained.
In a specific embodiment, the calculation mode for performing matrix scaling transformation on the coordinate points in the SVG canvas is as follows:
transformation: matrix (a, b, c, d, e, f) corresponds to matrixMatrix scaling of the original coordinates (x, y) to obtain +.>At this time, the target coordinates are (ax+cy+e, bx+dy+f) = (scalex+ 0*y-offsetX,0 x+scale y-offsetY), where b=c=0.
In the actual application process, the matrix subjected to preset scaling transformation can be subjected to self-adaptive replacement according to the needs of the actual application scene, and the method is not limited herein.
S105, drawing a target object based on the target coordinate point.
Specifically, after target coordinate points corresponding to original coordinate points of the object to be scaled are obtained, the scaled target object can be drawn according to each target coordinate point.
In summary, the present embodiment provides a scaling control method, and based on the target object obtained by the scaling control method of the present embodiment, coordinate points of the target object can be further edited to change the structure of the target object. The brush object processed based on the zoom control method provided by the embodiment not only obtains the zoomed brush object which accords with the visual effect, but also obtains the coordinate point which can be edited. The method can perform more transformation based on a new target object or erase coordinate points to finish shape or structure change, so that operability of zoom control is greatly improved.
In one embodiment, as shown in fig. 2, S103 includes:
s201, acquiring a real-time coordinate point and an initial coordinate point of a cursor.
S202, calculating to obtain a cursor displacement value and a cursor displacement direction based on the real-time coordinate point and the initial coordinate point.
S203, determining a scaling direction and a scaling reference point of the scaling action according to the cursor displacement direction.
S204, calculating scaling parameters of the image to be scaled in each scaling direction according to the rectangular parameters, the cursor displacement value, the scaling direction and the scaling reference point, wherein the scaling parameters comprise an X-axis scaling scale, a Y-axis scaling scale, an X-axis offset and a Y-axis offset.
Specifically, in this embodiment, by recording the real-time coordinate point and the initial coordinate point of the cursor, a cursor movement track for performing scaling processing may be obtained, where the cursor movement track corresponds to the corresponding cursor displacement value and the cursor displacement direction.
In a specific embodiment, the cursor displacement value includes a displacement value of the cursor on the X-axis and a displacement value of the cursor on the Y-axis, for example, an initial coordinate point of the cursor is (startPointX, startPointY), a real-time coordinate point of the cursor is (movePointX, movePointY), and a calculation formula of the displacement value of the cursor on the X-axis is: moveRealDistanceX=movePointX-startPointX, wherein moveRealDistanceX is a cursor displacement value in the X-axis direction, movePointX is an X value of a real-time coordinate point, and movePointY is a y value of the real-time coordinate point; the calculation formula of the displacement value of the cursor on the Y axis is as follows: moveRealDistanceY=movePointY-startPointY, where moveRealDistanceY is a cursor displacement value in the Y-axis direction, startPointX is an x value of the initial coordinate point, and startPointY is a Y value of the initial coordinate point.
In the practical application process, the cursor displacement direction is the scaling direction. The cursor displacement direction includes at least north-east, north-west, south-east and south-west. The determination of the zoom reference point may be determined according to a zoom direction, the zoom reference point being a vertex in a diagonal direction to the zoom direction.
Specifically, when the zoom direction is the northeast direction, the zoom reference point is the southwest vertex. When the zoom direction is the northwest direction, the zoom reference point is the southeast direction vertex. When the zoom direction is the southwest direction, the zoom reference point is the northwest vertex. When the zoom direction is the southwest direction, the zoom reference point is the northeast direction vertex.
After the rectangular parameters, the cursor displacement values, the scaling directions and the scaling reference points are obtained, the scaling parameters in each scaling direction are calculated according to a preset formula.
In the practical application process, when calculating the scaling parameters in different scaling directions, calculation needs to be performed based on different scaling reference points.
In one embodiment, the rectangular parameters include a rectangular width and a rectangular height, and the scaling parameters are calculated in the following manner:
x-axis scaling= (rectangular width of target rectangle+cursor displacement value in X-axis direction)/rectangular width of target rectangle;
y-axis scaling= (rectangle height of target rectangle+cursor displacement value in Y-axis direction)/rectangle height of target rectangle;
x-axis offset = original coordinate point X value X-axis scale-original coordinate point X value;
y-axis offset = original coordinate point Y value x Y-axis scale-original coordinate point Y value.
Specifically, the foregoing calculation method may be expressed as the following formula:
scaleX=(W+moveRealDistanceX)/W;
scaleY=(H+moveRealDistanceY)/H;
offsetX=(originX*scaleX)-originX;
offsetY=(originY*scaleY)-originY;
wherein, scaleX is X-axis scaling, scaleY is Y-axis scaling, W is rectangular width, H is rectangular height, originX is original coordinate point X value, originY is original coordinate point Y value, offsetX is X-axis offset, offsetY is Y-axis offset.
In one embodiment, performing preset scaling transformation on each original coordinate point based on scaling parameters to obtain a target coordinate point includes:
and carrying out preset matrix transformation on each original coordinate point based on the scaling parameters to obtain the target coordinate point.
Specifically, in this embodiment, by traversing the original coordinate points, a preset matrix transformation is performed on each original coordinate point, so as to obtain a target coordinate point corresponding to the original coordinate point.
In particular embodiments, the transformation is based on: when matrix (scaleX, 0, scaley, -offsetX, -offsetY) implements the preset matrix transformation of each original coordinate point, the calculation manner of the target coordinate point may be as follows:
target coordinate point X value = original coordinate point X value X axis scale-X axis offset;
target coordinate point Y value = original coordinate point Y value Y axis scale-Y axis offset.
In particular, the method comprises the steps of,
the foregoing calculation may also be expressed as the following formula:
finalX=originX*scaleX-offsetX;
finalY=originY*scaleY-offsetY;
wherein, finalX is the target coordinate point x value, and finalY is the target coordinate point y value.
According to the method and the device, the target coordinate point corresponding to the original coordinate point is calculated based on the preset matrix transformation mode, and the scaled target object can be displayed more finely. And after the transformation is completed, the operation can be performed based on the coordinate point of the new target object, and the coordinate point is not influenced by the telescopic transformation. In addition, the scaling process provided by the embodiment adopts a matrix (matrix) to perform effective transformation, and the transformation is performed based on the start-end process, so that the drawing of the target object according to the coordinate transformation is not required in real time, a large number of coordinate points are not required to be drawn, the scaling function is ensured, and meanwhile, the occupation of excessive resources is avoided.
In one embodiment, the scaling control method provided in the embodiment further includes:
and carrying out preset scaling transformation on the target rectangle based on the scaling parameters, and redrawing the target rectangle.
In a specific embodiment, before scaling the object to be scaled, the target rectangle may be scaled to a shape matching the target object, so as to ensure that the target object is always located in the target rectangle.
In one embodiment, performing a preset scaling transformation on the target rectangle based on the scaling parameter, and redrawing the target rectangle, further includes:
if the scaling ratio of the scaling parameter is positive, drawing a target rectangle according to the anticlockwise sequence;
and if the scaling ratio of the scaling parameter is negative, drawing the target rectangle according to the clockwise sequence.
In a specific embodiment, when traversing each original coordinate point, it is possible to fix traversing each original coordinate point from the northwest direction of the target rectangle, so as to ensure the scaling effect on the target object. It should be noted that the starting point of the traversal can be adaptively configured according to the needs of the actual application scenario.
In the implementation process, different scaling scales correspond to different scaling effects, as shown in fig. 3, the cursor locks the southwest vertex of the target rectangle, the target object is enlarged when stretching in the southwest direction, the target object is mirrored when stretching upwards, the target object is mirrored when stretching in the northwest direction, and the target object is mirrored when stretching leftwards.
As shown in fig. 3, when the scaling in the Y-axis direction or the scaling in the X-axis direction is negative, it is indicated that the object to be scaled has a mirror effect, and at this time, by converting the drawing order of the target rectangle, it is possible to effectively avoid that the object to be scaled exceeds the frame range of the target rectangle in the process of stretching the target rectangle.
In one embodiment, the method further comprises:
if the width of the target rectangle of the object to be scaled is 0, determining scaling parameters of the object to be scaled according to the preset width and the actual height;
and if the height of the target rectangle of the object to be scaled is 0, determining the scaling parameters of the object to be scaled according to the actual width and the preset height.
In a specific embodiment, during the zooming action of the target rectangle, the actual height and the actual width of the target rectangle change in value along with the zooming action. But for the object to be scaled of the line or dot type, in the direction in which the width of the target rectangle is 0 or the height is 0, there is no need to embody a magnification effect,
therefore, when the target rectangle is generated, the corresponding rectangle frame is generated according to the preset width or the preset height, and when the target rectangle is scaled, the preset width and the preset height are not transformed along with the scaling action of the target rectangle.
According to the method, the preset width and the preset height are set, and preset matrix transformation can be applied to the object to be scaled of the line or point type, so that the scaled target coordinate point can be obtained.
In summary, the embodiment of the application provides a scaling control method, which processes all original coordinate points on an object to be scaled based on a preset matrix transformation to obtain all target coordinate points on a target object, thereby realizing not only a scaling function of the object to be scaled macroscopically, but also scaling processing of a coordinate point level to obtain the target object which can be edited further. The scaling control method provided by the embodiment effectively combines rectangular scaling and object scaling, so that visual fluency is achieved, and operability of a target object on the SVG canvas is improved.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a zoom control device for realizing the above-mentioned zoom control method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more zoom control devices provided below may refer to the limitation of the zoom control method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 4, there is provided a zoom control apparatus 400 comprising: an object determination module 410, a rectangle acquisition module 420, a parameter determination module 430, a coordinate transformation module 440, and an object rendering module 450, wherein:
the object determining module 410 is configured to determine an object to be scaled, and obtain an original coordinate point of the object to be scaled.
The rectangle obtaining module 420 is configured to obtain a target rectangle containing the object to be scaled based on a preset function.
The parameter determining module 430 is configured to determine a scaling parameter of the object to be scaled according to the scaling action on the target rectangle and the rectangle parameter of the target rectangle.
The coordinate transformation module 440 is configured to perform preset scaling transformation on each original coordinate point based on the scaling parameters, so as to obtain a target coordinate point.
And an object drawing module 450 for drawing the target object based on the target coordinate point.
In one embodiment, the parameter determining module 430 is specifically configured to obtain a real-time coordinate point and an initial coordinate point of the cursor; calculating a cursor displacement value and a cursor displacement direction based on the real-time coordinate point and the initial coordinate point; determining a scaling direction and a scaling reference point of a scaling action according to the cursor displacement direction; and calculating scaling parameters of the image to be scaled in each scaling direction according to the rectangular parameters, the cursor displacement value, the scaling direction and the scaling reference point, wherein the scaling parameters comprise an X-axis scaling scale, a Y-axis scaling scale, an X-axis offset and a Y-axis offset.
In summary, the present embodiment provides a scaling control device, which processes all original coordinate points on an object to be scaled based on a preset matrix transformation to obtain all target coordinate points on the target object, so as to not only implement a scaling function of the object to be scaled macroscopically, but also implement scaling processing of a coordinate point level, and obtain a target object capable of being edited further. The scaling control device provided by the embodiment effectively combines rectangular scaling and object scaling, so that visual fluency is achieved, and operability of a target object on the SVG canvas is improved.
The respective modules in the above-described zoom control apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a zoom control method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
determining an object to be zoomed, and acquiring an original coordinate point of the object to be zoomed;
acquiring a target rectangle containing an object to be scaled based on a preset function;
determining scaling parameters of an object to be scaled according to the scaling action of the target rectangle and rectangle parameters of the target rectangle;
performing preset scaling transformation on each original coordinate point based on scaling parameters to obtain a target coordinate point;
and drawing the target object based on the target coordinate point.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
determining an object to be zoomed, and acquiring an original coordinate point of the object to be zoomed;
acquiring a target rectangle containing an object to be scaled based on a preset function;
determining scaling parameters of an object to be scaled according to the scaling action of the target rectangle and rectangle parameters of the target rectangle;
performing preset scaling transformation on each original coordinate point based on scaling parameters to obtain a target coordinate point;
and drawing the target object based on the target coordinate point.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
determining an object to be zoomed, and acquiring an original coordinate point of the object to be zoomed;
acquiring a target rectangle containing an object to be scaled based on a preset function;
determining scaling parameters of an object to be scaled according to the scaling action of the target rectangle and rectangle parameters of the target rectangle;
performing preset scaling transformation on each original coordinate point based on scaling parameters to obtain a target coordinate point;
and drawing the target object based on the target coordinate point.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A zoom control method, characterized by comprising:
determining an object to be scaled, and acquiring an original coordinate point of the object to be scaled;
acquiring a target rectangle containing the object to be scaled based on a preset function;
determining a scaling parameter of the object to be scaled according to the scaling action of the target rectangle and the rectangle parameter of the target rectangle;
performing preset scaling transformation on each original coordinate point based on the scaling parameters to obtain target coordinate points;
and drawing a target object based on the target coordinate point.
2. The method of claim 1, wherein the object to be scaled is a scalable vector graphic or a brush object, and wherein determining the scaling parameters for the image to be scaled based on the scaling action for the target rectangle and the rectangle parameters for the target rectangle comprises:
acquiring a real-time coordinate point and an initial coordinate point of a cursor;
calculating a cursor displacement value and a cursor displacement direction based on the real-time coordinate point and the initial coordinate point;
determining a scaling direction and a scaling reference point of the scaling action according to the cursor displacement direction;
and calculating the scaling parameters of the image to be scaled in each scaling direction according to the rectangular parameters, the cursor displacement value, the scaling direction and the scaling reference point, wherein the scaling parameters comprise an X-axis scaling scale, a Y-axis scaling scale, an X-axis offset and a Y-axis offset.
3. The method according to claim 2, wherein the rectangle parameters include a rectangle width and a rectangle height, and the scaling parameters are calculated by:
x-axis scaling= (rectangular width of the target rectangle+cursor displacement value in X-axis direction)/rectangular width of the target rectangle;
y-axis scaling= (rectangle height of the target rectangle+cursor displacement value in Y-axis direction)/rectangle height of the target rectangle;
x-axis offset = original coordinate point X value X-axis scale-original coordinate point X value;
y-axis offset = original coordinate point Y value x Y-axis scale-original coordinate point Y value.
4. The method according to claim 1, wherein before performing the preset scaling transformation on each original coordinate point based on the scaling parameters to obtain the target coordinate point, the method further comprises:
and carrying out preset scaling transformation on the target rectangle based on the scaling parameters, and redrawing the target rectangle.
5. The method of claim 4, wherein the performing a preset scaling transformation on the target rectangle based on the scaling parameter and redrawing the target rectangle further comprises:
if the scaling ratio of the scaling parameter is positive, drawing the target rectangle according to the anticlockwise sequence;
and if the scaling ratio of the scaling parameter is negative, drawing the target rectangle according to the clockwise sequence.
6. The method as recited in claim 1, further comprising:
if the width of the target rectangle of the object to be scaled is 0, determining scaling parameters of the object to be scaled according to the preset width and the actual height;
if the height of the target rectangle of the object to be zoomed is 0, determining a zoom parameter of the object to be zoomed according to the actual width and the preset height;
and if the width and the height of the target rectangle of the object to be zoomed are both 0, determining the zoom parameter of the object to be zoomed according to the preset width and the preset height.
7. A zoom control apparatus, comprising:
the object determining module is used for determining an object to be scaled and acquiring an original coordinate point of the object to be scaled;
the rectangle acquisition module is used for acquiring a target rectangle containing the object to be scaled based on a preset function;
the parameter determining module is used for determining the scaling parameter of the object to be scaled according to the scaling action of the target rectangle;
the coordinate transformation module is used for carrying out preset scaling transformation on each original coordinate point based on the scaling parameters to obtain a target coordinate point;
and the object drawing module is used for drawing the target object based on the target coordinate point.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the graphics control method of any one of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the graphics control method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the graphics control method as claimed in any one of claims 1 to 6.
CN202311101224.7A 2023-08-29 2023-08-29 Scaling control method, scaling control device, computer apparatus, storage medium, and program product Pending CN117036174A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311101224.7A CN117036174A (en) 2023-08-29 2023-08-29 Scaling control method, scaling control device, computer apparatus, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311101224.7A CN117036174A (en) 2023-08-29 2023-08-29 Scaling control method, scaling control device, computer apparatus, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN117036174A true CN117036174A (en) 2023-11-10

Family

ID=88635373

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311101224.7A Pending CN117036174A (en) 2023-08-29 2023-08-29 Scaling control method, scaling control device, computer apparatus, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN117036174A (en)

Similar Documents

Publication Publication Date Title
JP2009543192A (en) Composition of ANISOMETRIC texture (TEXTURE) (SYNTHESIS)
CN104732479B (en) Resizing an image
CN113628331B (en) Data organization and scheduling method for photogrammetry model in illusion engine
CN110428504B (en) Text image synthesis method, apparatus, computer device and storage medium
CN116109765A (en) Three-dimensional rendering method and device for labeling objects, computer equipment and storage medium
CN109697733A (en) Point searching method and device in point cloud space, computer equipment and storage medium
CN113538623A (en) Method and device for determining target image, electronic equipment and storage medium
JP2021144428A (en) Data processing device and data processing method
CN117036174A (en) Scaling control method, scaling control device, computer apparatus, storage medium, and program product
JP4977243B2 (en) Image processing apparatus, method, and program
WO2023103684A1 (en) Portrait hair flowing special effect processing method and apparatus, medium, and electronic device
CN116597063A (en) Picture rendering method, device, equipment and medium
CN116758206A (en) Vector data fusion rendering method and device, computer equipment and storage medium
CN113012302B (en) Three-dimensional panorama generation method, device, computer equipment and storage medium
CN114797109A (en) Object editing method and device, electronic equipment and storage medium
CN114022518A (en) Method, device, equipment and medium for acquiring optical flow information of image
CN116527908B (en) Motion field estimation method, motion field estimation device, computer device and storage medium
CN116664616B (en) Interactive image segmentation labeling method and device, computer equipment and storage medium
CN110807113A (en) Non-iterative elimination method for rectangular primitive overlap in visual layout
CN116109799B (en) Method, device, computer equipment and storage medium for training adjustment model
CN116883563B (en) Method, device, computer equipment and storage medium for rendering annotation points
CN111047666B (en) Unified digital content selection system for vector graphics and grid graphics
CN117764819A (en) Image processing method, device, electronic equipment and storage medium
CN118314233A (en) Graphics processing method, graphics processing apparatus, computer device, and storage medium
CN118172511A (en) StyleGAN 2-based single-view three-dimensional reconstruction method and system

Legal Events

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