home *** CD-ROM | disk | FTP | other *** search
- /* ScaleBitMap.c © PaweîMarciniak <pmarciniak@lodz.home.pl>*/
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <graphics/scale.h>
- #include <utility/tagitem.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
- #include <proto/utility.h>
-
- #include "/include/libraries/image.h"
-
- /**ScaleBitMap**********************************************************/
-
-
- /* ScaleBitMap() (c) 1997 Paweî Marciniak
- Modify date | Version | Comment
- ---------------+-----------+------------------------------
- 14-08-97 12:12 | 1.0 |
- */
- struct BitMap * __saveds __asm ScaleBitMapA( register __a0 struct BitMap *SrcBM_reg, register __a1 struct TagItem *Tags )
- {
- struct BitScaleArgs *BSA;
- struct TagItem *ti, *TagsTmp;
- struct BitMap *DestBM, *SrcBM = SrcBM_reg;
-
- if(!(BSA = AllocVec( sizeof( struct BitScaleArgs ), MEMF_PUBLIC | MEMF_CLEAR )))
- return( 0 );
-
-
- /* Tagi */
- TagsTmp = Tags;
- while ( ti = NextTagItem( &TagsTmp ) )
- {
- switch ( ti->ti_Tag )
- {
- case SBA_SrcX:
- BSA->bsa_SrcX = ( UWORD )ti->ti_Data;
- break;
-
- case SBA_SrcY:
- BSA->bsa_SrcY = ( UWORD )ti->ti_Data;
- break;
-
- case SBA_SrcWidth:
- BSA->bsa_SrcWidth = ( UWORD )ti->ti_Data;
- BSA->bsa_XSrcFactor = ( UWORD )ti->ti_Data;
- break;
-
- case SBA_SrcHeight:
- BSA->bsa_SrcHeight = ( UWORD )ti->ti_Data;
- BSA->bsa_YSrcFactor = ( UWORD )ti->ti_Data;
- break;
-
- case SBA_DestWidth:
- BSA->bsa_XDestFactor = ( UWORD )ti->ti_Data;
- break;
-
- case SBA_DestHeight:
- BSA->bsa_YDestFactor = ( UWORD )ti->ti_Data;
- break;
-
- default:
- break;
- }
- }
-
- if(!(DestBM = AllocBitMap( BSA->bsa_XDestFactor,
- BSA->bsa_YDestFactor,
- SrcBM->Depth,
- BMF_CLEAR | BMF_INTERLEAVED,
- 0 )))
- {
- FreeVec( BSA );
- return( 0 );
- }
- BSA->bsa_SrcBitMap = SrcBM;
- BSA->bsa_DestBitMap = DestBM;
-
- BitMapScale( BSA );
- WaitBlit();
- FreeVec( BSA );
- return( DestBM );
- }
-
-
-
-
-
-