Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

codefreak

RGB values in visual basic..

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, i figured out how to do fading with 16bit color modes (alpha blending), but how do you get the RGB values of a pixel in visual basic? please if anyone can assist me with this problem it would be appreciated? Thanks

Share this post


Link to post
Share on other sites
Advertisement
yes, im using DX. But my problem really is, i dont understand this pixel format thing. the getlockedpixel returns a value based on the current pixel format, how do i convert that value to RGB values?

and would that be the most effiecent way of doing it?

thanks

Share this post


Link to post
Share on other sites
let''s see... here''s what I THINK is the right answer, haven''t exactly tried it out yet.

1)Lock surface
2)GetLockedPixel or GetLockedArray
3)Get invididual color components from the pixel using the dx.ColorGetRed and others.
4)Perform blending function on the color components
5)Use dx.CreateColorRGB or CreateColorRGBA if that doesn''t work, to make your color
6)Call SetLockedPixel with your new color
7)Should work...

-------------------------
-Now Working on Pokemon like Engine!

Share this post


Link to post
Share on other sites
this way got a big problem.the speed is very very slow.
that make you won''t to use it anymore.

the way i use is creating D3DIM ,use texture alphablend,
it support hardware accelerate.but 3D video card need

Share this post


Link to post
Share on other sites
zho : I use 3DSprites too, but there are limitations and bumps to that method like sprite size, and 3D card capabilities (I have seen new cards .... *cough* S3 *cough* without alpha blend caps) And more to the point, the question was how to get RGB values of a pixel in VB. And until someone does a test on fading in this manner in VB we''d never know for sure how slow it is!

-------------------------
-Now Working on Pokemon like Engine!

Share this post


Link to post
Share on other sites
man, i just dont get this to work.

i''ve used that ColorGetRed and others function, but it
just doesnt give me the right rgb values.

i''ve done a function for myself to get the rgb values by
converting the color that i get from GetLockedPixel, to hexadecimal, pending that and then retrieve the right
rgb values.

with that rgb values, the function CreateColorRGB just doesnt work. Where it supposed to give me a number round about 77100 it return a very long negative number and always starting with -167xxxxx.

could anyone help here. please!!!

thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!