View Single Post
Old 31 August 2014, 19:59   #1015
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 43
Posts: 450
Why not? Here is my func. All you have to do is to check if the alpha value you read is $00, then skip the muls and divs! Not? You also can take an alpha value of $FF as a special case where you just copy a pixel.

Code:
calc_pixels	; apply ARGB data onto RGB data

		moveq	#0,d0			; image
		moveq	#0,d1			; screen
		moveq	#0,d2			; alpha
		move.w	#255,d3

.loop		move.b	(a0)+,d2		; get alpha value

		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.w	d1,d0
		muls.w	d2,d0
		divs.w	d3,d0
		add.w	d1,d0
		move.b	d0,(a1)+

		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.w	d1,d0
		muls.w	d2,d0
		divs.w	d3,d0
		add.w	d1,d0
		move.b	d0,(a1)+
		
		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.w	d1,d0
		muls.w	d2,d0
		divs.w	d3,d0
		add.w	d1,d0
		move.b	d0,(a1)+

		dbf	d7,.loop
		rts
AGS is offline  
 
Page generated in 0.03854 seconds with 10 queries