473,564 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with setting 32ARGB values

I am trying to directly set the pixels in a 32ARGB image but for some
reason i am not setting them correctly. I have a struct 4 bytes in
size...
public struct PixelData
{
public byte Blue;
public byte Green;
public byte Red;
public byte transparent;
}
I set the data to the correct size....the transparent byte is at the end
which i thought was correct but i cannot display it correctly. I can
display a 24RGB bitmap correctly using the 3 byte structure...wha t could
be the problem?.I make the bitmap a 32ARGB bitmap at the start also.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
4 1719
James Dean <m_*******@yaho o.com> wrote:
I am trying to directly set the pixels in a 32ARGB image but for some
reason i am not setting them correctly. I have a struct 4 bytes in
size...
public struct PixelData
{
public byte Blue;
public byte Green;
public byte Red;
public byte transparent;
}
I set the data to the correct size....the transparent byte is at the end
which i thought was correct but i cannot display it correctly. I can
display a 24RGB bitmap correctly using the 3 byte structure...wha t could
be the problem?.I make the bitmap a 32ARGB bitmap at the start also.


I'd expect the transparency to be the first byte of the structure, as
the "A" of ARGB stands for "Alpha". (I'd expect it to be RGBA if the
transparency is at the end.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
The LockBits example in the GDI+ FAQ illustrates the structure of the data
and the pixel element order.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml


"James Dean" <m_*******@yaho o.com> wrote in message
news:ec******** *****@TK2MSFTNG P11.phx.gbl...
I am trying to directly set the pixels in a 32ARGB image but for some
reason i am not setting them correctly. I have a struct 4 bytes in
size...
public struct PixelData
{
public byte Blue;
public byte Green;
public byte Red;
public byte transparent;
}
I set the data to the correct size....the transparent byte is at the end
which i thought was correct but i cannot display it correctly. I can
display a 24RGB bitmap correctly using the 3 byte structure...wha t could
be the problem?.I make the bitmap a 32ARGB bitmap at the start also.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3
Bob,
Thats very helpful....i must reference that more often...thank you very
much.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
Well actually i did not fix the problem but i used 32rgb which leaves
one byte blank and with this i can set the transparency so its the same
result. Actually its not sttructured like ARGB. The correct RGB
structure is blue first then green then red last, so its read
backwards....
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2993
by: Gary | last post by:
i have a project which is include ASP, VB, VB COM, MTS, IIS. when the user enter the site the user is asked to login using UserID and Password after that i am passing those values to COM Objects and those COM objects are setting the Session values through ASP intransic objects., if the user is a valid user then i am taking out his personal...
0
2116
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are some problems I encountered while using them. Please note that, the Regional and Language setting on my machine is using "Metric" measurement system...
0
1498
by: pwldev | last post by:
Sorry if this isn't a good place for this question. I have a problem with losing cookie values whenever a user's local machine date/time is behind the date & time of the IIS machine. The login page sets some cookie values (using Response.Cookies) and redirects to another page which then checks for the cookie values. I've noticed that when...
2
2645
by: James Dean | last post by:
I can display an 8bpp indexed bitmap correctly but when i tried to convert this to 32ARGB then it didn't display properly at all. I am just wondering how i can display the same 24bpp image at the the same width and height as the previous 8bpp data. Is it possible that i can just clone this data but i can't really as i am not allowed to create...
3
2875
by: Jan Krouwer | last post by:
I have a problem that shows up only on some systems - the toolbar text in buttons is not visible (vb.net 2003 app, 1.1 framework). As a workaround, I changed the textalign property to "right". This solved the problem, but I don't know what's happening. I notice that there is a small "dot" in the first toolbar button that shows up in either of...
1
3678
by: rory | last post by:
Have the following setting in my app.config: <setting name="Scenes" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>State Img;c:\scenes\Scene1\;5000;1;0;0;0;3</string> <string>Local
5
4067
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names...
1
6460
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located...
5
2926
by: snow | last post by:
Hi All, ToOADate can change a date value to a double value, but if I change the Regional and Lauguage setting in control panel, for example, change English(US) to English(Australia) , the same date time will get different double values from function ToOADate. How to always get the same double value no matter what setting is in control...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.