Advertisement
Gov_777

Спрайты

Jan 20th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.02 KB | None | 0 0
  1. procedure Toperations.Timer1Timer(Sender: TObject);
  2. var
  3. Sprite,Mask,Buffer:Tbitmap;
  4. begin
  5. SetImage('FON',ImageFon);
  6. Sprite:=Tbitmap.Create;
  7. Buffer:=Tbitmap.Create;
  8. Mask:=Tbitmap.Create;
  9. Sprite.LoadFromResourceName(HInstance, 'Bitmap_b64');
  10. Mask.LoadFromResourceName(HInstance, 'Bitmap_b64');
  11. //
  12. Mask.Height:=Sprite.Height-y1;
  13. Mask.Width:=Sprite.Width-x1;
  14. Buffer.Height:=Sprite.Height-y1;
  15. Buffer.Width:=Sprite.Width-x1;
  16.  
  17. //изменение размера
  18. SetStretchBltMode(Buffer.Canvas.Handle, HALFTONE);
  19. StretchBlt(Mask.Canvas.Handle, 0, 0, Sprite.Width-x1, Sprite.Height-y1, Sprite.Canvas.Handle, 0, 0, Sprite.Width, Sprite.Height, SRCCOPY);
  20. StretchBlt(Buffer.Canvas.Handle, 0, 0, Sprite.Width-x1, Sprite.Height-y1, Sprite.Canvas.Handle, 0, 0, Sprite.Width, Sprite.Height, SRCCOPY);
  21. //вывод
  22. SetStretchBltMode(Buffer.Canvas.Handle, BLACKONWHITE);
  23. SetStretchBltMode(Buffer.Canvas.Handle, COLORONCOLOR);
  24. //SetStretchBltMode(Buffer.Canvas.Handle, WHITEONBLACK);
  25. Mask.Mask(clBlack);
  26. MaskBlt(ImageFon.Picture.Bitmap.Canvas.Handle,FLEFT, FTOP, Buffer.Width, Buffer.Height, Buffer.Canvas.Handle,0,0,Mask.MaskHandle,0,0,SRCPAINT);
  27. BitBlt(ImageFon.Picture.Bitmap.Canvas.Handle, FLEFT, FTOP, Buffer.Width, Buffer.Height, Buffer.Canvas.Handle,0,0, SRCPAINT);
  28. FTOP:=FTOP-3;
  29. FLEFT:=FLEFT+8;
  30.  
  31. inc(x1);
  32. inc(y1);
  33.  
  34. FreeAndNil(Mask);
  35. FreeAndNil(Sprite);
  36. FreeAndNil(Buffer);
  37.  
  38. if (x1>15) then  begin
  39. Timer1.Enabled:=False;
  40.  
  41. SetImage('FON',ImageFon);
  42. Sprite:=Tbitmap.Create;
  43. Mask:=Tbitmap.Create;
  44. Sprite.LoadFromResourceName(HInstance, 'Bitmap_b48');
  45. Mask.LoadFromResourceName(HInstance, 'Bitmap_b48');
  46. //
  47. Mask.Height:=Sprite.Height;
  48. Mask.Width:=Sprite.Width;
  49. Mask.Mask(clBlack);
  50. MaskBlt(ImageFon.Picture.Bitmap.Canvas.Handle, FLEFT,FTOP, Sprite.Width, Sprite.Height, Sprite.Canvas.Handle,0,0,Mask.MaskHandle,0,0,SRCPAINT);
  51. BitBlt(ImageFon.Picture.Bitmap.Canvas.Handle, FLEFT, FTOP, Sprite.Width, Sprite.Height, Sprite.Canvas.Handle,0,0, SRCPAINT);
  52. FreeAndNil(Mask);
  53. FreeAndNil(Sprite);
  54. Sleep(500);
  55. Timer2.Enabled:=True;
  56. end;
  57. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement