examples/graphics/rectangleAlignmentAndScalingExample/README.md
This openFrameworks Example is designed to demonstrate all of the different aligning and scaling functions available in ofRectangle. The basic premise is to define a subject and target rectangle. The "subject" (on the left) rectangle will be aligned-to and scaled-to the "target" (on the right) rectangle based on the user's input. The resulting rectangle (workingSubjectRect in this case), displayed in the center, is the result of the operations.
In this example, pay attention to the following code:
ofScaleMode scaleMode can be interpreted as a concise combination of an ofAspectRatioMode, an ofAlignVert and an ofAlignHorz.
OF_SCALEMODE_FILL FILLS the TARGET rect with the SUBJECT rectOF_SCALEMODE_CENTER the subject's Center is set equal to the Target's CenterOF_SCALEMODE_FIT fits the SUBJECT rect INSIDE the TARGET rect.ofAspectRatioMode aspect ratio is the the ratio of the width to the height of an image or screen
OF_ASPECT_RATIO_KEEPOF_ASPECT_RATIO_KEEP_BY_EXPANDINGOF_ASPECT_RATIO_IGNOREofAlignHorz aligns the subject relative to the target horizontally based on left, center, and right alignmentsOF_ALIGN_HORZ_IGNOREOF_ALIGN_HORZ_LEFTOF_ALIGN_HORZ_RIGHTOF_ALIGN_HORZ_CENTERofAlignVertaligns the subject relative to the target vertically based on left, center, and right alignmentsOF_ALIGN_VERT_CENTER OF_ALIGN_VERT_BOTTOM OF_ALIGN_VERT_TOPWhen launching this app, you should see:
Instructions for use:
This Example does not use any other classes.