<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bitmap]]></title><description><![CDATA[<p>Ich habe mir eine eigene Bmp Klasse geschrieben. sie funzt auch prima, aber habe probleme die speicherfunktion zu schreiben.<br />
Ich weiß nicht, wie ich die beiden header so ichtig auffüllen soll.</p>
<pre><code class="language-cpp">#pragma  pack(1)
struct BMFH	// Bitmap File Header
{
	char         bmtype_[2];
	unsigned int fileSize_;
	short int    reserved1_;
	short int    reserved2_;
	unsigned int offsetBits_;
}; // 18 Bytes
#pragma pack()

#pragma pack(1)
struct BMIF	// Bitmap Info Header
{
	unsigned int sizeHeader_;
	unsigned int width_;
	unsigned int height_;
	short int    planes_;
	short int    bpp_;
	unsigned int compression_;
	unsigned int sizeImage_;
	unsigned int xPelsPerMeter_;
	unsigned int yPelsPerMeter_;
	unsigned int clrUsed_;
	unsigned int clrImportant_;
}; // 40 Bytes
#pragma pack()

enum BitCompression
{
	RGB  = 0,
	RLE8,
	RLE4,
	BITFIELDS
};
</code></pre>
<pre><code class="language-cpp">BMFH bmfh;
	BMIF bmif;

	bmfh.bmtype_[0]		= 'B';
	bmfh.bmtype_[1]		= 'M';
	bmfh.fileSize_		= sizeof(BMFH) + sizeof(BMIF) + sizeof(image_-&gt;rgb_); // rgb ist das array mit den daten
	bmfh.reserved1_		= 0; // darf das 0 sein?
	bmfh.reserved2_		= 0; // darf das 0 sein?
	bmfh.offsetBits_	= 54;

	bmif.sizeHeader_	= sizeof(BMFH);
	bmif.width_			= image_-&gt;width_;
	bmif.height_		= image_-&gt;height_;
	bmif.planes_		= 1;
	bmif.bpp_			= image_-&gt;bpp_;
	bmif.compression_	= RGB; --
	bmif.sizeImage_		= sizeof(image_-&gt;rgb_);
	bmif.xPelsPerMeter_	= 0;// darf das 0 sein?
	bmif.yPelsPerMeter_	= 0;// darf das 0 sein?
	bmif.clrUsed_		= 0;// darf das 0 sein?
	bmif.clrImportant_	= 0;// darf das 0 sein?
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/138335/bitmap</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 23:48:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/138335.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Feb 2006 14:38:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bitmap on Sat, 25 Feb 2006 14:38:28 GMT]]></title><description><![CDATA[<p>Ich habe mir eine eigene Bmp Klasse geschrieben. sie funzt auch prima, aber habe probleme die speicherfunktion zu schreiben.<br />
Ich weiß nicht, wie ich die beiden header so ichtig auffüllen soll.</p>
<pre><code class="language-cpp">#pragma  pack(1)
struct BMFH	// Bitmap File Header
{
	char         bmtype_[2];
	unsigned int fileSize_;
	short int    reserved1_;
	short int    reserved2_;
	unsigned int offsetBits_;
}; // 18 Bytes
#pragma pack()

#pragma pack(1)
struct BMIF	// Bitmap Info Header
{
	unsigned int sizeHeader_;
	unsigned int width_;
	unsigned int height_;
	short int    planes_;
	short int    bpp_;
	unsigned int compression_;
	unsigned int sizeImage_;
	unsigned int xPelsPerMeter_;
	unsigned int yPelsPerMeter_;
	unsigned int clrUsed_;
	unsigned int clrImportant_;
}; // 40 Bytes
#pragma pack()

enum BitCompression
{
	RGB  = 0,
	RLE8,
	RLE4,
	BITFIELDS
};
</code></pre>
<pre><code class="language-cpp">BMFH bmfh;
	BMIF bmif;

	bmfh.bmtype_[0]		= 'B';
	bmfh.bmtype_[1]		= 'M';
	bmfh.fileSize_		= sizeof(BMFH) + sizeof(BMIF) + sizeof(image_-&gt;rgb_); // rgb ist das array mit den daten
	bmfh.reserved1_		= 0; // darf das 0 sein?
	bmfh.reserved2_		= 0; // darf das 0 sein?
	bmfh.offsetBits_	= 54;

	bmif.sizeHeader_	= sizeof(BMFH);
	bmif.width_			= image_-&gt;width_;
	bmif.height_		= image_-&gt;height_;
	bmif.planes_		= 1;
	bmif.bpp_			= image_-&gt;bpp_;
	bmif.compression_	= RGB; --
	bmif.sizeImage_		= sizeof(image_-&gt;rgb_);
	bmif.xPelsPerMeter_	= 0;// darf das 0 sein?
	bmif.yPelsPerMeter_	= 0;// darf das 0 sein?
	bmif.clrUsed_		= 0;// darf das 0 sein?
	bmif.clrImportant_	= 0;// darf das 0 sein?
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1002613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002613</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sat, 25 Feb 2006 14:38:28 GMT</pubDate></item><item><title><![CDATA[Reply to Bitmap on Sat, 25 Feb 2006 20:57:50 GMT]]></title><description><![CDATA[<p>hilft dir der beitrag aus den faq?<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39400.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39400.html</a></p>
<p>lw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1002982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002982</guid><dc:creator><![CDATA[Lawilog]]></dc:creator><pubDate>Sat, 25 Feb 2006 20:57:50 GMT</pubDate></item><item><title><![CDATA[Reply to Bitmap on Sat, 25 Feb 2006 21:19:01 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_62uq.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_62uq.asp</a></p>
<p>msdn schrieb:</p>
<blockquote>
<p>bfReserved1<br />
Reserved; must be zero.<br />
bfReserved2<br />
Reserved; must be zero.</p>
</blockquote>
<p>zu bih: dürfte vermutlich für dich uninteressant für dich sein.<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_62uq.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_62uq.asp</a></p>
<p>evtl hilft dir die ein beispiel aus meiner bitmap klasse</p>
<pre><code class="language-cpp">static void Write(
				std::ostream &amp;s,
				size_t nWidth,
				size_t nHeight,
				size_t nBpp,
				unsigned char *pData)
			{
				// bitmapfileheader
				struct
				{
					unsigned char	B, M;
					unsigned long	nSize;
					unsigned short  nReserved1;
					unsigned short  nReserved2;
					unsigned long   nOffsetBits;
				} Bfh;
				// bitmapimageheader
				struct
				{
					unsigned long 	nSize;
					long  			nWidth;
					long  			nHeight;
					unsigned short 	nPlanes;
					unsigned short 	nBPP;
					unsigned long 	nCompression;
					unsigned long 	nImageSize;
					long  			nWidthPPM;
					long  			nHeightPPM;
					unsigned long 	nColorUsed;
					unsigned long 	nColorImportant;
				} Bih;

				Bfh.nSize			= sizeof(Bfh); // grösse überprüfen
				Bfh.B				= 'B';
				Bfh.M				= 'M';
				Bfh.nReserved1		= 0;
				Bfh.nReserved2		= 0;
				Bfh.nOffsetBits		= sizeof(Bfh) + sizeof(Bih); // grösse überprüfen

				Bih.nSize			= sizeof(Bih); // grösse überprüfen
				Bih.nPlanes			= 1;
				Bih.nBPP			= static_cast&lt;unsigned short&gt;(nBpp);
				Bih.nCompression	= 0;
				Bih.nImageSize		= nWidth * nHeight * (nBpp &gt;&gt; 3);
				Bih.nWidthPPM		= 0;
				Bih.nHeightPPM		= 0;
				Bih.nColorUsed		= 0;
				Bih.nColorImportant	= 0;
				Bih.nWidth			= nWidth;
				Bih.nHeight			= nHeight;

				// um 'padding-bytes' zu vermeiden wird alles einzeln gespeichert
				s.write((char*)&amp;Bfh.B, sizeof(unsigned char));
				s.write((char*)&amp;Bfh.M, sizeof(unsigned char));
				s.write((char*)&amp;Bfh.nSize, sizeof(unsigned long));
				s.write((char*)&amp;Bfh.nReserved1, sizeof(unsigned short));
				s.write((char*)&amp;Bfh.nReserved2, sizeof(unsigned short));
				s.write((char*)&amp;Bfh.nOffsetBits, sizeof(unsigned long));

				s.write((char*)&amp;Bih, sizeof(Bih));
				s.write((char*)pData, Bih.nImageSize);
			}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1002994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002994</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Sat, 25 Feb 2006 21:19:01 GMT</pubDate></item></channel></rss>