TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thomas.SheppardUK
NA
1
0
Image resizing & alpha blending
Mar 15 2005 5:45 AM
I’m looking for some help, I’m working on shaped forms and require the bitmaps which the forms are shaped from to be resized depending on the users screen resolution, I have done this fine however I am using pixels on the image to pinpoint were different buttons and menus should be placed when the form is generated. To do this I compare each pixel in the image with a pre defined RGB value and if they match I record the X,Y of that pixel. The problem seems to be that when I resize the image the colour’s are changed slightly (alpha blending I suspect) however I can’t find a way to stop .NET from doing this any ideas I have placed a code sample below. Any help greatly appreciated, Tom FileStream imageStream = File.OpenRead("background.bmp"); Bitmap imageBackground = (Bitmap)Bitmap.FromStream(imageStream); Image resized = imageBackground.GetThumbnailImage(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height,1000,null,new IntPtr()); // The resized image being created resized.Save("c:\\bitmap.bmp",System.Drawing.Imaging.ImageFormat.Bmp); FileStream newStream = File.OpenRead("c:\\bitmap.bmp"); Bitmap newBackground = (Bitmap)Bitmap.FromStream(newStream); Color transparentColor = Color.FromArgb(237,255,33); Color paintPointColor = Color.FromArgb(0,255,0); // The colour it should be marking for toolbars etc this.Width = 1000; this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; // imageBackground.Height; this.Region = RegionConvert.ConvertFromTransparentBitmap(newBackground, transparentColor,"Background",paintPointColor); //This is were it searches the image this.BackgroundImage = newBackground
Reply
Answers (
0
)
C# picture tranparency
Save Control name in variable