LibCapy - displayMagnifier

Image magnifier class.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyDisplayMagnifier :

Struct CapyDisplayMagnifier's properties:

Position

Scale, memorise the inverse of the scale to avoid using division in the conversion method (supposedly more often used than the scale update methods)

Struct CapyDisplayMagnifier's methods:

Destructor

Reset the magnifier (position to origin, scale to 1.0)

Move the magnifier to a position

Input argument(s):

pos: The position where to move the magnifier

Translate the magnifier by a vector

Input argument(s):

v: The vector to add to the current position of the magnifier

Scale up the magnification at a given speed

Input argument(s):

coeff: the speed by which the scale is scaled up (equivalent to scale *= 1.0 + coeff)
fixedPos: if not null, the magnifier is translated such as the fixed position appears at the same location on the display before and after scaling. (fixedPos in display coordinates)

Scale down the magnification at a given speed

Input argument(s):

coeff: the speed by which the scale is scaled down (equivalent to scale *= 1.0 - coeff)
fixedPos: if not null, the magnifier is translated such as the fixed position appears at the same location on the display before and after scaling. (fixedPos in display coordinates)

Convert coordinates from magnified to demagnified

Input argument(s):

coord: the coordinates to convert

Output and side effect(s):

Return the converted coordinates. Don't care about overflow if the converted coordinates become negative, use appropriately. The conversion formula is coordImg = coordDisplay / scale - translate

Functions:

Create a CapyDisplayMagnifier

Output and side effect(s):

Return a CapyDisplayMagnifier

Allocate memory for new CapyDisplayMagnifier

Output and side effect(s):

Return a newly allocated CapyDisplayMagnifier

Exception(s):

May raise CapyExc_MallocFailed

Free the memory used by a CapyDisplayMagnifier* and reset '*that' to NULL

Input argument(s):

display: the CapyDisplayMagnifier to free

2021-11-25
in LibCapy,
44 views
Copyright 2021-2024 Baillehache Pascal