| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 
 | //w largeur de l'image, h heuteur de l'image, filename nom du fichier 
RAWimage(String filename, int w, int h){
 
	try{
 
		if (w < 6000 && h < 6000){
		fis = new FileInputStream(filename);
 
		datarray = new byte[w*h];
 
		fis.read(datarray);
 
		bufdatabyte = new DataBufferByte(datarray,w*h);
 
		initLUT();
 
		icm = new IndexColorModel(8,256,lut[0],lut[1],lut[2]);
 
		sm = new BandedSampleModel(DataBuffer.TYPE_BYTE,w,h,1);
 
		point = new Point(0,0);
 
		raster = Raster.createWritableRaster(sm,bufdatabyte,point);
 
		bufimage = new BufferedImage(w,h,BufferedImage.TYPE_BYTE_INDEXED,icm);
 
		bufimage.setData(raster);
 
		planim= new RenderedImageAdapter(bufimage);
		}
		else
                // MON PROBLEME EST ICI pour les image dont la résolution est supérieur a 6000*6000
		{
			int step,
			k=0,
			H= w/2,
			L= h/5;
			fis = new FileInputStream(filename);
                        // on crée un tableau 2 dimensions d'octet qui va enregistrer les octet necessaire pour afficher l'image 
 
			dataTab = new byte[H][L];
 
 // on crée un tableau 1 dimension qui va enregister une ligne d'octet de la taille de la largeur d'une ligne de l'image
 
			byte []tabPxl = new byte[L];
 
 
 
			for(int i = 0; i <H-1 ;i++)
			{	
						// on lit une premiere ligne d'octet
						fis.read(tabPxl);
                                               // on insere un octet ou pixel sur 4 afin de réduire l'image 
						for(step = 0; step<L-1;step+=4){
                                                       // on gère les débordement de tableau
							if(step == L-1){
								dataTab[i][L-1]= tabPxl[L-1];
							}
							else
 
							{// on insère les octet dans le tableau 2 dimensions
								dataTab[i][k]= tabPxl[step];
								k++;
                                                          // si la ligne est terminé on ré-initialise l'indice de parcours de la ligne du tableau 2 dimensions
								if(k == L-1){
									k =0;
								}
 
							}
 
						}
                                                // on saute 3 ligne d'octet afin d'avoir 1 pixel sur 3 en hauteur aussi
						for(int j = 0; j<2; j++){
							fis.read(tabPxl);
						}
 
			}
			// on insere notre tableau dans un buffer de byte
			bufdatabyte = new DataBufferByte(dataTab,L*H);
 
			initLUT();
 
			icm = new IndexColorModel(8,256,lut[0],lut[1],lut[2]);
 
			sm = new BandedSampleModel(DataBuffer.TYPE_BYTE,L,H,1);
 
			point = new Point(0,0);
 
			raster = Raster.createWritableRaster(sm,bufdatabyte,point);
 
			bufimage = new BufferedImage(L,H,BufferedImage.TYPE_BYTE_INDEXED,icm);
 
			bufimage.setData(raster);
 
			planim= new RenderedImageAdapter(bufimage);
 
		} | 
Partager