if(iContent<fullAreas.size()){
clearArea(iContent);
fullAreas.remove(iContent);
}
final Content content=getSkinnable().getContents().get(iContent);
int x0 = (int) content.getOrigin().getX() + (int) content.getArea().getX();
int y0 = (int) content.getOrigin().getY() + (int) content.getArea().getY();
int maxX = Math.min((int) content.getArea().getWidth(), getSkinnable().ledWidthProperty().intValue());
int maxY = Math.min((int) content.getArea().getHeight(), getSkinnable().ledHeightProperty().intValue());
visibleArea[iContent] = new Rectangle(Math.max(x0, 0), Math.max(y0, 0), maxX, maxY);
if (content.getType().equals(Content.Type.IMAGE)) {
byte[] sBytes=null;
if(iContent<fullAreas.size() && byteAreas!=null && byteAreas.get(iContent)!=null){
sBytes=byteAreas.get(iContent);
} else {
UtilHex img = new UtilHex();
img.convertsBmp(content.getBmpName(), 65, 190, true,true,true);
sBytes = img.getRawData();
byteAreas.add(iContent,sBytes);
img.resetRawData();
}
if (sBytes != null) {
final int levels = 3;
final int bmpHeight = UtilHex.bytes2int(new byte[]{sBytes[8],sBytes[9]});
final int tamLineaBMT = UtilHex.bytes2int(new byte[]{sBytes[20],sBytes[21],sBytes[22],sBytes[23]}) / bmpHeight / levels / 3; // en bytes
int pos = 32;
final int[][] area = new int[bmpHeight][tamLineaBMT * 8];
final int[] colors={(content.getColor().equals(MatrixColor.RED) || content.getColor().equals(MatrixColor.YELLOW) || content.getColor().equals(MatrixColor.RGB))?1:0,
(content.getColor().equals(MatrixColor.GREEN) || content.getColor().equals(MatrixColor.YELLOW) || content.getColor().equals(MatrixColor.RGB))?1:0,
(content.getColor().equals(MatrixColor.BLUE) || content.getColor().equals(MatrixColor.RGB))?1:0};
for (int j = 0; j < levels; j++) { // leds: [RED k=0]0-1-2-3, [GREEN k=1]0-10-20-30, [BLUE k=2] 0-100-200-300
for(int k=0; k<3; k++){ // 3 colors
for (int fila = 0; fila < bmpHeight; fila++) {
for (int i = 0; i < tamLineaBMT; i++) { // recorrido por cada byte de cada fila
BitSet bs=BitSet.valueOf(new byte[]{sBytes[pos++]});
for (int m = 0; m < 8; m++) {
area[fila][i * 8 + m] += (bs.get(7-m)?1:0)*Math.pow(10,k)*colors[k];
}
}
}
}
}
fullAreas.add(iContent,area);
}
else{
System.out.println("Error, image null: "+content.getBmpName());
fullAreas.add(iContent,null);
byteAreas.add(iContent,null);
}
} else if (content.getType().equals(Content.Type.TEXT)) {
MatrixPanel.DotFont dotF = new MatrixPanel.DotFont(content.getTxtContent(), content.getMatrixFont(), content.getFontGap().getGapWidth());
boolean[][] bDots = dotF.getDotString();
if (bDots != null) {
final int color=(content.getColor().equals(MatrixColor.RED)?3:
(content.getColor().equals(MatrixColor.GREEN)?30:
(content.getColor().equals(MatrixColor.BLUE)?300:
(content.getColor().equals(MatrixColor.YELLOW)?33:333))));
final int[][] area = new int[bDots.length][bDots[0].length];
for (int fila = 0; fila < bDots.length; fila++) {
for (int j = 0; j < bDots[fila].length; j++) {
area[fila][j] = ((bDots[fila][j]) ? color : 0);
}