473,396 Members | 1,671 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,396 software developers and data experts.

Trouble displaying bitmap


I have trouble displaying a bitmap. I have 1bpp information. I also have
a command telling me what color i need to set the bytes to when the
colour is switched on. The trouble is i do all this but it will not
display properly. I convert this to 8bpp information. I set the relevant
pixel to for example "255,0,0" for Red.....is this right?....i set the
Red byte to 255 and the other two values set to 0. I think the Bitmap
data class i am using is not working properly. Have a look at the data
below.

bitmap = new
Bitmap(PageSizeInPixels.Width,PageSizeInPixels.Hei ght,System.Drawing.Ima
ging.PixelFormat.Format8bppIndexed);

public struct PixelData
{
public byte RedValue;
public byte GreenValue;
public byte BlueValue;
};

public void LockBitmap()
{
GraphicsUnit unit = GraphicsUnit.Pixel;
RectangleF boundsF = bitmap[bitmap_Count - 1].GetBounds(ref unit);
Rectangle bounds = new Rectangle((int) boundsF.X,
(int) boundsF.Y,
(int) boundsF.Width,
(int) boundsF.Height);

// Figure out the number of bytes in a row
// This is rounded up to be a multiple of 4
// bytes, since a scan line in an image must always be a multiple of 4
bytes
// in length.
width = (int) boundsF.Width * sizeof(PixelsData);
if (width % 4 != 0)
{
width = 4 * (width / 4 + 1);
}
bitmapData =
bitmap[bitmap_Count - 1].LockBits(bounds, ImageLockMode.ReadWrite,
PixelFormat.Format8bppIndexed);

pBase = (Byte*) bitmapData.Scan0.ToPointer();
}

public void Make24BppBitmap()
{

//LineDataStore stores the 1bpp information
fixed(byte* ThisData = LineDataStore)
{
byte* CurrLine = ThisData + (y * ByteWidth);
PixelData* pPixel = PixelAt(0, y);
for (int x = 0; x < size.X; x++)
{
//check to see if bit is set by using masking
if it is set
then
{
pPixel->RedValue = GetBitmapColorValue[0];
pPixel->GreenValue = GetBitmapColorValue[1];
pPixel->BlueValue = GetBitmapColorValue[2];
}
pPixel++;
}

}

}

For the above i only get a black bitmap......whats the problem.......

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
0 1259

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

Similar topics

7
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application....
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
2
by: marvin | last post by:
Hi, I am trying to display images in a repeater from a SQL database and do some transformations on the image prior to displaying them (such as thumbnail with a shadow). The problem is I can't...
0
by: yln | last post by:
hi iam displaying a bitmap on the window using bitblt() function.But it is not being displayed as it is .some colors are not displaying properly .please tell me one way thanking u sir
2
by: Jeronimo Bertran | last post by:
Hello, I am using a rendering aspx page to display a database image on an Image control. When the database record is retrieved, I am saving the bitmap to a session variable for the rendering...
3
by: active | last post by:
I draw text in a bitmap and then draw the bitmap on a picturebox and get text that is not all displayed the same. Note the different text style in the (40, 100) area. Got any insight into...
8
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a...
0
by: AMDRIT | last post by:
Hello Everyone, Just curious how far off the mark I am with my Working Dialog. Any improvements are welcomed. Scenario, we have an application (vb'05) that at known times performs tasks that...
11
by: Usenet User | last post by:
..NET 1.1/2.0 I have a need to display high-resolution scrollable images in a .NET application (Windows Forms). One well known solution is to create a Panel with AutoScroll set to "true" and...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.