rem BMPCombine ......... Rev 5.3 rem A J Tooth // December 2006 rem ==================================================================== rem Combines two pictures, regardless of sizes. rem ==================================================================== rem ==================================================================== on error if (err=17) then quit *FLOAT64 himem=lomem + 100000000 install @lib$+"MyUtils.bbc" install @lib$+"BMP_Utils.bbc" rem ==================================================================== rem Setup proc_setup rem Go to fullscreen proc_fullscreen(xscreen%,yscreen%) : colour 132,90,0,0 : colour 132 : cls rem Get two pictures proc_TwoPics rem Second pass setup proc_setup2 rem Combine the pictures into one new one proc_MainCombi rem Save the result proc_ByteSave(pfn%,lgth%,Pre$,"Combi.bmp") proc_mclick(mc&) : rem Wait for a mouse click if mc&=4 then run else quit end rem End of Program +++++++++++++++++++++++++++++++++++++++++++++++++++++ rem ==================================================================== rem Setup def proc_setup rem Revert to normal window proc_maxim(xscreen%,yscreen%) rem FRONTISPIECE rem ************ rem Change the Windows Title title$ = " COMBINE by Tony Tooth" sys "SetWindowText", @hwnd%, title$ rem Display a backdrop picture proc_BackPic("EarthSky.jpg",xscreen%,yscreen%) rem Displays my icon proc_AJTicon(10,fn_adapt(1,650)) colour 8,90,0,0 : colour 132,90,0,0 msg$="\8COMBINE" proc_msg("Blackadder ITC",40,"B",350,fn_adapt(1,500),msg$) proc_back(100,fn_adapt(1,1250),1000,fn_adapt(1,200),150,150,150) msg$="\14Choose either a \10jpeg\14, \10gif \14or \10bitmap \14image." proc_msg("Georgia",12,"B",175,fn_adapt(1,1400),msg$) msg$="\11CLICK THE MOUSE TO CONTINUE." proc_msg("Georgia",12,"B",175,fn_adapt(1,1350),msg$) proc_back(100,fn_adapt(1,600),1500,fn_adapt(1,200),150,150,150) msg$="\10Roll the \11mouse-wheel \10or press the \11arrow keys \10to change the split." proc_msg("Georgia",12,"B",175,fn_adapt(1,750),msg$) msg$="\10Click either mouse button to \9EXIT" proc_msg("Georgia",12,"B",175,fn_adapt(1,700),msg$) proc_mclick(b&) : rem Wait for a mouse click endproc rem ======================================================================= rem Second pass setup def proc_setup2 local pass& dim master% 1500, itmp% 3 pc=0.5 : rem Initial percent split rem Setup third bitmap proc_BMP_Set(wdth%,hght%,pfn%,Wlim%,lgth%) rem Dual-pass Assembly for pass&=0 to 2 step 2 proc_master(pass&) next pass& endproc rem ==================================================================== rem Choose two pictures to combine def proc_TwoPics local ho%,ve%,bt% rem First picture proc_pichooseSZ(Name$, FulName$, Pre$, wdth%, hght%, lgth%) rem Clip display to ensure a bmp same as screen dimensions proc_gendisp(1,FulName$,0,0,wdth%,hght%,pf1%,ntused%) pic1$=Name$ fil1$=FulName$ proc_BMP_DispB(xscreen%,yscreen%,pf1%) : proc_mclick(mc&) : rem Wait for a mouse click rem First picture proc_pichooseSZ(Name$, FulName$, Pre$, wdth%, hght%, lgth%) rem Clip display to ensure a bmp same as screen dimensions proc_gendisp(1,FulName$,0,0,wdth%,hght%,pf2%,ntused%) pic2$=Name$ fil2$=FulName$ proc_BMP_DispB(xscreen%,yscreen%,pf2%) : proc_mclick(mc&) : rem Wait for a mouse click endproc rem ==================================================================== rem Main Routine def proc_MainCombi repeat sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &100 call master% sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &20 rem Display the combined picture in full screen proc_BMP_DispB(xscreen%,yscreen%,pfn%) proc_event(a$,b&) in&=asc(a$) case in& of when 140,137 : pc+=0.05 : if pc>1.0 then pc=1.0 when 141,136 : pc-=0.05 : if pc<0.0 then pc=0.0 otherwise rem Do nothing endcase until b&<>0 endproc rem ==================================================================== rem Master routine def proc_master(opt&) P%=master% [opt opt& mov edx,0 mov [^j%],edx .jloop mov edx,0 mov [^k%],edx .kloop mov eax,[^j%] imul eax,[^Wlim%] add eax,[^k%] add eax,[^k%] add eax,[^k%] add eax,54 finit fld qword [^pc] fld1 fsub st0,st1 mov ecx,0 mov cl,pf1%[eax] mov [itmp%],ecx fild dword [itmp%] fmulp st1,st0 mov cl,pf2%[eax] mov [itmp%],ecx fild dword [itmp%] fmulp st2,st0 faddp st1,st0 fistp dword [itmp%] mov ecx,[itmp%] mov pfn%[eax],cl fld qword [^pc] fld1 fsub st0,st1 mov ecx,0 mov cl,pf1%[eax+1] mov [itmp%],ecx fild dword [itmp%] fmulp st1,st0 mov cl,pf2%[eax+1] mov [itmp%],ecx fild dword [itmp%] fmulp st2,st0 faddp st1,st0 fistp dword [itmp%] mov ecx,[itmp%] mov pfn%[eax+1],cl fld qword [^pc] fld1 fsub st0,st1 mov ecx,0 mov cl,pf1%[eax+2] mov [itmp%],ecx fild dword [itmp%] fmulp st1,st0 mov cl,pf2%[eax+2] mov [itmp%],ecx fild dword [itmp%] fmulp st2,st0 faddp st1,st0 fistp dword [itmp%] mov ecx,[itmp%] mov pfn%[eax+2],cl inc dword [^k%] mov edx,[^k%] cmp edx,[^wdth%] jl near kloop inc dword [^j%] mov edx,[^j%] cmp edx,[^hght%] jl near jloop ret ] endproc rem ====================================================================