/** * function main starts here **/ int main() { /** * define test1 and output as BMP image **/ BMP test1; BMP output; /** * loads "in.bmp" into test1. **/ test1.readFromFile("in.bmp"); //test1.readFromFile("in.bmp"); /** * loads "in.bmp" into output. **/ output.readFromFile("in.bmp"); /** * call function reverse to rotate the test1 by 180 degree.and * load the reversed image to image output **/ output = reverse(test1, test1.tellWidth(), test1.tellHeight(), output); /**writes the image output to the disk **/ output.writeToFile("out.bmp"); return 0; }
/** @function Get4Pixels16Bit reads four consecutive pixels of the specified row started from given column and writes they to the two registers out_BG and out_RA. Uses 16 bit per channel @param in_img is a input image @param in_row_idx is an index of a row to read pixels @param in_col_idx ia an index of a column with a first pixel @param out_BG is a pointer to a 128bit register to store blue and green channels for the pixels four consecutive pixels in format BBBB GGGG. Order of pixels is [0, 1, 2, 3] @param out_RA is a pointer to a 128bit register to store red and alpha channels for the pixels four consecutive pixels in format RRRR AAAA. Order of pixels is [0, 1, 2, 3] */ inline void Get4Pixels16Bit(BMP &in_img, int in_row_idx, int in_col_idx, __m128i *out_BG, __m128i *out_RA) { // read four consecutive pixels RGBApixel pixel0 = in_img.GetPixel(in_col_idx, in_row_idx); RGBApixel pixel1 = in_img.GetPixel(in_col_idx + 1, in_row_idx); RGBApixel pixel2 = in_img.GetPixel(in_col_idx + 2, in_row_idx); RGBApixel pixel3 = in_img.GetPixel(in_col_idx + 3, in_row_idx); // write two pixel0 and pixel2 to the p02 and other to the p13 __m128i p02 = _mm_setr_epi32(*(reinterpret_cast<int*>(&pixel0)), *(reinterpret_cast<int*>(&pixel2)), 0, 0); __m128i p13 = _mm_setr_epi32(*(reinterpret_cast<int*>(&pixel1)), *(reinterpret_cast<int*>(&pixel3)), 0, 0); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * convert BGRA BGRA BGRA BGRA * to BBBB GGGG RRRR AAAA * order of pixels corresponds to the digits in the name of variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ // BGRA BGRA 0000 0000 + BGRA BGRA 0000 0000 -> BBGG RRAA BBGG RRAA __m128i p0123 = _mm_unpacklo_epi8(p02, p13); // extract BBGG RRAA 0000 0000 of pixel2 and pixel3 __m128i p23xx = _mm_unpackhi_epi64(p0123, _mm_setzero_si128()); // BBGG RRAA XXXX XXXX + BBGG RRAA 0000 0000 -> BBBB GGGG RRRR AAAA // X denotes unused characters __m128i p0123_8bit = _mm_unpacklo_epi16(p0123, p23xx); // extend to 16bit *out_BG = _mm_unpacklo_epi8(p0123_8bit, _mm_setzero_si128()); *out_RA = _mm_unpackhi_epi8(p0123_8bit, _mm_setzero_si128()); }
bool Image::readFromBMPFile(const std::string & inputFileName) { bool success = true; // use BMP object to read image BMP inputImage; success = inputImage.ReadFromFile(inputFileName.c_str() ); if( success ) { // allocate memory for image (deleting old, if exists) m_numRows = inputImage.TellHeight(); m_numCols = inputImage.TellWidth(); if( m_pixels != NULL ) // deallocate old memory { delete [] m_pixels; } m_pixels = new double[m_numRows * m_numCols]; // copy pixels for( int r = 0; r < m_numRows; ++r ) { for( int c = 0; c < m_numCols; ++c ) { RGBApixel pixelVal = inputImage.GetPixel(c, r); double val = (double) pixelVal.Blue + (double) pixelVal.Green + (double) pixelVal.Red; val = (val / 3.0 + 0.5); m_pixels[r * m_numCols + c] = val; } } } return success; }
inline float CubicFilter(int x, int y, const int Radius) { const int DatSize = POW2((Radius << 1) + 1); float *Dat = new float[DatSize]; Cint2 Offset = {x-Radius, y-Radius}; float Accum = 0.0f; int Denom = 0; int w = Bmp.TellWidth(); int h = Bmp.TellHeight(); for(int Cpt = 0; Cpt < DatSize; Cpt++){ if(Offset.x >= 0 && Offset.x < w && Offset.y >= 0 && Offset.y < h){ Accum += RGBMIXER(Offset.x, Offset.y); Denom++; } Offset.x++; if(Offset.x - x > Radius){ Offset.x = x-Radius; Offset.y++; } } SAFE_DELETE_ARRAY(Dat); return Accum / (float)Denom; }
//store output data to disk void writeFile(BMP img, int id, int iter){ string name; stringstream sstm; if(id==1){ for (short i =0; i<HEIGHT; i++){ for (short j = 0; j<WIDTH; j++){ img(i,j)->Red = (label[i][j] +3)*42; //normalize to [0, 255] img(i,j)->Green = (label[i][j] +3)*42; img(i,j)->Blue = (label[i][j] +3)*42; } } sstm << iter << "label" <<".bmp"; name = sstm.str(); img.WriteToFile(name.c_str()); printf("\nlabel image stored"); } else{ //zeroLevelSet for (short i =0; i<HEIGHT; i++){ for (short j = 0; j<WIDTH; j++){ img(i,j)->Red = zeroLevelSet[i][j]; img(i,j)->Green = zeroLevelSet[i][j]; img(i,j)->Blue = zeroLevelSet[i][j]; } } sstm << iter << "zero" <<".bmp"; name = sstm.str(); img.WriteToFile(name.c_str()); printf("\nzero image stored\n"); } }
static cell AMX_NATIVE_CALL n_FSetImageSize( AMX* amx, cell* params ){ posx = params[1]; posy = params[2]; GlobalImage.CreateStandardColorTable(); GlobalImage.SetSize(posx,posy); return 1; }
// filename is a BMP file CImage::CImage(const char * filename, int colors) { BMP bmp; bmp.ReadFromFile(filename); init(bmp.TellWidth(), bmp.TellHeight(), colors); // convert pixels to float values for (int col = 0; col < m_width; col++) { for (int row = 0; row < m_height; row++) { RGBApixel* pixel = bmp(col, row); // m_color == 1 means grayscale... so all components should be equal // (i.e. Red = Green = Blue) if (m_color == 1) setValue(row, col, 0, (float) pixel->Red); else if (m_color == 3) { setValue(row, col, 0, (float) pixel->Red); setValue(row, col, 1, (float) pixel->Green); setValue(row, col, 2, (float) pixel->Blue); } } } }
// creates a BMP from a CImage // assumes all float values have already been scaled to [0.0, 255.0] BMP * CImage::toBmp() { BMP * bmp = new BMP(); bmp->SetSize(m_width, m_height); // for smaller output file size bmp->SetBitDepth(8); // 8-bit bitmaps need a color table CreateGrayscaleColorTable(*bmp); for (int col = 0; col < m_width; col++) { for (int row = 0; row < m_height; row++) { // Output is grayscale, so R, G, and B components are equal. // ScaleAndDisplayDisparityValues() et. al. in stereo.cpp have already // scaled all float pixel values to [0, 255]. ebmpBYTE byteVal = (ebmpBYTE) getValue(row, col, 0); (* bmp)(col, row)->Red = byteVal; (* bmp)(col, row)->Green = byteVal; (* bmp)(col, row)->Blue = byteVal; } } return bmp; }
Color Sphere::calculateTextureFromMaterial(Point intercept, bool diagnosticEnabled) { BMP* texture; texture = &this->texture; int height = texture->TellHeight(); int width = texture->TellWidth(); Vector vectorToIntercept = intercept - origin; vectorToIntercept.normalize(); double u = 0.5 + atan2(vectorToIntercept.z,vectorToIntercept.x) / 2 / 3.1415; double v = 0.5 - asin(vectorToIntercept.y) / 3.1415; int pixelX = abs((int)(u * width)); int pixelY = abs((int)(v * height)); pixelX %= width; pixelY %= height; Color matColor; if(diagnosticEnabled) { matColor = Color(v,0,sin(u * 3.1415)); } else { matColor.r = texture->GetPixel(pixelX,pixelY).Red/255.f; matColor.g = texture->GetPixel(pixelX,pixelY).Green/255.f; matColor.b = texture->GetPixel(pixelX,pixelY).Blue/255.f; } return matColor; }
void writeFile(BMP img, int id){ if(id == 1){ //label for (int i =0; i<HEIGHT; i++){ for (int j = 0; j<WIDTH; j++){ img(i,j)->Red = (label[i][j] +3)*42; //normalize to [0, 255] img(i,j)->Green = (label[i][j] +3)*42; img(i,j)->Blue = (label[i][j] +3)*42; } } img.WriteToFile("output label.bmp"); printf("\nlabel image stored"); } else{ //zeroLevelSet for (int i =0; i<HEIGHT; i++){ for (int j = 0; j<WIDTH; j++){ //printf(" (%i,%i) ", i, j); img(i,j)->Red = zeroLevelSet[i][j]; img(i,j)->Green = zeroLevelSet[i][j]; img(i,j)->Blue = zeroLevelSet[i][j]; } } img.WriteToFile("output zero.bmp"); printf("\nzero image stored\n"); } }
int main() { BMP srcBMP; srcBMP.ReadFromFile("../../../../input/lena.bmp"); BMP dstBMP(srcBMP); int width =srcBMP.TellWidth(); int height=srcBMP.TellHeight(); int size =width*height; unsigned char* srcData= new unsigned char[width*height]; unsigned char* dstData= new unsigned char[width*height]; BMP2graydata(srcBMP, srcData); //sobel( srcData, dstData, width, height); //------- run sobel on nmc -------------- // Access and loading program to nm-board C_PC_Connector_mc5103 Connector(PROGRAM); if (!Connector.isConnected()){ printf("Connection to mc5103 error!"); return -1; } int handshake= Connector.Sync(0xC0DE0086); if (handshake!=0xC0DE6406){ printf("Handshake with mc5103 error!"); return -1; } int ok; ok=Connector.Sync(width); // Send width to nmc ok=Connector.Sync(height); // Send height to nmc ok=Connector.Sync(0); // Get status of memory allocation from nm if (ok!=0x600DB00F){ printf("Memory allocation error!"); return -1; } unsigned srcAddr=Connector.Sync(0); unsigned dstAddr=Connector.Sync(0); Connector.WriteMemBlock((unsigned*)srcData, srcAddr, size/4); // Send data to NMC Connector.Sync(0); // Barrier sync before call of Sobel filter on NMC //... wait while sobel is runing on board unsigned t=Connector.Sync(0); // Barrier sync. Wait until Sobel filter is finished Connector.ReadMemBlock ((unsigned*)dstData, dstAddr, size/4); // Recieve result data from NMC //---------------------- graydata2BMP(dstData, dstBMP); dstBMP.WriteToFile("dst.bmp"); delete srcData; delete dstData; return 0; }
static cell AMX_NATIVE_CALL n_GetImageBAtPos( AMX* amx, cell* params ){ amx_StrParam(amx,params[1],tmp); BMP Image; Image.ReadFromFile(tmp); posx = params[2]; posy = params[3]; return Image(posx,posy)->Blue; }
void Camera::raytrace(Node *node, const std::vector<Light*>& lights) { BMP output; output.SetSize(width,height); output.SetBitDepth(24); for(int i = 0; i < width; i++) { for(int j = 0; j < height; j++) { output(i,j)->Red = 0; output(i,j)->Green = 0; output(i,j)->Blue = 0; } } float aRatio = (float)width/height; glm::vec3 xAxis = glm::cross(fwd, up); glm::vec3 yAxis = glm::cross(xAxis, fwd); float xFov = std::atan(std::tan(yFov) * aRatio); xAxis *= std::tan(xFov/2) * glm::length(fwd) / glm::length(xAxis); yAxis *= std::tan(yFov/2) * glm::length(fwd) / glm::length(yAxis); for(unsigned int j = 0; j < height; j++) { std::cout << "\rline " << j << std::flush; #pragma omp parallel for for(unsigned int i = 0; i < width; i++) { // indirect illumination glm::vec3 color(0); for(int d = 0; d < density; d++) { float x = (float(i) + float(rand())/RAND_MAX) / width; float y = (float(j) + float(rand())/RAND_MAX) / height; std::cout << "dbg " << fwd << " " << xAxis << " " << yAxis << "\n"; glm::vec3 dir = glm::normalize(fwd + (2*x-1)*xAxis + (1-2*y)*yAxis); Ray ray(pos, dir, rayCount, true); glm::vec4 dirCol = rayIter(ray, node, lights); glm::vec3 mcCol; if(dirCol[3] < 1 && mcIter > 0) { for(int w = 0; w < mcIter; w++) mcCol += rayIter(ray,node); mcCol /= float(mcIter); } else { dirCol[3] = 1; } color += (1.f - dirCol[3])*mcCol + dirCol[3]*glm::vec3(dirCol); } color /= float(density); output(i,j)->Red = 255.0*glm::clamp(color[0],0.f,1.f); output(i,j)->Green = 255.0*glm::clamp(color[1],0.f,1.f); output(i,j)->Blue = 255.0*glm::clamp(color[2],0.f,1.f); } } output.WriteToFile(outFile.c_str()); exit(0); }
bool Image::writeToBMPFile(const std::string & outputFileName) { bool success = true; if( m_pixels != NULL ) { // create bitmap image BMP outputImage; outputImage.SetSize(m_numCols, m_numRows); outputImage.SetBitDepth( 24 ); double maxVal = m_pixels[0]; double minVal = m_pixels[0]; // Maximum and minimum values for( int i = 1; i < m_numRows * m_numCols; ++i ) { if( m_pixels[i] > maxVal ) { maxVal = m_pixels[i]; } if( m_pixels[i] <= minVal ) { minVal = m_pixels[i]; } } for( int r = 0; r < m_numRows; ++r ) { for( int c = 0; c < m_numCols; ++c ) { // get pixel value and clamp between 0 and 255 double val = 255.0 * (m_pixels[r * m_numCols + c] - minVal) / (maxVal - minVal); if( val < 0 ) { val = 0; } if( val > 255 ) { val = 255; } // set output color based on mapping RGBApixel pixelVal; pixelVal.Blue = (int)val; pixelVal.Green = (int)val; pixelVal.Red = (int)val; outputImage.SetPixel(c, r, pixelVal); } } // write to file success = outputImage.WriteToFile( outputFileName.c_str() ); } else { success = false; } return success; }
int main(int argc, char * argv[]) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " <font name> <font image>...\n"; return 1; } // Average symbol information std::map<char, OCR::Font::Symbol> average; // Image BMP img; // Load a non-existent font OCR::Font bogus("BOGUS"); // Open file for output std::string outFileName = argv[1]; outFileName = "font/" + outFileName + ".font"; std::ofstream outFile(outFileName.c_str()); // Load each line and read its statistics for (int fileNum = 2; fileNum < argc; ++fileNum) { // Create line img.ReadFromFile(argv[fileNum]); OCR::Line line(img, bogus); // Create vector for symbol info std::vector<OCR::Font::Symbol> symbols; symbols.reserve(ALPHABET.size()); // Do the reading line.Read(&symbols); // Loop through and add to the "average" std::vector<OCR::Font::Symbol>::iterator itr = symbols.begin(); for (unsigned charIndex = 0; itr != symbols.end() && charIndex < ALPHABET .size(); ++itr, ++charIndex) { average[ALPHABET[charIndex]] += *itr; } } for (std::map<char, OCR::Font::Symbol>::iterator itr = average.begin(); itr != average.end(); ++itr) { // Divide all statistics by number of lines read itr->second /= (argc - 2); // Print the character and its statistics to the file outFile << itr->first << ' ' << itr->second << std::endl; } outFile.close(); return 0; }
static cell AMX_NATIVE_CALL n_SetImageSize( AMX* amx, cell* params ){ amx_StrParam(amx,params[1],tmp); posx = params[2]; posy = params[3]; BMP Image; Image.ReadFromFile(tmp); Image.CreateStandardColorTable(); Image.SetSize(posx,posy); return Image.WriteToFile(tmp); }
/**Load images by list of files 'file_list' and store them in 'data_set' */ void LoadImages(const TFileList& file_list, TDataSet* data_set) { for (size_t img_idx = 0; img_idx < file_list.size(); ++img_idx) { // Create image BMP* image = new BMP(); // Read image from file image->ReadFromFile(file_list[img_idx].first.c_str()); // Add image and it's label to dataset data_set->push_back(make_pair(image, file_list[img_idx].second)); } }
void outputImage(const char *filename = "out.bmp", const char *rawfilename = "out.raw") { //raw output target->ToRawFile(rawfilename); //bmp output BMP out; target->ToBMP(out); out.WriteToFile(filename); }
// same as above, but highlights a range of depths in red, // and, colors all depths outside that range black in refImage // highlight_low and high are values in [1,100] BMP * CImage::toHighlightedBmp(int highlight_low, int highlight_high, BMP * refBmp) { // scale range to be highlighted to [0,255] highlight_low = ((float) highlight_low) * 255.0/100.0 - 2.55; highlight_high = ((float) highlight_high) * 255.0/100.0; BMP * bmp = new BMP(); bmp->SetSize(m_width, m_height); // for smaller output file size bmp->SetBitDepth(8); // 8-bit bitmaps need a color table CreateGrayscaleColorTable(*bmp); // add red to the color table RGBApixel highlightColor; highlightColor.Red = 255; highlightColor.Green = 0; highlightColor.Blue = 0; highlightColor.Alpha = 0; bmp->SetColor(highlight_low, highlightColor); // copy pixels to bmp for (int col = 0; col < m_width; col++) { for (int row = 0; row < m_height; row++) { float pixel = getValue(row, col, 0); if (highlight_low <= pixel && pixel <= highlight_high) { (* bmp)(col, row)->Red = 255; (* bmp)(col, row)->Green = 0; (* bmp)(col, row)->Blue = 0; } else { // Output is grayscale, so R, G, and B components are equal. // ScaleAndDisplayDisparityValues() et. al. in stereo.cpp have already // scaled all float pixel values to [0, 255]. ebmpBYTE byteVal = (ebmpBYTE) pixel; (* bmp)(col, row)->Red = byteVal; (* bmp)(col, row)->Green = byteVal; (* bmp)(col, row)->Blue = byteVal; // color non-highlighted areas black in refBmp (* refBmp)(col, row)->Red = 0; (* refBmp)(col, row)->Green = 0; (* refBmp)(col, row)->Blue = 0; } } } return bmp; }
//more specific default ctor for Quadtree // parameters: &BMP img - image passed that will be the foundation // for the tree // d - variable that tells the dimensions of the Quadtree::Quadtree(BMP & img, int d){ //check if d is in proper range if ((d>img.TellWidth())||(d>img.TellHeight())||(d<=0)) root=NULL; //when d is in proper range then make root point to a node and //do the BuildTree function else{ root=new QuadtreeNode(d); buildTree(img, d); } }
// test -- tripleRotate() void testTripleRotate() { int width, height; List<RGBApixel> pixelList; setup("in_02.bmp", pixelList, width, height); pixelList.tripleRotate(4); BMP imgOut; buildImage(imgOut, pixelList, width, height); imgOut.WriteToFile("rotated.bmp"); }
void w2f(GlobalMap &globalMap, int i, int j, int size=1025) { char fileName[6] = {'0','0','.','b','m','p'}; fileName[0]=i+48; fileName[1]=j+48; short z; RGBApixel color; BMP image; image.SetSize(size,size); image.SetBitDepth(16); for(int y=0; y<size; y++) { for(int x=0; x<size; x++) { z= globalMap.getLocalMap(i,j)->getHeight(x,y); if(z<0) { color.Red=0; color.Green=0; color.Blue=(z+32768)/129; color.Alpha=0; } if(z>=0 && z<20000) { color.Red=0; color.Green=z/134+100; color.Blue=0; color.Alpha=0; } if(z>=20000 && z<25000) { color.Red=(z-20000)/500+200; color.Green=(z-20000)/500+200; color.Blue=(z-20000)/500+200; color.Alpha=0; } if(z>=25000) { color.Red=255; color.Green=255; color.Blue=255; color.Alpha=0; } image.SetPixel(x,y, color); } } image.WriteToFile(fileName); }
void copy(BMP & InImg, BMP & OutImg, int xPos, int yPos) { // copy image to larger final picture so that the InImg is placed in row i, column j of OutImg int width = InImg.TellWidth(); RGBApixel curPixel; for (int i = 0; i < width; i++) { for (int j = 0; j < width; j++) { curPixel = InImg.GetPixel(i, j); OutImg.SetPixel(xPos * width + i, yPos * width + j, curPixel); } } }
void BitmapRawConverter::pixelsToBitmap(char *outFilename) { BMP out; out.SetSize(width, height); out.SetBitDepth(24); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { out.SetPixel(i, j, getPixel(i,j)); } } out.WriteToFile(outFilename); }
d_surf * _surf_load_bmp(const char * filename, const char * surfname, REAL minz, REAL maxz, REAL startX, REAL startY, REAL stepX, REAL stepY) { writelog(LOG_MESSAGE, "loading surface from BMP file %s",filename); BMP bmp; if (bmp.ReadFromFile(filename) == false) { writelog(LOG_ERROR,"Error loading surface from bitmap!"); return NULL; } size_t NN = bmp.TellWidth(); size_t MM = bmp.TellHeight(); extvec * coeff = create_extvec( NN*MM, 0, 0, 0); size_t i,j; double gray_color; double alpha; for (j = 0; j < MM; j++) { for (i = 0; i < NN; i++) { gray_color = bmp(i,j)->Red * 0.299 + bmp(i,j)->Green * 0.587 + bmp(i,j)->Blue * 0.114; alpha = bmp(i,j)->Alpha; if (alpha == 255) (*coeff)(i + (MM-1-j)*NN) = undef_value; else { if (minz != maxz) (*coeff)(i + (MM-1-j)*NN) = (maxz-minz)*gray_color/REAL(255) + minz; else (*coeff)(i + (MM-1-j)*NN) = gray_color; } } } d_grid * grd = create_grid(startX, startX + stepX*(NN-1), stepX, startY, startY + stepY*(MM-1), stepY); d_surf * res = create_surf(coeff, grd); if (surfname) res->setName(surfname); else { char * name = get_name(filename); res->setName(name); sstuff_free_char(name); } return res; };
void CopyBMP( BMP& Input , BMP& Output ) { Output.SetSize( Input.TellWidth() , Input.TellHeight() ); for( int j=0 ; j < Input.TellHeight() ; j++ ) { for( int i=0 ; i < Input.TellWidth() ; i++ ) { *Output(i,j) = *Input(i,j); } } return; }
void BMP2graydata(BMP& bmp, unsigned char* data){ int k=0; int width =bmp.TellWidth(); int height=bmp.TellHeight(); for (int i=0; i<height; i++){ for (int j=0; j<width; j++){ RGBApixel pix=bmp.GetPixel(j,i ); data[k++]=pix.Blue; //src[k++]= 0.2126 * pix.Red + 0.7152 * pix.Green + 0.0722 * pix.Blue; } } }
//negatyw z obrazu void negatyw(BMP& obraz) { for( int j=0 ; j < obraz.TellHeight() ; j++) { for( int i=0 ; i < obraz.TellWidth() ; i++) { obraz(i,j)->Red = 255 - obraz(i,j)->Red; obraz(i,j)->Green = 255 - obraz(i,j)->Green; obraz(i,j)->Blue = 255 - obraz(i,j)->Blue; } } //return 0; }
int main(int argc, char** argv) { if (argc != 2) { cout << "Incorrect input. Please enter the name of the configuration file." << endl; return -1; } Reader * config = new Reader(argv[1]); int width = config->getWIDTH(); int height = config->getHEIGHT(); int x = config->getX(); int y = config->getY(); int z = config->getZ(); Camera * rayGenerator = new Camera(config->getEYEP(), config->getVDIR(), config->getUVEC(), config->getFOVY(), width, height); BMP output; output.SetSize(width, height); output.SetBitDepth(24); Raymarch * raymarch = new Raymarch(config->getVB(), rayGenerator, config->getEYEP(), config->getMRGB(), config->getBRGB(), config->getLCOL(), config->getLPOS(), config->getOFST()); for (int w = 0; w < width; w++) { cout << "Rendering: " << (float) w/width << endl; for (int h = 0; h < height; h++) { /* // Ray direction color test output(w,h)->Red = abs(rayGenerator->getRayDirection(w,h).x) *255; output(w,h)->Green = abs(rayGenerator->getRayDirection(w,h).y) *255; output(w,h)->Blue = abs(rayGenerator->getRayDirection(w,h).z) *255; */ glm::vec3 colors = raymarch->getColor(w,h, config->getSTEP(), glm::vec3(x, y, z)); colors*=255.0; if (colors.x > 255) colors.x = 255; if (colors.y > 255) colors.y = 255; if (colors.z > 255) colors.z = 255; output(w,h)->Red =colors.x; output(w,h)->Green = colors.y; output(w,h)->Blue = colors.z; } } output.WriteToFile(config->getFILE()); cout << "File has been finished rendering." <<endl; return 0; }
void CBarBitmapWin32::DrawDigit(int left, int top, char num) { BMP eBmp; LoadFont(IDB_FONT_NUM, eBmp); int leftMargin=8*(num-'0'); for (int i=0; i<8; i++) for (int j=0; j<12; j++) m_bmp->SetPixel(left+i, top+j, eBmp.GetPixel(leftMargin+i, j)); }