Qt: make TQtImage.FHandle private, introduce Handle readonly property. issue #21235

git-svn-id: trunk@35203 -
This commit is contained in:
zeljko 2012-02-07 07:38:40 +00:00
parent 7111abfa8d
commit 7a324ede40
6 changed files with 19 additions and 19 deletions

View File

@ -664,11 +664,11 @@ begin
end end
else begin else begin
WorkImage := TQtImage.Create; WorkImage := TQtImage.Create;
WorkImage.CopyFrom(Image.FHandle, R.Left, R.Top, Width, Height); WorkImage.CopyFrom(Image.Handle, R.Left, R.Top, Width, Height);
if Mask <> nil then if Mask <> nil then
begin begin
WorkMask := TQtImage.Create; WorkMask := TQtImage.Create;
WorkMask.CopyFrom(Mask.FHandle, R.Left, R.Top, Width, Height); WorkMask.CopyFrom(Mask.Handle, R.Left, R.Top, Width, Height);
end end
else else
WorkMask := nil; WorkMask := nil;
@ -695,13 +695,13 @@ begin
InvertPixels := False; InvertPixels := False;
if WorkImage <> nil then if WorkImage <> nil then
begin begin
Px := QImage_pixel(WorkImage.FHandle, 0, 0); Px := QImage_pixel(WorkImage.Handle, 0, 0);
InvertPixels := InvertPixels :=
not QImage_hasAlphaChannel(WorkMask.FHandle) and not QImage_hasAlphaChannel(WorkMask.Handle) and
not QImage_hasAlphaChannel(WorkImage.FHandle) and not QImage_hasAlphaChannel(WorkImage.Handle) and
// invert only if WorkImage is RGB32 fmt and allGray // invert only if WorkImage is RGB32 fmt and allGray
(WorkImage.getFormat = QImageFormat_RGB32) and (WorkImage.getFormat = QImageFormat_RGB32) and
QImage_allGray(WorkImage.FHandle) and QImage_allGray(WorkImage.Handle) and
((Px = 0) or (Px = $FF)) ((Px = 0) or (Px = $FF))
end; end;
if InvertPixels then if InvertPixels then
@ -796,7 +796,7 @@ begin
end else end else
begin begin
if Context.vImage <> nil then if Context.vImage <> nil then
RawImage_FromImage(Context.vImage.FHandle) RawImage_FromImage(Context.vImage.Handle)
else else
if Context.ParentPixmap <> nil then if Context.ParentPixmap <> nil then
begin begin

View File

@ -840,7 +840,7 @@ begin
if (TQtDeviceContext(CanvasHandle).vImage <> nil) then if (TQtDeviceContext(CanvasHandle).vImage <> nil) then
begin begin
Color := QColor_create(QImage_pixel(TQtDeviceContext(CanvasHandle).vImage.FHandle, X, Y)); Color := QColor_create(QImage_pixel(TQtDeviceContext(CanvasHandle).vImage.Handle, X, Y));
Result := RGBToColor(QColor_red(Color), QColor_green(Color), QColor_blue(Color)); Result := RGBToColor(QColor_red(Color), QColor_green(Color), QColor_blue(Color));
QColor_destroy(Color); QColor_destroy(Color);
end; end;

View File

@ -140,7 +140,6 @@ type
private private
FData: PByte; FData: PByte;
FDataOwner: Boolean; FDataOwner: Boolean;
public
FHandle: QImageH; FHandle: QImageH;
public public
constructor Create; constructor Create;
@ -163,6 +162,7 @@ type
function bytesPerLine: Integer; function bytesPerLine: Integer;
procedure invertPixels(InvertMode: QImageInvertMode = QImageInvertRgb); procedure invertPixels(InvertMode: QImageInvertMode = QImageInvertRgb);
function getFormat: QImageFormat; function getFormat: QImageFormat;
property Handle: QImageH read FHandle;
end; end;
{ TQtFont } { TQtFont }

View File

@ -431,7 +431,7 @@ begin
BS_PATTERN, // Pattern brush defined by a memory bitmap. BS_PATTERN, // Pattern brush defined by a memory bitmap.
BS_PATTERN8X8: // Same as BS_PATTERN. BS_PATTERN8X8: // Same as BS_PATTERN.
begin begin
QtBrush.setTextureImage(TQtImage(LogBrush.lbHatch).FHandle); QtBrush.setTextureImage(TQtImage(LogBrush.lbHatch).Handle);
QtBrush.Style := QtTexturePattern; QtBrush.Style := QtTexturePattern;
end; end;
else else
@ -605,7 +605,7 @@ begin
if IsValidGDIObject(IconInfo^.hbmColor) then if IsValidGDIObject(IconInfo^.hbmColor) then
begin begin
APixmap := QPixmap_create(); APixmap := QPixmap_create();
QPixmap_fromImage(APixmap, TQtImage(IconInfo^.hbmColor).FHandle); QPixmap_fromImage(APixmap, TQtImage(IconInfo^.hbmColor).Handle);
{$IFDEF DARWIN} {$IFDEF DARWIN}
AImgFmt := TQtImage(IconInfo^.hbmColor).getFormat; AImgFmt := TQtImage(IconInfo^.hbmColor).getFormat;
if (AImgFmt in [QImageFormat_Mono, QImageFormat_MonoLSB, if (AImgFmt in [QImageFormat_Mono, QImageFormat_MonoLSB,
@ -614,7 +614,7 @@ begin
if IconInfo^.hbmMask <> 0 then if IconInfo^.hbmMask <> 0 then
begin begin
ATemp := QPixmap_create(); ATemp := QPixmap_create();
QPixmap_fromImage(ATemp, TQtImage(IconInfo^.hbmMask).FHandle); QPixmap_fromImage(ATemp, TQtImage(IconInfo^.hbmMask).Handle);
AMask := QBitmap_create(ATemp); AMask := QBitmap_create(ATemp);
QPixmap_setMask(APixmap, AMask); QPixmap_setMask(APixmap, AMask);
QPixmap_destroy(ATemp); QPixmap_destroy(ATemp);
@ -649,7 +649,7 @@ begin
if ABitmap = 0 then if ABitmap = 0 then
exit; exit;
QtBrush := TQtBrush.Create(True); QtBrush := TQtBrush.Create(True);
Image := QImage_create(TQtImage(ABitmap).FHandle); Image := QImage_create(TQtImage(ABitmap).Handle);
try try
QtBrush.setTextureImage(Image); QtBrush.setTextureImage(Image);
finally finally
@ -848,7 +848,7 @@ begin
// we must stop paintdevice before destroying // we must stop paintdevice before destroying
APaintEngine := QImage_paintEngine(TQtImage(AObject).FHandle); APaintEngine := QImage_paintEngine(TQtImage(AObject).Handle);
if (APaintEngine <> nil) and QPaintEngine_isActive(APaintEngine) then if (APaintEngine <> nil) and QPaintEngine_isActive(APaintEngine) then
begin begin
@ -2396,7 +2396,7 @@ begin
if (Bitmap = 0) or (Count <= 0) then if (Bitmap = 0) or (Count <= 0) then
Exit; Exit;
Image := QImage_create(TQtImage(Bitmap).FHandle); Image := QImage_create(TQtImage(Bitmap).Handle);
try try
Result := (QImage_width(Image) * QImage_height(Image) * QImage_depth(Image) + 7) div 8; Result := (QImage_width(Image) * QImage_height(Image) * QImage_depth(Image) + 7) div 8;
if Count < Result then if Count < Result then
@ -6273,7 +6273,7 @@ begin
Exit; Exit;
end end
else else
Image := SrcQDC.vImage.FHandle; Image := SrcQDC.vImage.Handle;
QTransform_map(SrcMatrix, XSrc, YSrc, @XSrc, @YSrc); QTransform_map(SrcMatrix, XSrc, YSrc, @XSrc, @YSrc);
// our map can have some transformations // our map can have some transformations
@ -6315,7 +6315,7 @@ begin
//DstQDC.CorrectCoordinates(SrcRect); //DstQDC.CorrectCoordinates(SrcRect);
//DstQDC.CorrectCoordinates(MaskRect); //DstQDC.CorrectCoordinates(MaskRect);
if Mask <> 0 then if Mask <> 0 then
QMask := TQtImage(Mask).FHandle QMask := TQtImage(Mask).Handle
else else
QMask := nil; QMask := nil;

View File

@ -111,7 +111,7 @@ begin
begin begin
AValue.GetImageIndexAndEffect(IconModeToButtonState[Mode], AIndex, AEffect); AValue.GetImageIndexAndEffect(IconModeToButtonState[Mode], AIndex, AEffect);
AValue.Images.GetBitmap(AIndex, AGlyph, AEffect); AValue.Images.GetBitmap(AIndex, AGlyph, AEffect);
QPixmap_fromImage(APixmap, TQtImage(AGlyph.Handle).FHandle); QPixmap_fromImage(APixmap, TQtImage(AGlyph.Handle).Handle);
QIcon_addPixmap(AIcon, APixmap, Mode, QIconOn); QIcon_addPixmap(AIcon, APixmap, Mode, QIconOn);
end; end;
QPixmap_destroy(APixmap); QPixmap_destroy(APixmap);

View File

@ -668,7 +668,7 @@ begin
end; end;
Result := TQtWidgetset(Widgetset).DragImageList_BeginDrag( Result := TQtWidgetset(Widgetset).DragImageList_BeginDrag(
TQtImage(ABitmap.Handle).FHandle, ADragImageList.DragHotSpot); TQtImage(ABitmap.Handle).Handle, ADragImageList.DragHotSpot);
if Result then if Result then
TQtWidgetset(Widgetset).DragImageList_DragMove(X, Y); TQtWidgetset(Widgetset).DragImageList_DragMove(X, Y);
ABitmap.Free; ABitmap.Free;