473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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...what 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 1705
James Dean <m_*******@yahoo.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...what 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.com>
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_*******@yahoo.com> wrote in message
news:ec*************@TK2MSFTNGP11.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...what 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
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...
0
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...
0
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...
2
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...
3
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...
1
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"...
5
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...
1
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"...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.