Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Dividing a PNG image with alpha channel intact?

Author
Message
MoomanFL
18
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 24th Feb 2009 00:59
I have a PNG that consists of two images (attached below) that I am needing to divide up into two separate images. I was able to do this the standard way by loading to a bitmap, and then grabbing to two separate Basic2D.Image entities. However this destroys the alpha channel info. As a result the black border to the letters is jagged or even missing in spots and the drop shadow disappears altogether.

Is there a better way to simply load this image and divide it up without destroying the alpha channel?

Design documents?!? What design documents??? I thought we were just going to wing it!!!

Attachments

Login to view attachments
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th Feb 2009 18:13
Not easily. Consider using a memblock to do it

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
RanQor
16
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 24th Feb 2009 19:07
Is there a way to handle the two images via .NET then stream them into a new DarkGDK.NET image?
MoomanFL
18
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 25th Feb 2009 05:30 Edited at: 25th Feb 2009 05:43
@Diggsey,

Thanks for the reply. That is what I figured, I was just hoping I was wrong about that. Below is my contribution to the community for this problem: an ImageHelper class that has an ImageFromImage method. It takes two Basic2D.Image entities (Source and Destination) and coordinates within the source image that you want copied to the destination image.

@RanQor,

I haven't found a way to do that right now. You would need low-level access to the Image structure within DGDK.

Ok here is a listing of the ImageHelper class. Right now it has one structure (Position) that wraps the top, left, right, and bottom coordinates, a method (ImageFromImage) that will grab an image including alpha channel from a Basic2D.Image, and a helper function that will get the bit depth of the image and return the number of bytes for each pixel. It isn't really



Here is how you might use the class using the image I attached in my first post:



Now you can use the Paste method from the destination image within the game loop to put the new image on the screen where ever you choose.

Design documents?!? What design documents??? I thought we were just going to wing it!!!

Login to post a reply

Server time is: 2024-03-28 09:26:26
Your offset time is: 2024-03-28 09:26:26