1. with Interfaces;                        use Interfaces; 
  2. with System;                            use System; 
  3.  
  4. package Scale_X is 
  5.  
  6.     pragma Pure; 
  7.  
  8.     -- Scales source 2x to destination. 
  9.     -- 
  10.     -- dst     : address of destination bitmap 
  11.     -- dstXres : width in pixels of destination bitmap 
  12.     -- src     : address of source bitmap 
  13.     -- srcXres : width in pixels of source bitmap 
  14.     -- width   : width of top left area in source bitmap to scale 
  15.     -- height  : height of top left area in source bitmap to scale 
  16.     procedure Scale2x( dst     : Address; 
  17.                        dstXres : Unsigned_32; 
  18.                        src     : Address; 
  19.                        srcXres : Unsigned_32; 
  20.                        width, 
  21.                        height  : Positive ); 
  22.     pragma Precondition( dst /= Null_Address ); 
  23.     pragma Precondition( src /= Null_Address ); 
  24.     pragma Precondition( Unsigned_32(width) <= srcXres ); 
  25.     pragma Precondition( dstXres >= Unsigned_32(width) * 2 ); 
  26.  
  27.     -- Scales source 3x to destination. 
  28.     -- 
  29.     -- dst     : address of destination bitmap 
  30.     -- dstXres : width in pixels of destination bitmap 
  31.     -- src     : address of source bitmap 
  32.     -- srcXres : width in pixels of source bitmap 
  33.     -- width   : width of top left area in source bitmap to scale 
  34.     -- height  : height of top left area in source bitmap to scale 
  35.     procedure Scale3x( dst     : Address; 
  36.                        dstXres : Unsigned_32; 
  37.                        src     : Address; 
  38.                        srcXres : Unsigned_32; 
  39.                        width, 
  40.                        height  : Positive ); 
  41.     pragma Precondition( dst /= Null_Address ); 
  42.     pragma Precondition( src /= Null_Address ); 
  43.     pragma Precondition( Unsigned_32(width) <= srcXres ); 
  44.     pragma Precondition( dstXres >= Unsigned_32(width) * 3 ); 
  45.  
  46.     -- Scales source 4x to destination, returning True on success. This function 
  47.     -- essentially applies the scale2x function twice. The function could 
  48.     -- possibly fail there isn't enough memory available for a temporary bitmap. 
  49.     -- 
  50.     -- dst     : address of destination bitmap 
  51.     -- dstXres : width in pixels of destination bitmap 
  52.     -- src     : address of source bitmap 
  53.     -- srcXres : width in pixels of source bitmap 
  54.     -- width   : width of top left area in source bitmap to scale 
  55.     -- height  : height of top left area in source bitmap to scale 
  56.     function Scale4x( dst     : Address; 
  57.                       dstXres : Unsigned_32; 
  58.                       src     : Address; 
  59.                       srcXres : Unsigned_32; 
  60.                       width, 
  61.                       height  : Positive ) return Boolean; 
  62.     pragma Precondition( dst /= Null_Address ); 
  63.     pragma Precondition( src /= Null_Address ); 
  64.     pragma Precondition( Unsigned_32(width) <= srcXres ); 
  65.     pragma Precondition( dstXres >= Unsigned_32(width) * 4 ); 
  66.  
  67.     -- Scales source 2x wide by 3x high to destination. 
  68.     -- 
  69.     -- dst     : address of destination bitmap 
  70.     -- dstXres : width in pixels of destination bitmap 
  71.     -- src     : address of source bitmap 
  72.     -- srcXres : width in pixels of source bitmap 
  73.     -- width   : width of top left area in source bitmap to scale 
  74.     -- height  : height of top left area in source bitmap to scale 
  75.     procedure Scale2x3( dst     : Address; 
  76.                         dstXres : Unsigned_32; 
  77.                         src     : Address; 
  78.                         srcXres : Unsigned_32; 
  79.                         width, 
  80.                         height  : Positive ); 
  81.     pragma Precondition( dst /= Null_Address ); 
  82.     pragma Precondition( src /= Null_Address ); 
  83.     pragma Precondition( Unsigned_32(width) <= srcXres ); 
  84.     pragma Precondition( dstXres >= Unsigned_32(width) * 2 ); 
  85.  
  86.     -- Scales source 2x wide by 4x high to destination. 
  87.     -- 
  88.     -- dst     : address of destination bitmap 
  89.     -- dstXres : width in pixels of destination bitmap 
  90.     -- src     : address of source bitmap 
  91.     -- srcXres : width in pixels of source bitmap 
  92.     -- width   : width of top left area in source bitmap to scale 
  93.     -- height  : height of top left area in source bitmap to scale 
  94.     procedure Scale2x4( dst     : Address; 
  95.                         dstXres : Unsigned_32; 
  96.                         src     : Address; 
  97.                         srcXres : Unsigned_32; 
  98.                         width, 
  99.                         height  : Positive ); 
  100.     pragma Precondition( dst /= Null_Address ); 
  101.     pragma Precondition( src /= Null_Address ); 
  102.     pragma Precondition( Unsigned_32(width) <= srcXres ); 
  103.     pragma Precondition( dstXres >= Unsigned_32(width) * 2 ); 
  104.  
  105. end Scale_X;