Beispiel #1
0
BOOL init_dib_info_from_brush(dib_info *dib, const BITMAPINFO *bi, void *bits, UINT usage, HPALETTE palette)
{
    DWORD *masks = (bi->bmiHeader.biCompression == BI_BITFIELDS) ? (DWORD *)bi->bmiColors : NULL;
    RGBQUAD *color_table = NULL, pal_table[256];
    int num_colors = get_dib_num_of_colors( bi );

    if(num_colors)
    {
        if(usage == DIB_PAL_COLORS)
        {
            PALETTEENTRY entries[256];
            const WORD *index = (const WORD *)bi->bmiColors;
            UINT i, count = GetPaletteEntries( palette, 0, num_colors, entries );
            for (i = 0; i < num_colors; i++, index++)
            {
                PALETTEENTRY *entry = &entries[*index % count];
                pal_table[i].rgbRed      = entry->peRed;
                pal_table[i].rgbGreen    = entry->peGreen;
                pal_table[i].rgbBlue     = entry->peBlue;
                pal_table[i].rgbReserved = 0;
            }
            color_table = pal_table;
        }
        else color_table = (RGBQUAD *)bi->bmiColors;
    }
    return init_dib_info(dib, &bi->bmiHeader, masks, color_table, num_colors, bits, private_color_table);
}
Beispiel #2
0
BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
{
    unsigned int colors = get_dib_num_of_colors( info );
    void *colorptr = (char *)&info->bmiHeader + info->bmiHeader.biSize;
    const DWORD *bitfields = (info->bmiHeader.biCompression == BI_BITFIELDS) ? (DWORD *)colorptr : NULL;

    return init_dib_info( dib, &info->bmiHeader, bitfields, colors ? colorptr : NULL, colors, bits, flags );
}
Beispiel #3
0
Datei: dc.c Projekt: Barrell/wine
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp)
{
    if (!is_bitmapobj_dib( bmp ))
    {
        BITMAPINFO info;

        get_ddb_bitmapinfo( bmp, &info );
        if (!bmp->dib.dsBm.bmBits)
        {
            int width_bytes = get_dib_stride( bmp->dib.dsBm.bmWidth, bmp->dib.dsBm.bmBitsPixel );
            bmp->dib.dsBm.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
                                              bmp->dib.dsBm.bmHeight * width_bytes );
            if (!bmp->dib.dsBm.bmBits) return FALSE;
        }
        init_dib_info_from_bitmapinfo( dib, &info, bmp->dib.dsBm.bmBits );
    }
    else init_dib_info( dib, &bmp->dib.dsBmih, bmp->dib.dsBitfields,
                        bmp->color_table, bmp->dib.dsBm.bmBits );
    return TRUE;
}
Beispiel #4
0
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
{
    if (!bmp->dib)
    {
        char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
        BITMAPINFO *info = (BITMAPINFO *)buffer;

        get_ddb_bitmapinfo( bmp, info );
        if (!bmp->bitmap.bmBits)
        {
            int width_bytes = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
            bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
                                            bmp->bitmap.bmHeight * width_bytes );
            if (!bmp->bitmap.bmBits) return FALSE;
        }
        return init_dib_info_from_bitmapinfo( dib, info, bmp->bitmap.bmBits,
                                              flags | private_color_table );
    }
    return init_dib_info( dib, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
                          bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, flags );
}
Beispiel #5
0
Datei: dc.c Projekt: Barrell/wine
void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits)
{
    init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors, info->bmiColors, bits );
}