Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars » StarInfo/Johns/Doc

StarInfo/Johns/Doc

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars
Filename: StarInfo/Johns/Doc
Read OK:
File size: 03A5 bytes
Load address: 0000
Exec address: 0000
File contents
JPEG screensaver
================

This utility used the CompressJPEG Module to save the screen as a JPEG image.
First of all the size and depth of the screen is established, and these are
used in the CompressJPEG_Start SWI. The screen is then taken line-by-line
and given to the module. The pixels are read directly off the screen, and
the program translates the values into the RGB bytestream needed by
CompressJPEG. Finally, when all the lines have been processed, the SWI
CompressJPEG_Finish is called, and the output file is saved onto disc.

To help make the process as fast as possible, there are hand-coded veneers
for CompressJPEG_WriteLine and Hourglass_Percentage, as there are called
from within the main processing loop for every line, and the hand-coded
veneers are faster than using the general SWI calling functions.

The JPEG screen saver will work in all modes with 4 or more bits per pixel,
ie. 16 colours and up.
00000000  4a 50 45 47 20 73 63 72  65 65 6e 73 61 76 65 72  |JPEG screensaver|
00000010  0a 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.===============|
00000020  3d 0a 0a 54 68 69 73 20  75 74 69 6c 69 74 79 20  |=..This utility |
00000030  75 73 65 64 20 74 68 65  20 43 6f 6d 70 72 65 73  |used the Compres|
00000040  73 4a 50 45 47 20 4d 6f  64 75 6c 65 20 74 6f 20  |sJPEG Module to |
00000050  73 61 76 65 20 74 68 65  20 73 63 72 65 65 6e 20  |save the screen |
00000060  61 73 20 61 20 4a 50 45  47 20 69 6d 61 67 65 2e  |as a JPEG image.|
00000070  0a 46 69 72 73 74 20 6f  66 20 61 6c 6c 20 74 68  |.First of all th|
00000080  65 20 73 69 7a 65 20 61  6e 64 20 64 65 70 74 68  |e size and depth|
00000090  20 6f 66 20 74 68 65 20  73 63 72 65 65 6e 20 69  | of the screen i|
000000a0  73 20 65 73 74 61 62 6c  69 73 68 65 64 2c 20 61  |s established, a|
000000b0  6e 64 20 74 68 65 73 65  20 61 72 65 0a 75 73 65  |nd these are.use|
000000c0  64 20 69 6e 20 74 68 65  20 43 6f 6d 70 72 65 73  |d in the Compres|
000000d0  73 4a 50 45 47 5f 53 74  61 72 74 20 53 57 49 2e  |sJPEG_Start SWI.|
000000e0  20 54 68 65 20 73 63 72  65 65 6e 20 69 73 20 74  | The screen is t|
000000f0  68 65 6e 20 74 61 6b 65  6e 20 6c 69 6e 65 2d 62  |hen taken line-b|
00000100  79 2d 6c 69 6e 65 0a 61  6e 64 20 67 69 76 65 6e  |y-line.and given|
00000110  20 74 6f 20 74 68 65 20  6d 6f 64 75 6c 65 2e 20  | to the module. |
00000120  54 68 65 20 70 69 78 65  6c 73 20 61 72 65 20 72  |The pixels are r|
00000130  65 61 64 20 64 69 72 65  63 74 6c 79 20 6f 66 66  |ead directly off|
00000140  20 74 68 65 20 73 63 72  65 65 6e 2c 20 61 6e 64  | the screen, and|
00000150  0a 74 68 65 20 70 72 6f  67 72 61 6d 20 74 72 61  |.the program tra|
00000160  6e 73 6c 61 74 65 73 20  74 68 65 20 76 61 6c 75  |nslates the valu|
00000170  65 73 20 69 6e 74 6f 20  74 68 65 20 52 47 42 20  |es into the RGB |
00000180  62 79 74 65 73 74 72 65  61 6d 20 6e 65 65 64 65  |bytestream neede|
00000190  64 20 62 79 0a 43 6f 6d  70 72 65 73 73 4a 50 45  |d by.CompressJPE|
000001a0  47 2e 20 46 69 6e 61 6c  6c 79 2c 20 77 68 65 6e  |G. Finally, when|
000001b0  20 61 6c 6c 20 74 68 65  20 6c 69 6e 65 73 20 68  | all the lines h|
000001c0  61 76 65 20 62 65 65 6e  20 70 72 6f 63 65 73 73  |ave been process|
000001d0  65 64 2c 20 74 68 65 20  53 57 49 0a 43 6f 6d 70  |ed, the SWI.Comp|
000001e0  72 65 73 73 4a 50 45 47  5f 46 69 6e 69 73 68 20  |ressJPEG_Finish |
000001f0  69 73 20 63 61 6c 6c 65  64 2c 20 61 6e 64 20 74  |is called, and t|
00000200  68 65 20 6f 75 74 70 75  74 20 66 69 6c 65 20 69  |he output file i|
00000210  73 20 73 61 76 65 64 20  6f 6e 74 6f 20 64 69 73  |s saved onto dis|
00000220  63 2e 0a 0a 54 6f 20 68  65 6c 70 20 6d 61 6b 65  |c...To help make|
00000230  20 74 68 65 20 70 72 6f  63 65 73 73 20 61 73 20  | the process as |
00000240  66 61 73 74 20 61 73 20  70 6f 73 73 69 62 6c 65  |fast as possible|
00000250  2c 20 74 68 65 72 65 20  61 72 65 20 68 61 6e 64  |, there are hand|
00000260  2d 63 6f 64 65 64 20 76  65 6e 65 65 72 73 0a 66  |-coded veneers.f|
00000270  6f 72 20 43 6f 6d 70 72  65 73 73 4a 50 45 47 5f  |or CompressJPEG_|
00000280  57 72 69 74 65 4c 69 6e  65 20 61 6e 64 20 48 6f  |WriteLine and Ho|
00000290  75 72 67 6c 61 73 73 5f  50 65 72 63 65 6e 74 61  |urglass_Percenta|
000002a0  67 65 2c 20 61 73 20 74  68 65 72 65 20 61 72 65  |ge, as there are|
000002b0  20 63 61 6c 6c 65 64 0a  66 72 6f 6d 20 77 69 74  | called.from wit|
000002c0  68 69 6e 20 74 68 65 20  6d 61 69 6e 20 70 72 6f  |hin the main pro|
000002d0  63 65 73 73 69 6e 67 20  6c 6f 6f 70 20 66 6f 72  |cessing loop for|
000002e0  20 65 76 65 72 79 20 6c  69 6e 65 2c 20 61 6e 64  | every line, and|
000002f0  20 74 68 65 20 68 61 6e  64 2d 63 6f 64 65 64 0a  | the hand-coded.|
00000300  76 65 6e 65 65 72 73 20  61 72 65 20 66 61 73 74  |veneers are fast|
00000310  65 72 20 74 68 61 6e 20  75 73 69 6e 67 20 74 68  |er than using th|
00000320  65 20 67 65 6e 65 72 61  6c 20 53 57 49 20 63 61  |e general SWI ca|
00000330  6c 6c 69 6e 67 20 66 75  6e 63 74 69 6f 6e 73 2e  |lling functions.|
00000340  0a 0a 54 68 65 20 4a 50  45 47 20 73 63 72 65 65  |..The JPEG scree|
00000350  6e 20 73 61 76 65 72 20  77 69 6c 6c 20 77 6f 72  |n saver will wor|
00000360  6b 20 69 6e 20 61 6c 6c  20 6d 6f 64 65 73 20 77  |k in all modes w|
00000370  69 74 68 20 34 20 6f 72  20 6d 6f 72 65 20 62 69  |ith 4 or more bi|
00000380  74 73 20 70 65 72 20 70  69 78 65 6c 2c 0a 69 65  |ts per pixel,.ie|
00000390  2e 20 31 36 20 63 6f 6c  6f 75 72 73 20 61 6e 64  |. 16 colours and|
000003a0  20 75 70 2e 0a                                    | up..|
000003a5