// (c) Tuomas J. Lukka package org.nongnu.libvob.buoy.impl; import org.nongnu.libvob.VobScene; import org.nongnu.libvob.buoy.*; /** A BuoyOnCircleGeometer that uses a constant ratio * of the box given to it. */ public class RatioBuoyOnCircleGeometer extends BuoyOnCircleGeometer { static float[] tmp = new float[2]; /** The coordinates of the rectangle in (0,1)x(0,1). */ float x, y, w, h; public RatioBuoyOnCircleGeometer(float x, float y, float w, float h) { this.x = x; this.y = y; this.w = w; this.h = h; } public void prepare(VobScene vs, int into, Object key, boolean create) { if(create) { this.buoyinto = vs.orthoCS(into, key, 1, 1, 1, 1, 1); } else { this.buoyinto = vs.matcher.getCS(into, key); } vs.coords.getSqSize(into, tmp); vs.coords.setOrthoParams(this.buoyinto, 0, x * tmp[0], y * tmp[1], w * tmp[0], h * tmp[1]); } }