Overview
iPlug2 IGraphics supports dynamic resizing and scaling for responsive user interfaces. This allows your plugin to:Adapt to Screen Size
Work on small laptop screens and large 4K displays
Support High-DPI
Automatically scale for Retina/4K displays
User Resizing
Let users resize the plugin window
Host Constraints
Respect host-provided view sizes
Basic Resize Handling
Enable automatic layout updates on resize:When
SetLayoutOnResize(true) is enabled, mLayoutFunc is called whenever the graphics context is resized.Corner Resizer
Add a corner drag handle for user resizing:- Scale Mode
- Size Mode
Layout Strategies
Fractional Layout
Divide the UI into fractional regions:IPlugResponsiveUI.cpp:22-37
IRECT fractional methods:
FracRectVertical(frac, fromTop)- Split verticallyFracRectHorizontal(frac, fromLeft)- Split horizontallyReduceFromTop/Bottom/Left/Right(amount)- Reduce by pixels
Grid Layout
Arrange controls in a responsive grid:Adaptive Layout
Change layout based on aspect ratio or size:High-DPI Support
Automatic Scaling
iPlug2 automatically handles high-DPI displays:Bitmap Scaling
Provide multiple resolutions for bitmaps:Naming convention for high-DPI assets:
image.png- 1x (base)[email protected]- 2x (Retina)[email protected]- 3x (UHD)
SVG for Perfect Scaling
SVG images scale perfectly at any resolution:Host View Configuration
Responding to Host Requests
Hosts can request specific view sizes:Plugin.h
Constraining Size
Set minimum/maximum dimensions:Plugin.cpp
Custom Control Resize Handling
Make custom controls responsive:Resize methods:
OnResize()- Bounds changedOnRescale()- Draw scale/DPI changedSetRECT(bounds)- Manually set bounds and trigger OnResize()SetTargetAndDrawRECTs(bounds)- Set both target and draw bounds
Complete Responsive Example
Here’s a full responsive plugin implementation:IRECT Helper Methods
Useful methods for responsive layout:Best Practices
- Layout
- Scaling
- Performance
- Host Integration
- Best Practices
- Scaling
- Performance
- User Experience
- Test at multiple aspect ratios
- Support both wide and tall layouts
- Maintain minimum readable sizes
Platform Considerations
Next Steps
Controls Library
Learn about responsive controls
Custom Controls
Make controls responsive
Getting Started
Set up your first UI
Drawing Backends
Backend-specific considerations