Package 

Class CropWindowMoveHandler


  • 
    public final class CropWindowMoveHandler
    
                        

    Handler to update crop window edges by the move type - Horizontal, Vertical, Corner or Center.

    • Constructor Detail

      • CropWindowMoveHandler

        CropWindowMoveHandler(CropWindowMoveHandler.Type type, CropWindowHandler cropWindowHandler, Float touchX, Float touchY)
        Parameters:
        cropWindowHandler - main crop window handle to get and update the crop window edges
        touchX - the location of the initial toch possition to measure move distance
        touchY - the location of the initial toch possition to measure move distance
    • Method Detail

      • move

         final Unit move(RectF rect, Float x, Float y, RectF bounds, Integer viewWidth, Integer viewHeight, Float snapMargin, Boolean fixedAspectRatio, Float aspectRatio)

        Updates the crop window by change in the toch location.<br></br> Move type handled by this instance, as initialized in creation, affects how the change in toch location changes the crop window position and size.<br></br> After the crop window position/size is changed by toch move it may result in values that vialate contraints: outside the bounds of the shown bitmap, smaller/larger than min/max size or missmatch in aspect ratio. So a series of fixes is executed on "secondary" edges to adjust it by the "primary" edge movement.<br></br> Primary is the edge directly affected by move type, secondary is the other edge.<br></br> The crop window is changed by directly setting the Edge coordinates.

        Parameters:
        x - the new x-coordinate of this handle
        y - the new y-coordinate of this handle
        bounds - the bounding rectangle of the image
        viewWidth - The bounding image view width used to know the crop overlay is at view edges.
        viewHeight - The bounding image view height used to know the crop overlay is at view edges.
        snapMargin - the maximum distance (in pixels) at which the crop window should snap to the image
        fixedAspectRatio - is the aspect ration fixed and 'targetAspectRatio' should be used
        aspectRatio - the aspect ratio to maintain