Click here to Skip to main content
15,914,016 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: screen split Pin
Adeel Chaudhry11-Nov-07 19:36
Adeel Chaudhry11-Nov-07 19:36 
Questionhow to splice two images with diffrent palette? Pin
King Tran30-Oct-07 4:20
King Tran30-Oct-07 4:20 
AnswerRe: how to splice two images with diffrent palette? Pin
Maximilien30-Oct-07 9:35
Maximilien30-Oct-07 9:35 
Questionhow to cut a segment from an image? Pin
King Tran30-Oct-07 4:02
King Tran30-Oct-07 4:02 
AnswerRe: how to cut a segment from an image? Pin
Ed.Poore30-Oct-07 4:21
Ed.Poore30-Oct-07 4:21 
AnswerRe: how to cut a segment from an image? Pin
Jheriko++17-Nov-07 17:10
Jheriko++17-Nov-07 17:10 
GeneralRe: how to cut a segment from an image? Pin
King Tran19-Nov-07 2:03
King Tran19-Nov-07 2:03 
QuestionGetting RGB values Pin
purplee8528-Oct-07 21:14
purplee8528-Oct-07 21:14 
Hi all, I'm facing problem with the C++ code which i've included below!! I need to output the RGB values of each pixel(preferably in array form), but I'm not sure how to use the getPixel here to output values of each point in terms of R, G and B separately. Is there any other better functions to use or do ya have any idea how i could manipulate this function to my program??

The block i tried below on GetRValue(&image), GetGValue(&image) and GetBValue gives me a hexadecimal value for the first 2 but i cannot seem to compile when i tried to do the same -->GetBValue(&image).

Thank You~~

Regards,
Stressed One

#include <windows.h>
#include <iostream.h>
#include <cimg.h>
#include <stdio.h>

using namespace cimg_library;

HANDLE hfile;
DWORD written;
BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
RGBTRIPLE *image;


int main() {
int size, x,y, crColor;
float R,G,B;
double hf;

// Open the file
hfile = CreateFile("bear.bmp",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL);

// Read the header
ReadFile(hfile,&bfh,sizeof(bfh),&written,NULL);
ReadFile(hfile,&bih,sizeof(bih),&written,NULL);

// Read image
size = bih.biWidth*bih.biHeight; //allocate memory for the image
ReadFile(hfile,NULL,size*sizeof(RGBTRIPLE),&written,NULL); // Reads it off the disk
cout<<"The image width is "<<bih.biwidth<<"\n"; output="" the="" width="" of="" bitmap
="" cout<<"the="" image="" height="" is="" "<<bih.biheight<<"\n";=""
="" load="" image
="" cimg<unsigned="" char=""> image("bear.bmp");
CImgDisplay main_disp(image);

while (!main_disp.is_closed) {
main_disp.wait();
int getPixel(int x, int y);

R = GetRValue(image);
G = GetGValue(image);
B = GetBValue(image);

printf("%02X %02X %02X\r", GetRValue(image), GetGValue(image), GetBValue(image));
}


return 0;
}
AnswerRe: Getting RGB values Pin
Maximilien29-Oct-07 0:56
Maximilien29-Oct-07 0:56 
AnswerRe: Getting RGB values Pin
Mark Salsbery29-Oct-07 6:05
Mark Salsbery29-Oct-07 6:05 
QuestionLoading a cube Pin
MasterSharp28-Oct-07 11:51
MasterSharp28-Oct-07 11:51 
AnswerRe: Loading a cube Pin
Cedric Moonen29-Oct-07 5:11
Cedric Moonen29-Oct-07 5:11 
QuestionStrategy to Show Messages on Form Showing Video Pin
Sukhjinder_K28-Oct-07 8:29
Sukhjinder_K28-Oct-07 8:29 
Questionrendering flash image to a website Pin
dinakatina26-Oct-07 11:32
dinakatina26-Oct-07 11:32 
AnswerRe: rendering flash image to a website Pin
sree_krishna4-Nov-07 22:39
sree_krishna4-Nov-07 22:39 
QuestionTwo windows display nothing (pitch black) no objects can be seen..no lighting effects ..VC++ with OpenGL Pin
Miss_ Petrovna26-Oct-07 10:43
Miss_ Petrovna26-Oct-07 10:43 
AnswerRe: Two windows display nothing (pitch black) no objects can be seen..no lighting effects ..VC++ with OpenGL Pin
Cedric Moonen29-Oct-07 5:10
Cedric Moonen29-Oct-07 5:10 
QuestionDrawing WMF/EMF antialiased Pin
Alexandre GRANVAUD25-Oct-07 2:58
Alexandre GRANVAUD25-Oct-07 2:58 
AnswerRe: Drawing WMF/EMF antialiased Pin
Alexandre GRANVAUD13-Feb-09 4:40
Alexandre GRANVAUD13-Feb-09 4:40 
QuestionOpenGL and VC++ 2005 EE Pin
Newbie0021-Oct-07 1:44
Newbie0021-Oct-07 1:44 
QuestionOpenGL Printing and Exporting Pin
Ahmad Safwat18-Oct-07 1:08
Ahmad Safwat18-Oct-07 1:08 
Questionis it possible audio recording and image capturing in web applications? Pin
kadkir17-Oct-07 19:28
kadkir17-Oct-07 19:28 
GeneralRe: is it possible audio recording and image capturing in web applications? Pin
trioum11-Jan-08 23:28
trioum11-Jan-08 23:28 
QuestionOpenGL: problem with lightning Pin
timurttv10-Oct-07 17:29
timurttv10-Oct-07 17:29 
AnswerRe: OpenGL: problem with lightning Pin
Cedric Moonen10-Oct-07 21:30
Cedric Moonen10-Oct-07 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.