Commit graph

13 commits

Author SHA1 Message Date
0cd41e9814 Fix front camera rotation mirroring in shader
Add uIsFrontCamera uniform to shader and adjust coordinate
transformations for front camera's mirrored texture coordinates:
- Position transform: (1-posY, 1-posX) instead of (posY, 1-posX)
- Angle transform: -angle - 90° instead of +angle + 90°

Applied to linearFocusDistance, radialFocusDistance, and blur
direction calculations in sampleBlurred.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:07:44 +01:00
b16dd971f2 Add front camera texture coordinate handling
- Add separate texture coordinates for front and back cameras
- Front camera uses mirrored coordinates for natural selfie view
- Add setFrontCamera() method to renderer for dynamic switching
- Update texture coord buffer on GL thread when camera changes
- CameraScreen observes isFrontCamera state to trigger updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:03:26 +01:00
a3ce90a2fe Fix aspect ratio correction for intermediate rotation angles
Apply screen aspect ratio correction to offset.y (screen X direction)
instead of offset.x (screen Y direction) in both linear and radial
mode distance calculations. This fixes angle distortion at non-90°
rotations in portrait mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:57:01 +01:00
a99b6f222f Fix coordinate transformation in shader for position and rotation
Transform screen coordinates to texture coordinates (90° CW rotation):
- Position: (x,y) -> (y, 1-x)
- Angle: θ -> θ + 90°

Applied in linearFocusDistance, radialFocusDistance, and sampleBlurred
to fix preview not matching UI overlay position and rotation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:53:34 +01:00
656385e48d Fix slider controls not updating preview
Use rememberUpdatedState in ControlPanel to prevent stale closure
capture during continuous slider drags. This ensures the latest
blur parameters are used when updating, avoiding conflicts with
concurrent gesture updates from TiltShiftOverlay.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:36:35 +01:00
d3ca23b71c Add radial mode, UI controls, front camera, update to API 35
- Add radial/elliptical blur mode with aspect ratio control
- Add UI sliders for blur intensity, falloff, and shape
- Add front camera support with flip button
- Update minimum SDK to API 35 (Android 15)
- Enable landscape orientation (fullSensor)
- Rename app to "Naiv Tilt Shift Camera"
- Set APK output name to naiv-tilt-shift
- Add project specification document

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:13:31 +01:00
e8a5fa4811 Fix state persistence, drag tracking, and shader rotation sync
State persistence:
- Use rememberUpdatedState to always get latest params inside pointerInput
- Capture gestureStartParams at beginning of each gesture
- All adjustments now use initial values + accumulated change

Drag tracking:
- Track initialDragCentroid at drag start
- Calculate total drag offset from initial point (not frame-by-frame)
- Drag now properly moves focus center 1:1

Shader rotation sync:
- Adjust angle by -90° in shader to compensate for portrait texture rotation
- Preview blur effect now rotates in sync with overlay UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:10:18 +01:00
2736d42e74 Fix gesture tracking: 1:1 rotation and drag, better zone detection
Rotation:
- Use direct angle calculation between touch points (atan2)
- Track initial touch angle and effect angle separately
- Effect rotation now matches finger rotation exactly

Position drag:
- Remove all sensitivity dampening
- 1:1 mapping: finger moves 100px, effect center moves 100px

Gesture zones rebalanced:
- Rotation: only very center of focus zone (< 30% of focus height)
- Size adjustment: large area around effect (30% - 200%)
- Camera zoom: only far outside the effect (> 200%)

This prevents rotation from dominating size adjustments.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:02:43 +01:00
e53155e8ee Add 2D focus positioning, fix rotation tracking, sync preview with effect
2D positioning:
- Add positionX parameter to BlurParameters (was only Y before)
- Update shader with uPositionX and uPositionY uniforms
- Single-finger drag now moves focus center anywhere on screen
- Update gradient mask generation for capture

Rotation tracking:
- Remove dampening from rotation gesture (1:1 tracking)
- Rotate gesture now directly tracks finger movement
- Preview effect rotates in sync with overlay

Overlay and shader sync:
- Both now use same positionX, positionY, angle parameters
- Preview blur effect matches overlay visualization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:55:17 +01:00
e3e05af0b8 Fix image orientation, reduce sensitivity, fix overlay clipping
Image orientation:
- Actually rotate captured bitmap using ImageProxy.rotationDegrees
- Save with EXIF ORIENTATION_NORMAL (bitmap already correctly oriented)
- Handle front camera mirroring

Gesture sensitivity (halved again):
- Position drag: 0.15x (was 0.3x)
- Rotation: 0.2x (was 0.4x)
- Size pinch: 0.25x (was 0.5x)
- Zoom pinch: 0.4x (was 0.6x)

Overlay drawing:
- Use screen diagonal to calculate extended geometry
- Draw lines and rectangles that extend beyond screen bounds
- Prevents clipping when tilt-shift effect is rotated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:46:43 +01:00
3bbf4f9d14 Fix portrait orientation and reduce gesture sensitivity
- Rotate texture coordinates 90° for portrait mode display
  (camera sensors are landscape-oriented by default)
- Add sensitivity dampening constants for all gesture types:
  - Position drag: 0.3x
  - Rotation: 0.4x
  - Size pinch: 0.5x
  - Zoom pinch: 0.6x
- Track accumulated drag for smoother position changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:32:31 +01:00
cc367bc713 Fix GLSL shader for OpenGL ES 2.0 compatibility
- Move #extension directive to first line (required by GLSL)
- Replace array initializer syntax with getWeight() function
  (float[]() constructor not supported in GLSL ES 1.00)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:27:55 +01:00
07e10ac9c3 Initial implementation of Tilt-Shift Camera Android app
A dedicated camera app for tilt-shift photography with:
- Real-time OpenGL ES 2.0 shader-based blur preview
- Touch gesture controls (drag, rotate, pinch) for adjusting effect
- CameraX integration for camera preview and high-res capture
- EXIF metadata with GPS location support
- MediaStore integration for saving to gallery
- Jetpack Compose UI with haptic feedback

Tech stack: Kotlin, CameraX, OpenGL ES 2.0, Jetpack Compose
Min SDK: 26 (Android 8.0), Target SDK: 35 (Android 15)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:26:41 +01:00