🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DelphiX draw problem

Started by
1 comment, last by enker 19 years, 11 months ago
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. :)
Advertisement
After trying to get StretchDraw to work (which didn't succeed), I made it work with the normal draw function:

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.
I'll try the solution out, thanks!

I know my English sucks, so please I only ask for some patience. :)

This topic is closed to new replies.

Advertisement