- // We'll have to draw the full size alignment in chunks, as an image of the\r
- // whole alignment requires too much memory\r
- // Max size depends on the font size, the following is a\r
- // guess at a size which works\r
- int maxSize = 2000 / av.getFont().getSize();\r
- BufferedImage block;\r
- int blockx = 0;\r
- int blocky = 0;\r
- int blockw = 0;\r
- int blockh = 0;\r
- int eRes = 0;\r
- int eSeq = 0;\r
-\r
- av.setRenderGaps(false);\r
-\r
- for (int sRes = 0, chunkx = 0; sRes < alwidth;\r
- sRes += maxSize, chunkx++)\r
- {\r
- if(resizeAgain)\r
- break;\r
-\r
- eSeq = 0;\r
- eRes += maxSize;\r
-\r
- if (eRes > alwidth)\r
- {\r
- eRes = alwidth;\r
- }\r
-\r
- for (int sSeq = 0, chunky = 0; sSeq < alheight;\r
- sSeq += maxSize, chunky++)\r
- {\r
- if (resizeAgain)\r
- break;\r
- eSeq += maxSize;\r
-\r
- if (eSeq > alheight)\r
- {\r
- eSeq = alheight;\r
- }\r
-\r
- blocky = 0;\r
- blockx = (int) ((float) sRes / (float) alwidth * width);\r
-\r
- block = new BufferedImage((eRes - sRes) * av.charWidth,\r
- (eSeq - sSeq) * av.charHeight,\r
- BufferedImage.TYPE_3BYTE_BGR);\r
- g = block.getGraphics();\r
-\r
- ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq,\r
- sRes, sSeq, 0);\r
-\r
- blockh = (int) ((float) (eSeq - sSeq) / (float) alheight * sequencesHeight) +\r
- 1;\r
- blockw = (int) ((float) (eRes - sRes) / (float) alwidth * width) +\r
- 1;\r
-\r
- blocky += (int) ((float) sSeq / (float) alheight * sequencesHeight);\r
-\r
- if(av.conservation!=null)\r
- {\r
- consensus = new BufferedImage( (eRes - sRes) * av.charWidth, 60,\r
- BufferedImage.TYPE_3BYTE_BGR);\r
- cg = consensus.getGraphics();\r
-\r
- ap.annotationPanel.drawGraph(cg, av.conservation,\r
- (eRes - sRes) * av.charWidth, 60, sRes, eRes);\r
-\r
- mg.drawImage(consensus, blockx, sequencesHeight, blockx + blockw,\r
-\r
- sequencesHeight + graphHeight, 0, 0,\r
- (eRes - sRes) * av.charWidth, 60, this);\r
- }\r
-\r
- mg.drawImage(block, blockx, blocky, blockx + blockw,\r
- blocky + blockh, 0, 0, block.getWidth(),\r
- block.getHeight(), null);\r
-\r
- block = null;\r
- repaint();\r
- }\r
-\r
-\r
- }\r