Announcement

Collapse
No announcement yet.

How to use GdipBitmapConvertFormat ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use GdipBitmapConvertFormat ?

    This is what I've written based on what I've found out so far, ...

    GdipGetImagePixelFormat hSourceImage, iPixel
    Other parts of function are already getting sizes, just needed pixel depth for clone

    hResult = GdipCloneBitmapAreaI ( 0, 0, imgSize.iWidth, imgSize.iHeight, iPixel, hSourceImage, hCloneImage )
    hResult = Status.Ok
    hCloneImage is non-zero

    LOCAL tPalette AS ColorPalette

    tPalette.Flags = 0
    tPalette.cCount = 255
    hResult = GdipInitializePalette ( tPalette, %PaletteTypeOptimal, 255, 0, hCloneImage )
    hResult = Status.Ok

    But either:
    hResult = GdipBitmapConvertFormat ( hCloneImage, %PixelFormat8bppIndexed, %DitherTypeNone, %PaletteTypeCustom, tPalette, 0 )
    or
    hResult = GdipBitmapConvertFormat ( hCloneImage, %PixelFormat8bppIndexed, %DitherTypeNone, %PaletteTypeFixedHalftone256, BYVAL 0, 0 )
    hResult = Status.InvalidParameter

    Constants & Types are from José's GdiPlusPixelFormats.inc
    Furcadia, an interesting online MMORPG in which you can create and program your own content.

  • #2
    Huh, this worked:
    hResult = GdipBitmapConvertFormat(hCloneImage, %PixelFormat8bppIndexed, %DitherTypeNone, %PaletteTypeFixedHalftone256, tPalette, 0)

    But the question would be, is it using the palette generated by the first step?
    Because the first palette generated would need to be the master palette in processing a bunch of images from 32bpp to 8bpp.
    Furcadia, an interesting online MMORPG in which you can create and program your own content.

    Comment

    Working...
    X