Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 19th, 2005, 7:49 AM   #1
djm_2k1
Newbie
 
Join Date: Jul 2005
Posts: 3
Rep Power: 0 djm_2k1 is on a distinguished road
Help needed!

Hi

Im trying to create a water effect over an image and am having trouble rendering the pixels on the screen. I have setup the motion etc... and just need to draw them to the screen. Heres my source for my paint method.

Any help would be much appreciated.

private void paintWater() {

int p = 0;

for(int i = 157; i < pixels.length-157; i++) {

offsetX = pixelBuffer[i-1] - pixelBuffer[i+1];

colour = 128 - offsetX;

if(colour > 255)
colour = 255;
else if(colour < 0)
colour = 0;

offsetX /= 8;

indexX = offsetX + i;

if(indexX < 0)
indexX = 0;
else if(indexX > pixels.length-1)
indexX = pixels.length-1;

int r = ((colour & 0xFF0000) >> 16);
int g = ((colour & 0x00FF00) >> 8);
int b = ((colour & 0x0000FF));

pixelsNew[p++] = 0xFF000000 | (r << 16) | (g << 8) | b;
}
p += 2;
}

Thanks Dan
djm_2k1 is offline   Reply With Quote
Old Oct 19th, 2005, 8:23 AM   #2
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
please use code tags around your code ( [C O D E][/C O D E] - no spaces)
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC