home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
fish
/
911-930
/
ff925
/
donsgenies
/
frenchgenies.lha
/
Rexx
/
ImporteS駲uencedImages.pprx
< prev
next >
Wrap
Text File
|
1993-08-03
|
6KB
|
162 lines
/*
@BImporteSéquenceD'Images @P @I Ecrit et © par Don Cox 1993
@IN'est pas du Domaine Publique. Tous Droits Réservés.
Traduit par Fabien Larini le 30/07/93.
Ce Génie importe une série d'images (celles d'une animation par exemple)
dans une page existante. Les pages nécessaires seront crées de la même
manière que dans le Génie ImportationAuto. Le contenu des boîtes est caché
afin de limiter la consommation de mémoire, deplus cela augmente la
vitesse de chargement du fichier.
*/
/*ImportFrames*/
/* Program to load a numbered series of pictures (usually animation frames)
onto an existing page. New pages are also created as in AutoImport. The box
contents are hidden because showing a large number of bitmaps can exhaust
chip memory; also, hiding the images greatly speeds up loading.
Written by Don Cox, 1993. Not Public Domain. All rights reserved. */
trace n
call SafeEndEdit.rexx()
call ppm_AutoUpdate(0)
oldunits = ppm_GetUnits()
call ppm_SetUnits(2)
oldpoints = ppm_GetSize()
call ppm_SetSize(12)
address command
currentpage = ppm_CurrentPage()
if currentpage = 0 then currentpage = ppm_CreatePage(1,1,1,0,0)
psize = ppm_GetPageSize(currentpage)
pwidth = word(psize,1)
if pwidth<5 then exit_msg("Page trop Petite")
pheight = word(psize,2)
filename = ppm_GetFileName("Première Image", "", "")
if filename = '' then exit_msg("Pas de fichier choisi")
form = "Images/Ligne (1-20):4"||"0a"x "Toute les :1"||"0a"x "Largeur Cadre (mm):1"
form = ppm_GetForm("Mise en Page",5,form)
if form = "" then exit_msg("Abandon Importation")
parse var form rownumber "0a"x interval "0a"x linewidth
if rownumber<1 | rownumber>20 then exit_msg("Nombre d'Images par Ligne Invalide: "rownumber)
if interval<1 then Exit_msg("Saisie Incorrecte pour l'intervalle des images chargées: "interval)
colgap = 0.5
rowgap = 1.5
pagemargin = 1.5
pagemargin2 = pagemargin * 2
collist = ppm_GetColorList()
collist = substr(collist, pos('0a'x, collist) +1) /* strip off initial line which is number of colours */
firstcolour = left(collist, pos('0a'x, collist)-1 )
linecolor = firstcolour
if datatype(linewidth, 'N') =1 then do
if linewidth =0 then break
linewidth = linewidth/10 /* convert to cm */
linecolor=ppm_SelectFromList("Couleur du Cadre",24,18,0,collist)
if linecolor = "" then linecolor = firstcolour
end
else do
linecolor = firstcolour
linewidth = 0
end
pwidth2 = pwidth- pagemargin2 -((rownumber-1)*colgap) /* 3 is margins */
framewidth = pwidth2/rownumber
frameheight = (framewidth*512)/640
frameheight2 = frameheight+ rowgap
colnumber = (pheight-pagemargin2)%frameheight2
if colnumber = 0 then exit_msg("Page too Small")
/* strip off number from end of filename */
do i = 1 to length(filename)
endofname = right(filename,i)
if verify(endofname,"0123456789") ~=0 then break
end
numberlength = length(endofname)-1
if numberlength = 0 then exit_msg("Fichiers non numérotés")
filenumber = substr(endofname,2)
filebase = left(filename,length(filename)-numberlength)
/* Create some boxes */
thispage = currentpage
do limit = 1 to 20 /* safety limit of 20 pages */
do i = 1 to colnumber
do j = 1 to rownumber
k = j-1
k2= k * colgap
m = i-1
m2 = m * rowgap
currentnumber = right(filenumber,numberlength,"0")
fullname = filebase||currentnumber
if ~exists(fullname) then Exit_msg("Done")
boxes.i.j.pic = ppm_CreateBox(pagemargin +(framewidth*k)+k2, pagemargin + (frameheight*m)+ m2, framewidth, frameheight, 0)
box = boxes.i.j.pic
call ppm_SetBoxHide(box,1) /* To avoid using up chip RAM */
worked = ppm_ImportBM(box, fullname)
if worked = 0 then Exit_msg("Terminé")
size = ppm_GetBoxSize(box)
boxwidth = word(size,1)
boxheight = word(size,2)
boxwidth = boxwidth-(linewidth*2)
boxheight = boxheight-(linewidth*2)
info = ppm_GetBoxInfo(box)
width = word(info,2) /* width & height of bitmap */
height = word(info,3)
width = width/(75/2.54) /* screen images at 75dpi for high res */
xscale = boxwidth/width
height = height/(75/2.54)
yscale = boxheight/height
call ppm_SetBoxScale(box,xscale,yscale)
call ppm_SetBoxOffset(box,0,0)
call ppm_SetBoxFrame(box,1)
call ppm_SetBoxFrameData(box, linecolor, linecolor, linewidth*30, 1, 0)
call ppm_SetBoxMargins(box, linewidth, linewidth, linewidth, linewidth)
boxes.i.j.caption = ppm_CreateBox(pagemargin +(framewidth*k)+k2, pagemargin + (frameheight*i)+ m2+ 0.2, framewidth, 1, 0)
captiontext = "Image "||currentnumber
overflow = ppm_TextIntoBox(boxes.i.j.caption,captiontext)
call ppm_ShowStatus(captiontext)
filenumber = filenumber+interval
end /* of row */
end /* of column */
/* Create a new page without adding a blank page at end of document */
trace n
newpage = ppm_CreatePage(thispage,1,1,0,0)
newpage = ppm_MovePage(newpage+1,newpage)
thispage = ppm_GoToPage(newpage+1)
trace n
end /* 1 to 20 */
exit_msg:
do
parse arg message
if message ~= '' then call ppm_Inform(1, message,)
call ppm_AutoUpdate(1)
call ppm_SetUnits(oldunits)
call ppm_SetSize(oldpoints)
call ppm_ClearStatus()
exit
end