123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- ; Seven Kingdoms: Ancient Adversaries
- ;
- ; Copyright 1997,1998 Enlight Software Ltd.
- ;
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 2 of the License, or
- ; (at your option) any later version.
- ;
- ; 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
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see <http://www.gnu.org/licenses/>.
- ;
- ;Filename : I_R.ASM
- ;Description : Blt a bitmap to the display surface buffer with colour remapping
- ; but without color key transparency handling
- INCLUDE IMGFUN.inc
- .CODE
- ;----------- BEGIN OF FUNCTION IMGbltRemap ------------
- ;
- ; Put an non-compressed bitmap on image buffer.
- ; It does not handle color key transparency but colorRemapping
- ;
- ; Syntax : IMGblt( imageBuf, pitch, x, y, bitmapBuf )
- ;
- ; char *imageBuf - the pointer to the display surface buffer
- ; int pitch - pitch of the display surface buffer
- ; int x,y - where to put the image on the surface buffer
- ; char *bitmapPtr - the pointer to the bitmap buffer
- ; char *colorTable - a 256-entry color remapping table
- ;
- ;-------------------------------------------------
- ;
- ; Format of the bitmap data :
- ;
- ; <short> width
- ; <short> height
- ; <char..> bitmap image
- ;
- ;-------------------------------------------------
- PUBLIC IMGbltRemap
- IMGbltRemap PROC imageBuf, pitch, x, y, bitmapPtr, colorTable
- LOCAL drawWidth
- STARTPROC
- MOV EAX, imageBuf ; store the address of the image buffer to a variable
- MOV image_buf, EAX
- ;------ get the bitmap width and height -----;
- MOV AX , DS
- MOV ES , AX
- MOV ESI, bitmapPtr
- XOR EAX, EAX
- LODSW ; get bitmap width
- MOV EBX, EAX
- MOV drawWidth, EAX
- LODSW ; get bitmap height
- MOV ECX, EAX
- MOV EDX, pitch ; EDX = lineDiff
- SUB EDX, EBX ; lineDiff = pitch - bitmap_width
- CLD ; clear direction flag for MOVSB
- ;------- pixels copying loop --------;
- CALC_ADDR EDI, x, y, pitch ; Get the offset to the image buffer address
- MOV EBX, colorTable
- @@putLine:
- PUSH ECX
- MOV ECX, drawWidth
- @@putPoint:
- LODSB
- XLATB [EBX]
- STOSB
- LOOP @@putPoint
- ADD EDI, EDX ; EDX = lineDiff
- POP ECX
- LOOP @@putLine ; decrease the remain height and loop
- @@end: ENDPROC
- IMGbltRemap ENDP
- ;----------- END OF FUNCTION IMGbltRemap ----------
- END
|