p_cnv.inc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {
  2. Free Pascal port of the Hermes C library.
  3. Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
  4. Original C version by Christian Nentwich ([email protected])
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. {
  18. C converter main loops for the HERMES library
  19. Copyright (c) 1998 Christian Nentwich ([email protected])
  20. This source code is licensed under the GNU LGPL
  21. Please refer to the file COPYING.LIB contained in the distribution for
  22. licensing conditions
  23. }
  24. Procedure ConvertP(iface : PHermesConverterInterface); CDecl;
  25. Begin
  26. { Simply loop through all scanlines }
  27. Repeat
  28. iface^.func(iface^.s_pixels, iface^.d_pixels, iface^.d_width, 1);
  29. Inc(iface^.s_pixels, iface^.s_pitch);
  30. Inc(iface^.d_pixels, iface^.d_pitch);
  31. Dec(iface^.d_height);
  32. Until iface^.d_height = 0;
  33. End;
  34. Procedure ConvertPStretch(iface : PHermesConverterInterface); CDecl;
  35. Var
  36. dx, dy : DWord;
  37. y : DWord;
  38. Begin
  39. y := 0;
  40. dy := (iface^.s_height Shl 16) Div iface^.d_height;
  41. dx := (iface^.s_width Shl 16) Div iface^.d_width;
  42. { We have the increment of y and x on the source surface now let's start }
  43. Repeat
  44. iface^.func(iface^.s_pixels, iface^.d_pixels, iface^.d_width, dx);
  45. Inc(iface^.d_pixels, iface^.d_pitch);
  46. Inc(y, dy);
  47. { Check how many lines we need to step forward }
  48. Inc(iface^.s_pixels, (y Shr 16)*DWord(iface^.s_pitch));
  49. y := y And $ffff;
  50. Dec(iface^.d_height);
  51. Until iface^.d_height = 0;
  52. End;