Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 #ifdef G4VIS_BUILD_OI_DRIVER 26 27 27 /*----------------------------HEPVis---------- 28 /*----------------------------HEPVis----------------------------------------*/ 28 /* 29 /* */ 29 /* Node: SoImageWriter 30 /* Node: SoImageWriter */ 30 /* Author: Guy Barrand 31 /* Author: Guy Barrand */ 31 /* 32 /* */ 32 /*-------------------------------------------- 33 /*--------------------------------------------------------------------------*/ 33 34 34 // this : 35 // this : 35 #include <HEPVis/nodes/SoImageWriter.h> 36 #include <HEPVis/nodes/SoImageWriter.h> 36 37 37 #include <Inventor/errors/SoDebugError.h> 38 #include <Inventor/errors/SoDebugError.h> 38 #include <Inventor/elements/SoViewportRegionEl 39 #include <Inventor/elements/SoViewportRegionElement.h> 39 #include <Inventor/actions/SoGLRenderAction.h> 40 #include <Inventor/actions/SoGLRenderAction.h> 40 41 41 #include <HEPVis/SbGL.h> 42 #include <HEPVis/SbGL.h> 42 #include <HEPVis/SbPainterPS.h> 43 #include <HEPVis/SbPainterPS.h> 43 //#include <HEPVis/SbGIF.h> 44 //#include <HEPVis/SbGIF.h> 44 45 45 #include <stdlib.h> 46 #include <stdlib.h> 46 47 47 typedef struct { 48 typedef struct { 48 unsigned char red; 49 unsigned char red; 49 unsigned char green; 50 unsigned char green; 50 unsigned char blue; 51 unsigned char blue; 51 } Pixel; 52 } Pixel; 52 typedef unsigned char Uchar; 53 typedef unsigned char Uchar; 53 54 54 //static void getImagePixels(int,int,float*,in 55 //static void getImagePixels(int,int,float*,int&, 55 // Uchar*&,Uchar*&,Uch 56 // Uchar*&,Uchar*&,Uchar*&,Uchar*&); 56 57 57 static int sWidth = 0; 58 static int sWidth = 0; 58 static int sHeight = 0; 59 static int sHeight = 0; 59 static float* sImage = 0; 60 static float* sImage = 0; 60 static int getRGB(unsigned int,unsigned int,do 61 static int getRGB(unsigned int,unsigned int,double&,double&,double&); 61 62 62 SO_NODE_SOURCE(SoImageWriter) 63 SO_NODE_SOURCE(SoImageWriter) 63 ////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////// 64 void SoImageWriter::initClass ( 65 void SoImageWriter::initClass ( 65 ) 66 ) 66 ////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////////////// 67 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 68 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 68 { 69 { 69 static bool first = true; << 70 SO_NODE_INIT_CLASS(SoImageWriter,SoNode,"Node"); 70 if (first) { << 71 first = false; << 72 SO_NODE_INIT_CLASS(SoImageWriter,SoNode,"N << 73 } << 74 } 71 } 75 ////////////////////////////////////////////// 72 ////////////////////////////////////////////////////////////////////////////// 76 SoImageWriter::SoImageWriter( 73 SoImageWriter::SoImageWriter( 77 ) 74 ) 78 :fEnabled(FALSE) 75 :fEnabled(FALSE) 79 ,fStatus(FALSE) 76 ,fStatus(FALSE) 80 ////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////// 81 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 82 { 79 { 83 SO_NODE_CONSTRUCTOR(SoImageWriter); 80 SO_NODE_CONSTRUCTOR(SoImageWriter); 84 //SO_NODE_ADD_FIELD(format,(POST_SCRIPT)); 81 //SO_NODE_ADD_FIELD(format,(POST_SCRIPT)); 85 SO_NODE_ADD_FIELD(fileName,("out.ps")); 82 SO_NODE_ADD_FIELD(fileName,("out.ps")); 86 83 87 //SO_NODE_DEFINE_ENUM_VALUE(Format,POST_SCRI 84 //SO_NODE_DEFINE_ENUM_VALUE(Format,POST_SCRIPT); 88 //SO_NODE_DEFINE_ENUM_VALUE(Format,GIF); 85 //SO_NODE_DEFINE_ENUM_VALUE(Format,GIF); 89 86 90 //SO_NODE_SET_SF_ENUM_TYPE(format,Format); 87 //SO_NODE_SET_SF_ENUM_TYPE(format,Format); 91 } 88 } 92 ////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////////////// 93 SoImageWriter::~SoImageWriter ( 90 SoImageWriter::~SoImageWriter ( 94 ) 91 ) 95 ////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////////////// 96 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 93 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 97 { 94 { 98 } 95 } 99 ////////////////////////////////////////////// 96 ////////////////////////////////////////////////////////////////////////////// 100 void SoImageWriter::enable( 97 void SoImageWriter::enable( 101 ) 98 ) 102 ////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////////////// 103 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 100 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 104 { 101 { 105 fEnabled = TRUE; 102 fEnabled = TRUE; 106 } 103 } 107 ////////////////////////////////////////////// 104 ////////////////////////////////////////////////////////////////////////////// 108 void SoImageWriter::disable( 105 void SoImageWriter::disable( 109 ) 106 ) 110 ////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////////////// 111 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 108 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 112 { 109 { 113 fEnabled = FALSE; 110 fEnabled = FALSE; 114 } 111 } 115 ////////////////////////////////////////////// 112 ////////////////////////////////////////////////////////////////////////////// 116 SbBool SoImageWriter::getStatus( 113 SbBool SoImageWriter::getStatus( 117 ) const 114 ) const 118 ////////////////////////////////////////////// 115 ////////////////////////////////////////////////////////////////////////////// 119 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 116 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 120 { 117 { 121 return fStatus; 118 return fStatus; 122 } 119 } 123 ////////////////////////////////////////////// 120 ////////////////////////////////////////////////////////////////////////////// 124 void SoImageWriter::GLRender( 121 void SoImageWriter::GLRender( 125 SoGLRenderAction* aAction 122 SoGLRenderAction* aAction 126 ) 123 ) 127 ////////////////////////////////////////////// 124 ////////////////////////////////////////////////////////////////////////////// 128 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 125 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 129 { 126 { 130 fStatus = FALSE; 127 fStatus = FALSE; 131 //printf("debug : SoImageWriter::GLRender : 128 //printf("debug : SoImageWriter::GLRender : enabled : %d\n",fEnabled); 132 if(!fEnabled) return; 129 if(!fEnabled) return; 133 SbViewportRegion vpr = SoViewportRegionEleme 130 SbViewportRegion vpr = SoViewportRegionElement::get(aAction->getState()); 134 const SbVec2s& win = vpr.getWindowSize(); 131 const SbVec2s& win = vpr.getWindowSize(); 135 int w = win[0]; 132 int w = win[0]; 136 int h = win[1]; 133 int h = win[1]; 137 if((w*h)<=0) { 134 if((w*h)<=0) { 138 SoDebugError::postInfo("SoImageWriter::GLR 135 SoDebugError::postInfo("SoImageWriter::GLRender","null area window !"); 139 return; 136 return; 140 } 137 } 141 138 142 int x = 0; 139 int x = 0; 143 int y = 0; 140 int y = 0; 144 int s = 3 * w * h; 141 int s = 3 * w * h; 145 float* image = new float[s]; 142 float* image = new float[s]; 146 if(!image) return; 143 if(!image) return; 147 144 148 //printf("debug : SoImageWriter::GLRender : 145 //printf("debug : SoImageWriter::GLRender : %d %d %d %d\n",x,y,w,h); 149 146 150 //glReadPixels(x,y,w,h,GL_RGB,GL_UNSIGNED_BY 147 //glReadPixels(x,y,w,h,GL_RGB,GL_UNSIGNED_BYTE,image); Don't work ! 151 glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image); 148 glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image); 152 149 153 //Format fm = (Format)format.getValue(); 150 //Format fm = (Format)format.getValue(); 154 //if(fm==GIF) { 151 //if(fm==GIF) { 155 /* 152 /* 156 FILE* file = fopen(fileName.getValue().get 153 FILE* file = fopen(fileName.getValue().getString(),"wb"); 157 if(!file) { 154 if(!file) { 158 SoDebugError::postInfo("SoImageWriter::G 155 SoDebugError::postInfo("SoImageWriter::GLRender", 159 "can't open file \"%s\".",fileName.get 156 "can't open file \"%s\".",fileName.getValue().getString()); 160 } else { 157 } else { 161 int coln; 158 int coln; 162 Uchar* rs; 159 Uchar* rs; 163 Uchar* gs; 160 Uchar* gs; 164 Uchar* bs; 161 Uchar* bs; 165 Uchar* data; 162 Uchar* data; 166 getImagePixels(w,h,image,coln,rs,gs,bs,d 163 getImagePixels(w,h,image,coln,rs,gs,bs,data); 167 164 168 SbGIF::putBytesInStream(file,data,w,h,co 165 SbGIF::putBytesInStream(file,data,w,h,coln,rs,gs,bs); 169 166 170 delete [] data; 167 delete [] data; 171 168 172 if(rs) free(rs); 169 if(rs) free(rs); 173 if(gs) free(gs); 170 if(gs) free(gs); 174 if(bs) free(bs); 171 if(bs) free(bs); 175 172 176 fclose(file); 173 fclose(file); 177 174 178 fStatus = TRUE; 175 fStatus = TRUE; 179 } 176 } 180 } else { 177 } else { 181 */ 178 */ 182 179 183 SbPainterPS painterPS; 180 SbPainterPS painterPS; 184 painterPS.openFileForWriting(fileName.getV 181 painterPS.openFileForWriting(fileName.getValue().getString()); 185 if(!painterPS.getStream()) { 182 if(!painterPS.getStream()) { 186 SoDebugError::postInfo("SoImageWriter::G 183 SoDebugError::postInfo("SoImageWriter::GLRender", 187 "can't open file \"%s\".",fileName.get 184 "can't open file \"%s\".",fileName.getValue().getString()); 188 } else { 185 } else { 189 painterPS.setWindowSize(w,h); 186 painterPS.setWindowSize(w,h); 190 //painterPS.setBitsPerPixel(8); 187 //painterPS.setBitsPerPixel(8); 191 painterPS.setBitsPerPixel(4); 188 painterPS.setBitsPerPixel(4); 192 painterPS.beginTraversal(); 189 painterPS.beginTraversal(); 193 painterPS.clearColorBuffer(1.,1.,1.); 190 painterPS.clearColorBuffer(1.,1.,1.); 194 191 195 sWidth = w; 192 sWidth = w; 196 sHeight = h; 193 sHeight = h; 197 sImage = image; 194 sImage = image; 198 painterPS.putImageInStream((unsigned int 195 painterPS.putImageInStream((unsigned int)w,(unsigned int)h,getRGB); 199 196 200 painterPS.endTraversal(); 197 painterPS.endTraversal(); 201 198 202 painterPS.closeStream(); 199 painterPS.closeStream(); 203 200 204 fStatus = TRUE; 201 fStatus = TRUE; 205 } 202 } 206 //} 203 //} 207 delete [] image; 204 delete [] image; 208 205 209 } 206 } 210 /* 207 /* 211 ////////////////////////////////////////////// 208 ////////////////////////////////////////////////////////////////////////////// 212 void getImagePixels ( 209 void getImagePixels ( 213 int aWidth 210 int aWidth 214 ,int aHeight 211 ,int aHeight 215 ,float* aImage 212 ,float* aImage 216 ,int& aColorn 213 ,int& aColorn 217 ,Uchar*& aReds 214 ,Uchar*& aReds 218 ,Uchar*& aGreens 215 ,Uchar*& aGreens 219 ,Uchar*& aBlues 216 ,Uchar*& aBlues 220 ,Uchar*& aData 217 ,Uchar*& aData 221 ) 218 ) 222 ////////////////////////////////////////////// 219 ////////////////////////////////////////////////////////////////////////////// 223 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 220 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 224 { 221 { 225 aColorn = 0; 222 aColorn = 0; 226 aReds = 0; 223 aReds = 0; 227 aGreens = 0; 224 aGreens = 0; 228 aBlues = 0; 225 aBlues = 0; 229 aData = 0; 226 aData = 0; 230 if( (aWidth * aHeight) <=0) return; 227 if( (aWidth * aHeight) <=0) return; 231 int size = 256; 228 int size = 256; 232 Uchar* rs = (Uchar*)malloc(size * sizeof(Uch 229 Uchar* rs = (Uchar*)malloc(size * sizeof(Uchar)); 233 Uchar* gs = (Uchar*)malloc(size * sizeof(Uch 230 Uchar* gs = (Uchar*)malloc(size * sizeof(Uchar)); 234 Uchar* bs = (Uchar*)malloc(size * sizeof(Uch 231 Uchar* bs = (Uchar*)malloc(size * sizeof(Uchar)); 235 Uchar* data = new Uchar[aWidth * aHeight]; 232 Uchar* data = new Uchar[aWidth * aHeight]; 236 if( !rs || !gs || !bs || !data ) { 233 if( !rs || !gs || !bs || !data ) { 237 if(rs) free(rs); 234 if(rs) free(rs); 238 if(gs) free(gs); 235 if(gs) free(gs); 239 if(bs) free(bs); 236 if(bs) free(bs); 240 delete [] data; 237 delete [] data; 241 return; 238 return; 242 } 239 } 243 int pixeln = 0; 240 int pixeln = 0; 244 int row,col; 241 int row,col; 245 Uchar red,green,blue; 242 Uchar red,green,blue; 246 Uchar ored = 0,ogreen = 0,oblue = 0; 243 Uchar ored = 0,ogreen = 0,oblue = 0; 247 float* pimag = aImage; 244 float* pimag = aImage; 248 Uchar* pdata = 0; 245 Uchar* pdata = 0; 249 Uchar index = 0; 246 Uchar index = 0; 250 int status = 0; 247 int status = 0; 251 for(row=0;row<aHeight;row++) { 248 for(row=0;row<aHeight;row++) { 252 pdata = data + (aHeight - 1 - row) * aWidt 249 pdata = data + (aHeight - 1 - row) * aWidth; 253 for(col=0;col<aWidth;col++){ 250 for(col=0;col<aWidth;col++){ 254 red = (Uchar)(255 * (*pimag));pimag++; 251 red = (Uchar)(255 * (*pimag));pimag++; 255 green = (Uchar)(255 * (*pimag));pimag++; 252 green = (Uchar)(255 * (*pimag));pimag++; 256 blue = (Uchar)(255 * (*pimag));pimag++; 253 blue = (Uchar)(255 * (*pimag));pimag++; 257 //printf("debug : %d %d : %d %d %d\n",ro 254 //printf("debug : %d %d : %d %d %d\n",row,col,red,green,blue); 258 if( (pixeln==0) || (red!=ored) || (green 255 if( (pixeln==0) || (red!=ored) || (green!=ogreen) || (blue!=oblue) ){ 259 // Search exact color : 256 // Search exact color : 260 int found = 0; 257 int found = 0; 261 for(int count=0;count<pixeln;count++){ 258 for(int count=0;count<pixeln;count++){ 262 if( (red==rs[count]) && (green==gs[c 259 if( (red==rs[count]) && (green==gs[count]) && (blue==bs[count]) ){ 263 found = 1; 260 found = 1; 264 index = count; 261 index = count; 265 break; 262 break; 266 } 263 } 267 } 264 } 268 if(found==0){ 265 if(found==0){ 269 if(pixeln>=256) { 266 if(pixeln>=256) { 270 // We can't store more than 256 on 267 // We can't store more than 256 on an Uchar. 271 // Search closest color : 268 // Search closest color : 272 int dr,dg,db; 269 int dr,dg,db; 273 int PRECISION = 20; 270 int PRECISION = 20; 274 int closest = 0; 271 int closest = 0; 275 for(int count=0;count<pixeln;count 272 for(int count=0;count<pixeln;count++){ 276 dr = red - rs[count];dr = dr<0 273 dr = red - rs[count];dr = dr<0 ? -dr : dr; 277 dg = green - gs[count];dg = dg<0 274 dg = green - gs[count];dg = dg<0 ? -dg : dg; 278 db = blue - bs[count];db = db<0 275 db = blue - bs[count];db = db<0 ? -db : db; 279 if( (dr<=PRECISION) && (dg<=PREC 276 if( (dr<=PRECISION) && (dg<=PRECISION) && (db<=PRECISION) ){ 280 closest = 1; 277 closest = 1; 281 index = count; 278 index = count; 282 break; 279 break; 283 } 280 } 284 } 281 } 285 if(closest==0) { 282 if(closest==0) { 286 index = 0; 283 index = 0; 287 status = 1; 284 status = 1; 288 } 285 } 289 } else { 286 } else { 290 if(pixeln>=size){ 287 if(pixeln>=size){ 291 size += 256; 288 size += 256; 292 rs = (Uchar*)realloc(rs,size * s 289 rs = (Uchar*)realloc(rs,size * sizeof(Uchar)); 293 gs = (Uchar*)realloc(gs,size * s 290 gs = (Uchar*)realloc(gs,size * sizeof(Uchar)); 294 bs = (Uchar*)realloc(bs,size * s 291 bs = (Uchar*)realloc(bs,size * sizeof(Uchar)); 295 if( !rs || !gs || !bs ) { 292 if( !rs || !gs || !bs ) { 296 if(rs) free(rs); 293 if(rs) free(rs); 297 if(gs) free(gs); 294 if(gs) free(gs); 298 if(bs) free(bs); 295 if(bs) free(bs); 299 delete [] data; 296 delete [] data; 300 return; 297 return; 301 } 298 } 302 } 299 } 303 //printf("debug : SoImageWriter pi 300 //printf("debug : SoImageWriter pixeln %d : %d %d %d\n", 304 // pixeln,red,green,blue); 301 // pixeln,red,green,blue); 305 rs[pixeln] = red; 302 rs[pixeln] = red; 306 gs[pixeln] = green; 303 gs[pixeln] = green; 307 bs[pixeln] = blue; 304 bs[pixeln] = blue; 308 index = pixeln; 305 index = pixeln; 309 pixeln++; 306 pixeln++; 310 } 307 } 311 } 308 } 312 } 309 } 313 *pdata = index; 310 *pdata = index; 314 pdata++; 311 pdata++; 315 ored = red; 312 ored = red; 316 ogreen = green; 313 ogreen = green; 317 oblue = blue; 314 oblue = blue; 318 } 315 } 319 } 316 } 320 if(status==1) 317 if(status==1) 321 printf("SoImageWriter : more than 256 colo 318 printf("SoImageWriter : more than 256 colors in picture ; some colors approximated.\n"); 322 aColorn = pixeln; 319 aColorn = pixeln; 323 aReds = rs; 320 aReds = rs; 324 aGreens = gs; 321 aGreens = gs; 325 aBlues = bs; 322 aBlues = bs; 326 aData = data; 323 aData = data; 327 } 324 } 328 */ 325 */ 329 ////////////////////////////////////////////// 326 ////////////////////////////////////////////////////////////////////////////// 330 int getRGB( 327 int getRGB( 331 unsigned int aX 328 unsigned int aX 332 ,unsigned int aY 329 ,unsigned int aY 333 ,double& aRed 330 ,double& aRed 334 ,double& aGreen 331 ,double& aGreen 335 ,double& aBlue 332 ,double& aBlue 336 ) 333 ) 337 ////////////////////////////////////////////// 334 ////////////////////////////////////////////////////////////////////////////// 338 // OpenGL image is from down to up. 335 // OpenGL image is from down to up. 339 // PS image is up to down. 336 // PS image is up to down. 340 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 337 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 341 { 338 { 342 float* pimag = sImage + 3 * (sWidth * (sHeig 339 float* pimag = sImage + 3 * (sWidth * (sHeight - 1 - aY) + aX); 343 aRed = *pimag;pimag++; 340 aRed = *pimag;pimag++; 344 aGreen = *pimag;pimag++; 341 aGreen = *pimag;pimag++; 345 aBlue = *pimag;pimag++; 342 aBlue = *pimag;pimag++; 346 return 1; 343 return 1; 347 } 344 } >> 345 >> 346 #endif 348 347