TQtImage.AsPixmap

git-svn-id: trunk@11460 -
This commit is contained in:
paul 2007-07-11 08:37:31 +00:00
parent af8e274993
commit 77dc0b4f95

View File

@ -80,6 +80,7 @@ type
constructor Create(Adata: PByte; width: Integer; height: Integer; format: QImageFormat); overload; constructor Create(Adata: PByte; width: Integer; height: Integer; format: QImageFormat); overload;
destructor Destroy; override; destructor Destroy; override;
function AsIcon(AMode: QIconMode = QIconNormal; AState: QIconState = QIconOff): QIconH; function AsIcon(AMode: QIconMode = QIconNormal; AState: QIconState = QIconOff): QIconH;
function AsPixmap: QPixmapH;
public public
function height: Integer; function height: Integer;
function width: Integer; function width: Integer;
@ -460,14 +461,19 @@ function TQtImage.AsIcon(AMode: QIconMode = QIconNormal; AState: QIconState = QI
var var
APixmap: QPixmapH; APixmap: QPixmapH;
begin begin
APixmap := QPixmap_create(); APixmap := AsPixmap;
QPixmap_fromImage(APixmap, Handle);
Result := QIcon_create(); Result := QIcon_create();
if Result <> nil then if Result <> nil then
QIcon_addPixmap(Result, APixmap, AMode, AState); QIcon_addPixmap(Result, APixmap, AMode, AState);
QPixmap_destroy(APixmap); QPixmap_destroy(APixmap);
end; end;
function TQtImage.AsPixmap: QPixmapH;
begin
Result := QPixmap_create();
QPixmap_fromImage(Result, Handle);
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TQtImage.height Method: TQtImage.height
Params: None Params: None