BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Flip bitmaps

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
RSK
Guest





PostPosted: Mon Jun 14, 2004 6:11 am    Post subject: Flip bitmaps Reply with quote



Hi,
Is there a rtl or api function to flip a bitmap image?

Thanks,
RSK.


Back to top
Yannis
Guest





PostPosted: Mon Jun 14, 2004 8:43 am    Post subject: Re: Flip bitmaps Reply with quote



Hi,

Here is my routine to do flipping using the windows strechdraw routine.
Hope this helps.

I have heard varius stories about failure of the below technik but I
haven't encounter any my self. It is said that because this technick
is using the stretch draw it is driver dependent which meens that in
some graphic cards it might not work as expected. I haven't seen any
problems until now but then again I'm using it internally only.

Type
TMirror = (mtHorizontal, mtVertical, mtBoth);

procedure Mirror(Picuter:Tpicture; MirrorType: TMirror);
var
MemBmp: Graphics.TBitmap;
Dest: TRect;
begin
if Assigned(Picture.Graphic) then
begin
MemBmp := Graphics.TBitmap.Create;
try
MemBmp.PixelFormat := pf24bit;
MemBmp.HandleType := bmDIB;
MemBmp.Width := Self.Picture.Graphic.Width;
MemBmp.Height := Self.Picture.Height;
MemBmp.Canvas.Draw(0, 0, Picture.Graphic);

case MirrorType of
mtHorizontal:
begin
//SpiegelnVertikal(MemBmp);
//SpiegelnHorizontal(MemBmp);
Dest.Left := MemBmp.Width;
Dest.Top := 0;
Dest.Right := -MemBmp.Width;
Dest.Bottom := MemBmp.Height;
end;
mtVertical:
begin
Dest.Left := 0;
Dest.Top := MemBmp.Height;
Dest.Right := MemBmp.Width;
Dest.Bottom := -MemBmp.Height;
end;
mtBoth:
begin
Dest.Left := MemBmp.Width;
Dest.Top := MemBmp.Height;
Dest.Right := -MemBmp.Width;
Dest.Bottom := -MemBmp.Height;
end;
end;

StretchBlt(MemBmp.Canvas.Handle, Dest.Left, Dest.Top, Dest.Right,
Dest.Bottom,
MemBmp.Canvas.Handle, 0, 0, MemBmp.Width,
MemBmp.Height, SRCCOPY);

Picture.Graphic.Assign(MemBmp);
Invalidate;
finally
FreeAndNil(MemBmp);
end;
end;
end;

Regards
Yannis.

"RSK" <Tecdiscuss (AT) Yahoo (DOT) com> wrote in
news:40cd418f (AT) newsgroups (DOT) borland.com:

Quote:
Hi,
Is there a rtl or api function to flip a bitmap image?

Thanks,
RSK.



Back to top
RSK
Guest





PostPosted: Sun Jun 20, 2004 2:04 pm    Post subject: Re: Flip bitmaps Reply with quote



Hi Yannis,
Thank you for your help,
best regards,
RSK.

"Yannis" <None (AT) Noware (DOT) non> wrote

Quote:
Hi,

Here is my routine to do flipping using the windows strechdraw routine.
Hope this helps.

I have heard varius stories about failure of the below technik but I
haven't encounter any my self. It is said that because this technick
is using the stretch draw it is driver dependent which meens that in
some graphic cards it might not work as expected. I haven't seen any
problems until now but then again I'm using it internally only.

Type
TMirror = (mtHorizontal, mtVertical, mtBoth);

procedure Mirror(Picuter:Tpicture; MirrorType: TMirror);
var
MemBmp: Graphics.TBitmap;
Dest: TRect;
begin
if Assigned(Picture.Graphic) then
begin
MemBmp := Graphics.TBitmap.Create;
try
MemBmp.PixelFormat := pf24bit;
MemBmp.HandleType := bmDIB;
MemBmp.Width := Self.Picture.Graphic.Width;
MemBmp.Height := Self.Picture.Height;
MemBmp.Canvas.Draw(0, 0, Picture.Graphic);

case MirrorType of
mtHorizontal:
begin
//SpiegelnVertikal(MemBmp);
//SpiegelnHorizontal(MemBmp);
Dest.Left := MemBmp.Width;
Dest.Top := 0;
Dest.Right := -MemBmp.Width;
Dest.Bottom := MemBmp.Height;
end;
mtVertical:
begin
Dest.Left := 0;
Dest.Top := MemBmp.Height;
Dest.Right := MemBmp.Width;
Dest.Bottom := -MemBmp.Height;
end;
mtBoth:
begin
Dest.Left := MemBmp.Width;
Dest.Top := MemBmp.Height;
Dest.Right := -MemBmp.Width;
Dest.Bottom := -MemBmp.Height;
end;
end;

StretchBlt(MemBmp.Canvas.Handle, Dest.Left, Dest.Top, Dest.Right,
Dest.Bottom,
MemBmp.Canvas.Handle, 0, 0, MemBmp.Width,
MemBmp.Height, SRCCOPY);

Picture.Graphic.Assign(MemBmp);
Invalidate;
finally
FreeAndNil(MemBmp);
end;
end;
end;

Regards
Yannis.

"RSK" <Tecdiscuss (AT) Yahoo (DOT) com> wrote in
news:40cd418f (AT) newsgroups (DOT) borland.com:

Hi,
Is there a rtl or api function to flip a bitmap image?

Thanks,
RSK.





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.