DelphiX draw problem
Well for start, I'm new at this DelphiX programming so I don't know to much. I want to draw an element of a TDXImageList object, but I want to draw it flipping it horizontally.
My problem is that Delphi X doesn't have any draw procedure that flips the image, so I tried to use the StretchDraw method in the TPictureCollectionItem object. But swaping the x coordinates (swaping the Left variable of the TRect record with the Right variable of the TRect) didn't worked, it draws nothing.
Then I tried drawing the image directly to the canvas of the surface property of TDXDraw object using StretchDraw method of the canvas. It actually worked well, It draws it horizontaly flipped, but it doesn't have transparency. I don't know what to do, I have tried a lot of diferent things and nothing worked.
By the way sorry for the bad English.
I know my English sucks, so please I only ask for some patience. :)
After trying to get StretchDraw to work (which didn't succeed), I made it work with the normal draw function:
Note that SrcRect.Top is the Image's Bottom and SrcRect.Bottom is the Image's Top.
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);var SrcRect: TRect;begin if not DXDraw1.CanDraw then Exit; SrcRect.Left:= DXImageList1.Items[0].PatternRects[0].Left; SrcRect.Right:= DXImageList1.Items[0].PatternRects[0].Right; SrcRect.Top:= DXImageList1.Items[0].PatternRects[0].Bottom; SrcRect.Bottom:= DXImageList1.Items[0].PatternRects[0].Top; DXDraw1.Surface.Draw(0,0,SrcRect,DXImageList1.Items[0].PatternSurfaces[0], True); DXDraw1.Flip;end;
Note that SrcRect.Top is the Image's Bottom and SrcRect.Bottom is the Image's Top.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement