目次

横スクロール

 横スクロールは、元画像からピクセルデータを取得しておき
 横方向の、どこに該当ピクセルデータを表示するかを指定する
 だけで実現できます。

 元画像を、円柱に貼り付けて、水平に指定量だけ
 回転後、展開して平面に戻す操作と同じになります。

 左に元画像、右に横スクロールした画像を表示させると
 次のようになります。
 (縦に、白線を入れて分かりやすくしています。)




処理内容

 シフト量を指定して、表示サブルーチンをコールします。  表示位置のX座標に、シフト量を加算し、画像サイズの  幅で割った余りを、シフト後のX座標にします。  正のシフト量に限定します。  元画像と並べて表示したいので、X座標に横幅+αの  値を加えています。 --------------------------------------------------  title "h scroll" ; set screen dimensions  screen 0,160*2+2,100 ; constants  ylast = 100  xlast = 160 ; get image  picload "crossx.bmp",1 ; shift  shift = 80  gosub *image_horizontal_shift  stop *image_horizontal_shift  for j,0,ylast,1   for i,0,xlast,1    ; get informations of current position    pget i,j    ; shift    k = i + shift    k \= xlast    ; show    pset k+xlast+2,j   next  next  return  end --------------------------------------------------  シフト量を、正負で扱いたい場合には、正の範囲で扱える  ように画像サイズの横幅分を加算します。 ++++++++++++++++++++++++++++++++++++++++++++++++++ *image_horizontal_shift  ; conversion  if (shift < 0) { shift += xlast }  for j,0,ylast,1   for i,0,xlast,1    ; get informations of current position    pget i,j    ; shift    k = i + shift    k \= xlast    ; show    pset k+xlast+2,j   next  next  return ++++++++++++++++++++++++++++++++++++++++++++++++++

目次

inserted by FC2 system