Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


[java] MemoryImageSource


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Smoo   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2000 - 05:30 PM

I know we talked about this in another thread (More Graphic Stuff) but I am still having troubles with this topic. I asked before how to understand integers with the ARGB. I understand this but I''m getting a recurring problem when I attempt to even do the slightest manipulation with it. Every time i turn out an image that has gone through a change it basically shifts it.. okay that was badly explained. It does an effect like Johnny Cage''s shadow movements or the shadow movements in StarCraft done by High Templar... I hope that clears it us a bit. If you didn''t get what I meant by that, it takes some of the pixels and shifts them to the right giving an illusion of the pic being to the right but it takes other and shifts them to the left so I turn out with a pixels not being in the right place. Well, here''s the best way of showing you what my code is: for (int y = 0; y < 240; y++) for (int x = 0; x < 320; x++) { int alpha = (cigarAr[index] >> 24) & 0xff; int red = (cigarAr[index] >> 16) & 0xff; int green = (cigarAr[index] >> 8) & 0xff; int blue = (cigarAr[index]) & 0xff; alpha = 200 << 24; cigarAr[index] = alpha | (red & 0x00ff0000) | (green & 0x0000ff00)| (blue & 0xff); index++; } newCigar = createImage(mic2); This code somehow screws up the image because the only other code that does something is the pixelGrabber. Any suggestions would be greatly appreciated. Smoo

Sponsor:

#2 ao   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2000 - 06:50 PM

This should help, take this line:

cigarAr[index] = alpha | (red & 0x00ff0000) | (green & 0x0000ff00)| (blue & 0xff);

and change it to this:

cigarAr[index] = alpha | ( red << 16 ) | ( green << 8 ) | b;

if you do decide to take that line out that says:

alpha = 200 << 24;

Then you'll need to do the shifting for the alpha in the cigarAr[index] = ... equation.

ao



Edited by - ao on October 4, 2000 1:51:36 AM

#3 Smoo   Members   -  Reputation: 122

Like
Likes
Like

Posted 04 October 2000 - 07:01 AM

Well I tried it you''re way and basically what it does is remove a lot of code that I needed before so it''s helpful in that respect.

I did find out my problem though and it was partly (well mostly) on my ignorance on how MemoryImageSource actually works

i had:
mic2 = new MemoryImageSource(320, 240, cigarAr, 0, 240);
whereas i needed:
mic2 = new MemoryImageSource(320, 240, cigarAr, 0, 320);

one word for myself: duh!

Well, I''m happy that it works now... mostly
This brings up another topic along these lines. The image that I am getting seems a bit grainy. The transparency works on most areas but alot more on others.

If you understand what I''m talking about, any pointers on how to clear up the image would be really appreciated.

Thanks,
Smoo




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS