Code: Alles auswählen
function Pixbuf2HBitmap(Pixbuf: PGDKPixbuf): HBitmap;
const
alpha_threshold = 151;
var
Pixmap: PGDIObject;
begin
Pixmap := GtkWidgetSet.NewGDIObject(gdiBitmap);
Pixmap^.GDIBitmapType := gbPixmap;
gdk_pixbuf_render_pixmap_and_mask(Pixbuf, Pixmap^.GDIPixmapObject.Image,
Pixmap^.GDIPixmapObject.Mask, alpha_threshold);
Result := HBitmap(PtrUInt(Pixmap));
end;
Hier ist die Qualität aber nicht besonders, wobei ich herausgefunden habe, dass es hauptsächlich am alpha_threshold Wert liegt.
Nun kann ich aber den Wert nicht fix im Programm einsetzen, da der optimale Wert von Grafik zu Grafik jeweils unterschiedlich ist.
Besteht die Möglichkeit den Wert aus einem Pixbuf heraus zu ermitteln oder
kennt jemand eine bessere Möglichkeit als gdk_pixbuf_render_pixmap_and_mask().
Gruß