На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

BITMAPINFO



The BITMAPINFO structure defines the dimensions and color information for a Windows device-independent bitmap (DIB).

typedef struct tagBITMAPINFO { // bmi
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;


Members

bmiHeader

Specifies a BITMAPINFOHEADER structure that contains information about the dimensions and color format of a DIB.

bmiColors

Specifies an array of RGBQUAD or doubleword data types that define the colors in the bitmap.



Remarks

A device-independent bitmap consists of two distinct parts: a BITMAPINFO structure describing the dimensions and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in the array are packed together, but each scan line must be padded with zeroes to end on a LONG data-type boundary. If the height is positive, the bitmap is a bottom-up DIB and its origin is the lower left corner. If the height is negative, the bitmap is a top-down DIB and its origin is the upper left corner.

The biBitCount member of the BITMAPINFOHEADER structure determines the number of bits that define each pixel and the maximum number of colors in the bitmap. This member can be one of the following values:

Value Meaning
1 The bitmap is monochrome, and the bmiColors member contains two entries. Each bit in the bitmap array represents a pixel. If the bit is clear, the pixel is displayed with the color of the first entry in the bmiColors table; if the bit is set, the pixel has the color of the second entry in the table.
4 The bitmap has a maximum of 16 colors, and the bmiColors member contains up to 16 entries. Each pixel in the bitmap is represented by a 4-bit index into the color table. For example, if the first byte in the bitmap is 0x1F, the byte represents two pixels. The first pixel contains the color in the second table entry, and the second pixel contains the color in the sixteenth table entry.
8 The bitmap has a maximum of 256 colors, and the bmiColors member contains up to 256 entries. In this case, each byte in the array represents a single pixel.
16 The bitmap has a maximum of 2^16 colors. If the biCompression member of the BITMAPINFOHEADER is BI_RGB, the bmiColors member is NULL. Each WORD in the bitmap array represents a single pixel. The relative intensities of red, green, and blue are represented with 5 bits for each color component. The value for blue is in the least significant 5 bits, followed by 5 bits each for green and red, respectively. The most significant bit is not used.If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the bmiColors member contains three DWORD color masks that specify the red, green, and blue components, respectively, of each pixel. Each WORD in the bitmap array represents a single pixel.Windows NT: When the biCompression member is BI_BITFIELDS, bits set in each DWORD mask must be contiguous and should not overlap the bits of another mask. All the bits in the pixel do not have to be used. Windows 95: When the biCompression member is BI_BITFIELDS, Windows 95 supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800.
24 The bitmap has a maximum of 2^24 colors, and the bmiColors member is NULL. Each 3-byte triplet in the bitmap array represents the relative intensities of blue, green, and red, respectively, for a pixel.
32 The bitmap has a maximum of 2^32 colors. If the biCompression member of the BITMAPINFOHEADER is BI_RGB, the bmiColors member is NULL. Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, respectively, for a pixel. The high byte in each DWORD is not used.If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the bmiColors member contains three DWORD color masks that specify the red, green, and blue components, respectively, of each pixel. Each DWORD in the bitmap array represents a single pixel.Windows NT: When the biCompression member is BI_BITFIELDS, bits set in each DWORD mask must be contiguous and should not overlap the bits of another mask. All the bits in the pixel do not have to be used. Windows 95: When the biCompression member is BI_BITFIELDS, Windows 95 supports only the following 32bpp color mask: The blue mask is 0x000000FF, the green mask is 0x0000FF00, and the red mask is 0x00FF0000.


The biClrUsed member of the BITMAPINFOHEADER structure specifies the number of color indices in the color table that are actually used by the bitmap. If the biClrUsed member is set to zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member.
The colors in the bmiColors table should appear in order of importance.
Alternatively, for functions that use DIBs, the bmiColors member can be an array of 16-bit unsigned integers that specify indices into the currently realized logical palette, instead of explicit RGB values. In this case, an application using the bitmap must call the DIB functions (CreateDIBitmap, CreateDIBPatternBrush, and CreateDIBSection) with the iUsage parameter set to DIB_PAL_COLORS.

If the bitmap is a packed bitmap (a bitmap in which the bitmap array immediately follows the BITMAPINFO header and which is referenced by a single pointer), the biClrUsed member must be set to an even number when using the DIB_PAL_COLORS mode so the DIB bitmap array starts on a doubleword boundary.



Note The bmiColors member should not contain palette indices if the bitmap is to be stored in a file or transferred to another application. Unless the application has exclusive use and control of the bitmap, the bitmap color table should contain explicit RGB values.



See Also

BITMAPINFOHEADER, CreateDIBitmap, CreateDIBPatternBrush, CreateDIBSection, RGBQUAD


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

BITMAPINFO



Структура BITMAPINFO определяет измерения и окрашивает информацию для машинонезависимого побитового отображения Windows (DIB).

typedef struct tagBITMAPINFO { // bmi BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;


Участники

bmiHeader

Определяет структуру BITMAPINFOHEADER, которая содержит информации об измерениях и цветном формате DIB.

bmiColors

Определяет массив RGBQUAD или данные двойного слова набирает, что определяет цвета в побитовом отображении.



Замечания

Машинонезависимое побитовое отображение состоит из двух четких частей: структура BITMAPINFO, описывающая измерения и цвета побитового отображения, и массив байтов, определяющих пиксели побитового отображения. Биты в массиве упаковываются вместе, но каждая строка сканирования должна быть заполнена нулями, чтобы заканчиваться в ДЛИННЫХ данных-типе границы. Если высота положительная, побитовое отображение - восходящий DIB и начало является более низким левым углом. Если высота является негативом, побитовое отображение - нисходящий DIB и начало является верхним левым углом.

Элемент biBitCount структуры BITMAPINFOHEADER определяет количество битов, которые определяют каждый пиксель и максимальное количество цветов в побитовом отображении. Этот элемент может быть одним из следующего величин:

Значение Величины
1 Побитовое отображение монохромное, и элемент bmiColors содержит два данных. Каждый бит в массиве побитового отображения представляет пиксель. Если бит ясен, пиксель отображен цветом первого входа в таблице bmiColors; если бит установлен, пиксель имеет цвет второго входа в таблице.
4 Побитовое отображение имеет максимум 16 цветов, и элемент bmiColors содержит вплоть до 16 данных. Каждый пиксель в побитовом отображении представлен 4- битовым индексом в цветную таблицу. Например, если первый байт в побитовом отображении - 0x1F, байт представляет два пикселя. Первый пиксель содержит цвет на втором табличном входе, и второй пиксель содержит цвет на шестнадцатом табличном входе.
8 Побитовое отображение имеет максимум 256 цветов, и элемент bmiColors содержит вплоть до 256 данных. В этом случае, каждый байт в массиве представляет единственный пиксель.
16 Побитовое отображение имеет максимум 2^16 цветов. Если элемент biCompression BITMAPINFOHEADER - BI_RGB, элемент bmiColors НЕДЕЙСТВИТЕЛЕН. Каждое СЛОВО в массиве побитового отображения представляет единственный пиксель. Относительная интенсивность красная, зеленая, и синяя представлена 5 битами для каждого цветного компонента. Величина для синего - на наименее значимые 5 битов, сопровожденных 5 битами каждый для зеленого и красного, соответственно. Наиболее значимый бит не использован.Если элемент biCompression BITMAPINFOHEADER - BI_BITFIELDS, элемент bmiColors содержит три цветных маски DWORD, которые определяют красные, зеленые, и синие компоненты, соответственно, каждого пикселя. Каждое СЛОВО в массиве побитового отображения представляет единственный пиксель.Windows NT: Когда элемент biCompression - BI_BITFIELDS, биты были установлены в каждой маске DWORD должно быть непрерывным и не должно перекрывать биты другой маски. Все биты на пикселе нет должны быть использованн. Windows 95: Когда элемент biCompression - BI_BITFIELDS, опоры Windows 95 только следующее 16bpp цвета маскирует: 5-5-5 16- битовых образов, где синяя маска - 0x001F, зеленая маска - 0x03E0, и красная маска - 0x7C00; и 5-6-5 16- битовых образов, где синяя маска - 0x001F, зеленая маска - 0x07E0, и красная маска - 0xF800.
24 Побитовое отображение имеет максимум 2^24 цветов, и элемент bmiColors НЕДЕЙСТВИТЕЛЕН. Каждый 3- байтовый триплет в массиве побитового отображения представляет относительную интенсивность синюю, зеленую, и красную, соответственно, для пикселя.
32 Побитовое отображение имеет максимум 2^32 цветов. Если элемент biCompression BITMAPINFOHEADER - BI_RGB, элемент bmiColors НЕДЕЙСТВИТЕЛЕН. Каждый DWORD в массиве побитового отображения представляет относительную интенсивность синюю, зеленую, и красную, соответственно, для пикселя. Высокий байт в каждом DWORD не использован.Если элемент biCompression BITMAPINFOHEADER - BI_BITFIELDS, элемент bmiColors содержит три цветных маски DWORD, которые определяют красные, зеленые, и синие компоненты, соответственно, каждого пикселя. Каждый DWORD в массиве побитового отображения представляет единственный пиксель.Windows NT: Когда элемент biCompression - BI_BITFIELDS, биты были установлены в каждой маске DWORD должно быть непрерывным и не должно перекрывать биты другой маски. Все биты на пикселе нет должны быть использованн. Windows 95: Когда элемент biCompression является BI_BITFIELDS, опорами Windows 95 только 32bpp цветная маска следующего: синяя маска - 0x000000FF, зеленая маска - 0x0000FF00, и красная маска - 0x00FF0000.


biClrUsed Элемент структуры BITMAPINFOHEADER определяет количество цветных индексов в цветной таблице, которая действительно использована побитовым отображением. Если biClrUsed элемент установлен в нуль, побитовое отображение использует максимальное количество цветов, соответствуемых в величину элемента biBitCount.
Цвета в таблице bmiColors должны появляться в порядке важном.
Кроме того, для функций, которые используют DIBs, элемент bmiColors может быть массивом 16- битовых без знака целых, которые определяют индексы в к настоящему времени реализовать логическую палитру, вместо явных величин RGB. В этом случае, приложение, использовавшее побитовое отображение должно назвать функции DIB (CreateDIBitmap, CreateDIBPatternBrush, и CreateDIBSection) с параметром iUsage установленным на DIB_PAL_COLORS.

Если побитовое отображение является упакованным побитовым отображением ( побитовое отображение в котором массив побитового отображения немедленно следует за заголовком BITMAPINFO и на который ссылался единственным указателем), biClrUsed элемент должен быть установлен в ровное число при использовании режима DIB_PAL_COLORS, так что массив побитового отображения DIB начинается на границе двойного слова.



Отметьте, что элемент bmiColors не должен содержать индексы палитры если побитовое отображение должно быть загружено в файл или передано в другое приложение. Если приложение не имеет исключительное использование и управление побитовым отображением, цветная таблица побитового отображения должна содержать явные величины RGB.



Смотри Также

BITMAPINFOHEADER, CreateDIBitmap, CreateDIBPatternBrush, CreateDIBSection, RGBQUAD


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz