How do you display a bmp using the AcGiGeometry::image method?

How do you display a bmp using the AcGiGeometry::image method?

Anonymous
Not applicable
1,063 Views
2 Replies
Message 1 of 3

How do you display a bmp using the AcGiGeometry::image method?

Anonymous
Not applicable
Does anyone know what format the imageSource needs to be in? The AcGiImageBGRA32 takes a pointer to a AcGiPixelBGRA32, I'm assuming this is an array of the pixels. Is it in a top-down layout or bottom-down? I'm also assuming from the BGRA designation that the colors of each pixel are reversed from that of a bmp. Thanks for looking at this, the SDK had little to say and I didn't see anything on the forum or with Google.
0 Likes
Accepted solutions (1)
1,064 Views
2 Replies
Replies (2)
Message 2 of 3

Balaji_Ram
Alumni
Alumni
Accepted solution

Hi Darcy,

 

Here is a sample code snippet to explain this :

 

AcGiImageBGRA32 giImage;

AcGiPixelBGRA32 *pixels = new AcGiPixelBGRA32[ImageWidth * ImageHeight];

for (int i = 0; i < ImageWidth; i++)
{
	for (int j=0; j < ImageHeight; j++)
	{
		pixels[(j * ImageWidth) + i].setBGRA(blue, green, red, alpha);
	}
}

giImage.setImage(ImageWidth, ImageHeight, pixels);

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

BigBadBernie
Contributor
Contributor

What happens to the new AcGiPixelBGRA32 Array?

When I create it in Line:

AcGiPixelBGRA32 *pixels = new AcGiPixelBGRA32[ImageWidth * ImageHeight];

I have to delete it at some point.

When I do this, then AutoCAD crashes.

What is wrong?

0 Likes