Click here to Skip to main content
15,891,657 members

mbaugher - Professional Profile



Summary

    Blog RSS
1,480
Author
15
Authority
3
Debator
103
Participant
0
Editor
0
Enquirer
0
Organiser
Matthew Baugher is an electrical engineer from the U.S.A. He is working part time writing image processing software for TerraVerde Technologies while pursing an MBA from Oklahoma State University.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
Generalhow to add an alpha channel Pin
Member 396415928-Apr-08 2:13
Member 396415928-Apr-08 2:13 
GeneralRe: how to add an alpha channel [modified] Pin
mbaugher28-Apr-08 7:07
mbaugher28-Apr-08 7:07 
I am not sure in what step your problem is, so first I will explain how to create/edit a four band bitmap and then how to save it as a .png.

To add an alpha channel to an image, you need to set up your bitmap a bit differently:

int height = b.Height;
int width = b.Width;
BitmapData bmData = b.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

<br />
unsafe<br />
{<br />
byte* p = (byte*)(void*)Scan0;<br />
int nOffset = stride - width * 4;<br />
<br />
for (int y = 0; y < height; ++y)<br />
{<br />
for (int x = 0; x < width; ++x)<br />
{<br />
// do whatever pixel change you want<br />
p += 4;<br />
}<br />
p += nOffset;<br />
}<br />
}<br />
b.UnlockBits(bmData);<br />


Notice the pixel format is now set up as Format32bppArgb, instead of the typical 24bpp. Alos be careful and remeber you need to increment the pixel value by four instead of three, and likewise nOffset is multiplied by four instead of three.

Once you have your bitmap created, it can then be saved as a .png via the bitmap.save command as follows.

<br />
b.Save(tbDestination.Text, ImageFormat.Png); //save the bitmap as a .PNG file to the supplied destination<br />


modified on Tuesday, April 29, 2008 7:31 AM

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.