se alguem puder me ajudar tenho o seguinte codigo.
public GDrawString(Graphics tela,Ponto pos,String texto,double angulo) {
fonte=tela.getFont();
rasc=Image.createImage(fonte.stringWidth(texto),fonte.getHeight());
this.texto=texto;
this.pos=pos;
this.tela=tela;
this.angulo=angulo;
mostrar_texto();
gerar_mat_rot();
rotacionar();
}
private void mostrar_texto(){
g=rasc.getGraphics();
g.setColor(0,0,0);
g.drawString(texto,0,0,Graphics.LEFT|Graphics.TOP);
}
lista=new Vector();
int lar=rasc.getWidth();
int alt=rasc.getHeight();
int pixel[]=new int[rasc.getWidth()*rasc.getHeight()];
rasc.getRGB(pixel,0,rasc.getHeight(),0,0,rasc.getWidth(),rasc.getHeight());
int temp[][]=new int[rasc.getWidth()][rasc.getHeight()];
int k=0;
for(int i=0;i<rasc.getHeight();i++)
for(int j=0;j<rasc.getHeight();j++) {
temp[j][i]=pixel[k];
k++;
}
for(int l=0;l<rasc.getHeight();l++)
for(int c=0;c<rasc.getWidth();c++) {
int r = (temp[c][l] & 0x00FF0000) >> 16;
int g = (temp[c][l] & 0x0000FF00) >> 8;
int b = (temp[c][l] & 0x000000FF);
if(r==0 && g==0 && b==0){
lista.addElement(new Ponto(c,l));
}
}
int tam=lista.size();
Ponto aux;
tela.setColor(0);
for(int i=0;i<tam;i++){
aux=(Ponto)lista.elementAt(i);
aux.set_X( (float)(aux.get_X()*mat[0][0]+aux.get_Y()*mat[0][1]) );
aux.set_Y( (float)(aux.get_X()*mat[1][0]+aux.get_Y()*mat[1][1]) );
aux.set_X(aux.get_X()+pos.get_X());
aux.set_Y(aux.get_Y()+pos.get_Y());
tela.drawLine(aux.get_intX(),aux.get_intY(),aux.get_intX(),aux.get_intY());
}
}
Eu crio uma imagem “Rasc” do tamanho do texto passado, depois exibo este texto na imagem criada, eu jah teste e se eu der um tela.drawimage(rasc,0,0,Graphics.HCENTER|Graphics.VCENTER) ela é exibida e parece o texto que coloquei nela.
bom o problema é no metodo rotacionar neste pedaço
rasc.getRGB(pixel,0,rasc.getHeight(),0,0,rasc.getWidth(),rasc.getHeight());
simplesmente da erro o codigo para, não entendo o pq, pois a imagem esta tudo ok
o erro passado é este:
java.lang.IllegalArgumentException:
at Grafico.GDrawString.rotacionar(GDrawString.java:65)
at Grafico.GDrawString.<init>(GDrawString.java:45)
at Desenho.Desenhar.mostrar_nomes(Desenhar.java:280)
at Desenho.Desenhar.paint(Desenhar.java:473)
at javax.microedition.lcdui.Canvas.callPaint(+85)
at javax.microedition.lcdui.Display.repaint(+82)
at javax.microedition.lcdui.Display.registerNewCurrent(+235)
at javax.microedition.lcdui.Display.screenChange(Display.java:1276)
at javax.microedition.lcdui.Display$DisplayManagerImpl.screenChange(Display.java:2858)
at com.sun.midp.lcdui.EmulEventHandler.screenChangeEvent(EmulEventHandler.java:183)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+492)
se alguem puder me dar uma dica do que estou fazendo errado, agradeço!