imgWidth = (av.getRanges().getEndRes() - av.getRanges().getStartRes()
+ 1) * av.getCharWidth();
- BufferedImage newimage = new BufferedImage(imgWidth,
- ap.getAnnotationPanel().getHeight(),
- BufferedImage.TYPE_INT_ARGB);
+ if (imgWidth > 0)
+ {
+ BufferedImage newimage = new BufferedImage(imgWidth,
+ ap.getAnnotationPanel().getHeight(),
+ BufferedImage.TYPE_INT_ARGB);
- gg = (Graphics2D) newimage.getGraphics();
- gg.setFont(av.getFont());
- gg.drawImage(image, null, 0, 0);
- image = newimage;
+ gg = (Graphics2D) newimage.getGraphics();
+ gg.setFont(av.getFont());
+ gg.drawImage(image, null, 0, 0);
+ image = newimage;
- transX = (er - horizontal - sr) * av.getCharWidth();
- sr = er - horizontal - sr;
+ transX = (er - horizontal - sr) * av.getCharWidth();
+ sr = er - horizontal - sr;
+ }
}
else
{
* @param vertical
* DOCUMENT ME!
*/
- public void fastPaint(int vertical)
+ public void fastPaint(int vertical, boolean isresize)
{
if (gg == null)
{
int es = ranges.getEndSeq();
int transY = 0;
- if (vertical > 0) // scroll down
+ if (isresize)
{
- ss = es - vertical;
-
- if (ss < ranges.getStartSeq())
- { // ie scrolling too fast, more than a page at a time
- ss = ranges.getStartSeq();
- }
- else
+ if (vertical != 0)
{
transY = imgHeight - ((vertical + 1) * av.getCharHeight());
+ ss = es - vertical - ss;
}
}
- else if (vertical < 0) // scroll up
+ else
{
- es = ss - vertical;
+ if (vertical > 0) // scroll down
+ {
+ ss = es - vertical;
- if (es > ranges.getEndSeq())
+ if (ss < ranges.getStartSeq())
+ { // ie scrolling too fast, more than a page at a time
+ ss = ranges.getStartSeq();
+ }
+ else
+ {
+ transY = imgHeight - ((vertical + 1) * av.getCharHeight());
+ }
+ }
+ else if (vertical < 0) // scroll up
{
- es = ranges.getEndSeq();
+ es = ss - vertical;
+
+ if (es > ranges.getEndSeq())
+ {
+ es = ranges.getEndSeq();
+ }
}
}
public void propertyChange(PropertyChangeEvent evt)
{
// Respond to viewport range changes (e.g. alignment panel was scrolled)
- if (evt.getPropertyName().equals("startseq")
- || evt.getPropertyName().equals("endseq"))
+ if (evt.getPropertyName().equals("startseq"))
+ {
+ fastPaint((int) evt.getNewValue() - (int) evt.getOldValue(), false);
+ }
+ else if (evt.getPropertyName().equals("endseq"))
{
- fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
+ fastPaint((int) evt.getNewValue() - (int) evt.getOldValue(), true);
}
}
}
imgWidth -= (imgWidth % charWidth);
imgHeight -= (imgHeight % charHeight);
- BufferedImage newimg = new BufferedImage(imgWidth, imgHeight,
- BufferedImage.TYPE_INT_ARGB);
+ if ((imgWidth > 0) && (imgHeight > 0))
+ {
+ BufferedImage newimg = new BufferedImage(imgWidth, imgHeight,
+ BufferedImage.TYPE_INT_ARGB);
- gg = (Graphics2D) newimg.getGraphics();
- gg.setFont(av.getFont());
- gg.drawImage(img, null, 0, 0);
- img = newimg;
+ gg = (Graphics2D) newimg.getGraphics();
+ gg.setFont(av.getFont());
+ gg.drawImage(img, null, 0, 0);
+ img = newimg;
- if (horizontal != 0)
- {
- transX = (er - horizontal - sr) * charWidth;
- sr = er - horizontal - sr;
- }
- else if (vertical != 0)
- {
- transY = imgHeight - ((vertical + 1) * charHeight);
- ss = es - vertical - ss;
+ if (horizontal != 0)
+ {
+ transX = (er - horizontal - sr) * charWidth;
+ sr = er - horizontal - sr;
+ }
+ else if (vertical != 0)
+ {
+ transY = imgHeight - ((vertical + 1) * charHeight);
+ ss = es - vertical - ss;
+ }
}
}
else