115 |
*/ |
*/ |
116 |
public boolean showLinkbuoys = false; |
public boolean showLinkbuoys = false; |
117 |
|
|
|
// Visual characteristics of the virtual paper and ripple |
|
|
|
|
|
/** The scale of the background. |
|
|
* bgscale in paper coordinates = 1 in background coords. |
|
|
*/ |
|
|
public float bgscale = 200; |
|
|
|
|
|
/** Border size of the irregularframe. |
|
|
*/ |
|
|
public float irreguBorder = 50; |
|
|
|
|
|
/** Ripple length of irregularframe. |
|
|
*/ |
|
|
public float irreguRipple = 500; |
|
|
|
|
|
/** For debugging: whether to use stencil or not. |
|
|
*/ |
|
|
public boolean useStencil = true; |
|
|
|
|
|
Vob black = GLCache.getCallList("Color 0 0 0\n"); |
|
|
|
|
|
CoordinatePlaneView coordinatePlaneView; |
|
|
|
|
|
GraphicsAPI.Window window; |
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
|
|
|
|
|
|
|
private PPDims d; |
|
123 |
private Cell current; |
private Cell current; |
124 |
private AbstractViewContext avc; |
private AbstractViewContext avc; |
125 |
|
private PPDims d; |
126 |
|
private GraphicsAPI.Window window; |
127 |
public PPCanvasCursor(Cell c, AbstractViewContext avc, PPDims d, GraphicsAPI.Window w) { |
public PPCanvasCursor(Cell c, AbstractViewContext avc, PPDims d, GraphicsAPI.Window w) { |
128 |
this.current = c; |
this.current = c; |
129 |
this.avc = avc; |
this.avc = avc; |
130 |
this.d = d; |
this.d = d; |
131 |
this.window = w; |
this.window = w; |
|
this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan); |
|
132 |
} |
} |
133 |
|
|
|
TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 0, 20); |
|
|
CellView cellview = new ImageCell(new PPCellView(style, |
|
|
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")); |
|
134 |
|
|
135 |
public void renderMain(VobScene vs, int into) { |
public void renderMain(VobScene vs, int into) { |
136 |
int mainctr = vs.translateCS(0, "MAINVPCTR", |
int mainctr = vs.translateCS(0, "MAINVPCTR", |
144 |
// cell to frame CS |
// cell to frame CS |
145 |
int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10); |
int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10); |
146 |
vs.matcher.add(frameCS, c2fCS, "C2F"); |
vs.matcher.add(frameCS, c2fCS, "C2F"); |
147 |
|
SinglePaper.i(avc, d, window).render(vs, frameCS, c2fCS); |
|
SinglePlane plane = new SinglePlane(); |
|
|
plane.context = avc; |
|
|
((AbstractViewContext)plane.context).setCellView(cellview); |
|
|
plane.render(vs, frameCS, c2fCS); |
|
|
|
|
148 |
} |
} |
149 |
|
|
150 |
public void keystroke(String s) { |
public void keystroke(String s) { |
151 |
|
|
152 |
} |
} |
153 |
|
|
154 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** A single PP plane, with given view context. |
|
|
* This class takes care of drawing the stencil, |
|
|
* the background and the vobs inside the plane. |
|
|
*/ |
|
|
class SinglePlane { |
|
|
ViewContext context; |
|
|
/** Render the plane. |
|
|
* @param frameCS The Box-coordinate system of the frame. |
|
|
* The scale is assumed to be single pixels (although |
|
|
* for example buoys will set this differently). |
|
|
* The height and width define the viewport. |
|
|
* @param panZoom The coordinate system from virtual paper coordinates |
|
|
* to panned-and-zoomed coordinates. |
|
|
* The origin of the panned-and-zoomed coordinates |
|
|
* will be set to the center of the frameCS, and |
|
|
* the scale is 1 to 1 pixel. |
|
|
*/ |
|
|
void render(final VobScene vs, final int frameCS, final int panZoom) { |
|
|
final GLVobCoorder glc = (GLVobCoorder)vs.coords; |
|
|
float[] sqs = new float[2]; |
|
|
glc.getSqSize(frameCS, sqs); |
|
|
if (sqs[1] < 5) return; |
|
|
if (dbg) pa("Sqs frame: "+sqs[0]+" "+sqs[1]); |
|
|
|
|
|
// CS from center of frameCS to screen |
|
|
int framecenterCS = vs.translateCS(frameCS, "FCTR", sqs[0]/2, sqs[1]/2); |
|
|
|
|
|
// CS from virtualpaper to screen |
|
|
final int paper2screen = glc.concat(framecenterCS, panZoom); |
|
|
vs.matcher.add(frameCS, paper2screen, "PAPER2S"); |
|
|
final int bg2screen = vs.scaleCS(paper2screen, "BGSCA", |
|
|
bgscale, bgscale); |
|
|
|
|
|
final Cell cursor = context.getAccursed(); |
|
|
final Cell plane = cursor.h(d.contains); |
|
|
|
|
|
// BgVob takes two coordsys: |
|
|
// frame2screen and paper2screen |
|
|
final BgVob bg = BgVob.create(plane, window); |
|
|
|
|
|
final IrregularFrame f = IrregularFrame.create(-16000,-16000,16000,16000, |
|
|
irreguBorder, irreguRipple, 2); |
|
|
|
|
|
final int frameUnit = vs.unitSqCS(frameCS, "USQ"); |
|
|
|
|
|
// Irregu needs frame 2 paper |
|
|
final int screen2paper = glc.invert(paper2screen); |
|
|
vs.matcher.add(paper2screen, screen2paper, "INVER2S"); |
|
|
final int frameUnit2paper = glc.concat(screen2paper, frameUnit); |
|
|
vs.matcher.add(screen2paper, frameUnit2paper, "f2pap"); |
|
|
|
|
|
final int paper2screen_shifted = vs.translateCS(paper2screen, |
|
|
"SHIFTUP", |
|
|
0, 0, -30); |
|
|
|
|
|
class Putter implements Runnable { |
|
|
Vob v; |
|
|
Putter(Vob v) { this.v = v; } |
|
|
public void run() { |
|
|
vs.map.put(v, paper2screen, frameUnit2paper); |
|
|
} |
|
|
} |
|
|
|
|
|
Runnable placeContent = new Runnable() { |
|
|
public void run() { |
|
|
// XXX Unclean! |
|
|
// vs.map.put(bg, frameUnit, bg2screen); |
|
|
bg.put(vs, frameUnit, bg2screen); |
|
|
vs.map.put(black); |
|
|
coordinatePlaneView.render(vs, paper2screen_shifted, context, frameCS); |
|
|
}}; |
|
|
|
|
|
if(useStencil) |
|
|
Stencil.drawStenciled(vs, |
|
|
new Putter(f.getContent()), |
|
|
new Putter(f.getBlank()), |
|
|
new Putter(f.getFrame()), |
|
|
placeContent, |
|
|
true); |
|
|
else { |
|
|
(new Putter(f.getContent())).run(); |
|
|
(new Putter(f.getFrame())).run(); |
|
|
(new Putter(f.getBlank())).run(); |
|
|
placeContent.run(); |
|
|
} |
|
|
} |
|
|
} |
|
161 |
} |
} |
162 |
|
|