/** FIX_IMAGES -- by Markus Nick **/ /* * fix_image(), fix_icon(), vdifix() und vditrans() aus ProGEM von Tim Oren * zusammengestellt (entnommen 68000er 10/89, S. 60 und berichtigt). * share & enjoy, Markus M. Nick --------------------------------------------------------------- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the documentation `docs\ruby.tex' for more details. --------------------------------------------------------------- */ /* fix_tree(OBJECT*) * converts all images and bitblocks from the standard to the device- * dependent format. * * fix_image(BITBLOCK*) * converts bitblock from standard to device-dependent format. * * fix_icon(ICONBLOCK*) * converts icon from standard to device-dependent format. */ #include #include #include #include #include "portab.h" #include "stuff.h" void fix_tree(tree) OBJECT *tree; { WORD i; for(i = 0; !(tree[i].ob_flags & LASTOB); i++) if(tree[i].ob_spec.index) switch ((UBYTE)tree[i].ob_type) { case G_ICON: fix_icon(tree[i].ob_spec.iconblk); break; case G_IMAGE: fix_image(tree[i].ob_spec.bitblk); break; } } void fix_image(pBB) BITBLK *pBB; { WORD wb, hl; if(pBB <= 0) return; wb = pBB->bi_wb; hl = pBB->bi_hl; vditrans(pBB->bi_pdata,wb, pBB->bi_pdata,wb,hl); } void fix_icon(pIB) ICONBLK *pIB; { WORD wb, hl; BBWORD *p_icraster; if(pIB <= 0) return; wb = (pIB->ib_wicon + 7) >> 3; hl = pIB->ib_hicon; if((p_icraster = pIB->ib_pdata) > 0) vditrans(p_icraster,wb, p_icraster,wb,hl); if((p_icraster = pIB->ib_pmask) > 0) vditrans(p_icraster,wb, p_icraster,wb,hl); } /** PRIVATE FUNCTIONS ******************************************************/ void vdifix(pFDB, addr, wb,h) MFDB *pFDB; BBWORD *addr; WORD wb,h; { pFDB->fd_wdwidth = wb >> 1; pFDB->fd_w = wb << 3; pFDB->fd_h = h; pFDB->fd_nplanes = 1; /* monochrome */ pFDB->fd_addr = addr; pFDB->fd_r1 = pFDB->fd_r2 = pFDB->fd_r3 = 0; } void vditrans(saddr,swb, daddr,dwb, h) BBWORD *saddr; WORD swb; BBWORD *daddr; WORD dwb; WORD h; { MFDB src, dst; vdifix(&src, saddr, swb,h); src.fd_stand = TRUE; vdifix(&dst, daddr, dwb,h); dst.fd_stand = FALSE; vr_trnfm(lib_handle, &src,&dst); } /** EOF **/