scale.bas

 BBS: Inland Empire Archive
Date: 08-15-92 (20:40)             Number: 118
From: BRETT LEVIN                  Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: scale.bas                      Conf: (2) Quik_Bas
     Here's some code to scale images.  It works, but it is sloooowwwww
(maybe even slower than Rich's LZSS compressor :) )...  Please take a
look and help me out.  Also, I'm trying to figure out how to get it to
accept a negative ScaleFactor so it can flip the image.  TIA!

   Cut-Here-------------------------------------------------
'   SCALES.BAS By Brett Levin 8/15/92
'
DEFINT A-Z
SCREEN 9, , 0, 1
DIM Image(10, 10)
apage = 0: vpage = 1

PSET (2, 0), 15
PSET (7, 0), 15
LINE (0, 5)-(2, 7), 15
LINE (2, 7)-(7, 7), 15
LINE (7, 7)-(9, 5), 15

GetImage:
  FOR x = 0 TO 9
  FOR y = 0 TO 9
    Image(x, y) = POINT(x, y)
  NEXT y
  NEXT x
CLS

FOR t! = 1 TO 5 STEP .1

ScaleFactorX! = 5
ScaleFactorY! = t!
Xsize = INT(10 * ScaleFactorX!)      'Length of image * ScaleFactor
Ysize = INT(10 * ScaleFactorY!)

PutImage:
  FOR x = 0 TO Xsize
  FOR y = 0 TO Ysize
    PSET (x + 50, y + 50), Image(INT(x / ScaleFactorX!),
INT(y / ScaleFactorY!)
  NEXT y
  NEXT x

SWAP apage, vpage
SCREEN 9, , apage, vpage

NEXT t!
SLEEP
CLS
SYSTEM
   ---------------------------------------------------------

Brett

 * SLMR 2.1a * Support your right to keep and arm bears!


--- WM v2.04/91-0049
 * Origin: Reservation Only! Las Vegas,Nv~702-898-8630~ (1:209/721)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET