*««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««* * * © 1996 by Kenneth C. Nilsen. E-Mail: kennecni@idgOnline.no * * Name * DrawImageTrans(rastport,image,dx,dy) (a0/a1,d0/d1) ver. 1.0 * (completly compatible with the DrawImage()!) * * Function * DEMO program to show the new DrawImageTrans() function * The new function will draw image, but background can be seen * thrue. * * Inputs * rastport - pointer to the rastport the image will be drawn in * image - pointer to an image structure * dx - delta x to image structure position * dy - delta y to image structure position * * Notes * To assemble this source you will need: * NewStartup39.lha (Aminet:dev/asm/) * or from Bodų BBS: + 47 7552 2008 (ABBS) * Image data (make your own image, see bottom) just remember to * reinitialize the image structure. * * Only for OS 3.x and above because of AllocBitmap(). * This function may use the blitter. * Image data can be in fastram (future feature) * * This demo program uses BUSYWAIT loop to wait for the mouse. * To /busy/ to fix that now.. do it yourself ;-) * * Bugs * None I hope! * * Created : 28.10.96 * Last change : 29.10.96 *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»* *## For the Startup.asm (V3.9!): ; NewStartup39.lha can be downloaded from AmiNet from dev/asm/ StartSkip = 1 ;0=WB/CLI, 1=CLI only (AsmOne) ;CpuCheck set 1 ;if these aren't defined the CPU or/ ;MathCheck set 1 ;and math will be ignored Processor = 0 ;0/680x0/0x0 MathProc = 0 ;0/68881/68882/68040/68060 *## For the DUMPSTRING macro: ;DODUMP SET 1 ;define to activate DebugDump and ;InitDebugHandler *## Default includes: Incdir "" Include lvo:Exec_lib.i Include lvo:Intuition_lib.i Include lvo:Graphics_lib.i Include lvo:DFunc_lib.i Incdir inc: Include Digital.macs Include Digital.i Include DFunc/DFunc.i Include graphics/rastport.i Include Startup.asm Incdir "" dc.b "$VER: DrawImageTrans() 1.0 (28.10.96) ",10 dc.b "Copyright © 1996, Kenneth C. Nilsen. All rights reserved. ",0 even *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»* Init TaskName "DrawImageTrans() test program for dfunc.library" DefLib graphics,39 DefLib intuition,39 DefLib dfunc,38 DefEnd Start InitDebugHandler "CON:0/20/640/160/Debug Output/WAIT/CLOSE" DebugDump "Program start",0 LibBase intuition sub.l a0,a0 lea WinTags(pc),a1 Call OpenWindowtaglist move.l d0,WinBase beq.w Close move.l d0,a0 move.l 50(a0),Rast * Draw some background fill, f.ex. lines :-) DebugDump "Background...",1 LibBase graphics moveq #10,d5 ;steps moveq #0,d6 ;x position moveq #0,d7 ;color .loopX move.l rast(pc),a1 move.l d7,d0 Call SetAPen addq.l #1,d7 move.l rast(pc),a1 moveq #0,d0 moveq #0,d1 Call Move move.l Rast(pc),a1 move.w d6,d0 move.w #300,d1 Call Draw add.w d5,d6 cmp.w #560,d6 blt.w .loopX moveq #10,d5 ;steps moveq #0,d6 ;y position moveq #0,d7 ;color .loopY move.l rast(pc),a1 move.l d7,d0 Call SetAPen addq.l #1,d7 move.l rast(pc),a1 moveq #0,d0 moveq #0,d1 Call Move move.l Rast(pc),a1 move.w #560,d0 move.w d6,d1 Call Draw add.w d5,d6 cmp.w #300,d6 blt.w .loopY * Outch, we were nasty so we'll make it up by refreshing the windowborder :*) LibBase intuition move.l WinBase(pc),a0 Call RefreshWindowFrame * Show how the old DrawImage() works: DebugDump "Draw image with DrawImage()",2 move.l Rast(pc),a0 lea ImageStruct,a1 move.w #(560-247)/2,d0 moveq #32,d1 Call DrawImage * Our routine: DebugDump "Draw image with our function...",3 LibBase dfunc move.l Rast(pc),a0 lea ImageStruct,a1 move.w #(560-247)/2,d0 moveq #127,d1 DCall DrawImageTrans DebugDump "Ok",4 hold *·············································································* Close LibBase intuition CloseWin WinBase DebugDump "Program end!",5 Return 0 *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»* WinTags dc.l WA_Left,40 dc.l WA_Top,40 dc.l WA_Width,560 dc.l WA_Height,300 dc.l WA_Activate,-1 dc.l WA_RMBTrap,-1 dc.l WA_Title,WinName dc.l 0,0 *·············································································* ImageStruct dc.w 0,0,247,81,3 dc.l Image dc.b %111,%111 dc.l 0 *·············································································* WinBase dc.l 0 Rast dc.l 0 *·············································································* WinName dc.b "DEMO program for DrawImageTrans()",0 *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»* even section imagedata,data_c incdir Image incbin data:pics/DemoImage247x81x3.raw * convert a brush to raw (the size is up to you) *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*