; 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 .
;
;Filename : IB2.ASM
;Description : Blt a bitmap to the display surface buffer without color key transparency handling
INCLUDE IMGFUN.inc
.CODE
;----------- BEGIN OF FUNCTION IMGblt2 ------------
;
; Put an non-compressed bitmap on image buffer.
; It does not handle color key transparency.
;
; Syntax : IMGblt2( imageBuf, pitch, x, y, bitmapWidth, bitmapHeight, bitmapBuf )
;
; char *imageBuf - the pointer to the display surface buffer
; int pitch - picth of display surface buffer
; int x,y - where to put the image on the surface buffer
; int bitmapWidth - width of the bitmap
; int bitmapHeight - height of the bitmap
; char *bitmapPtr - the pointer to the bitmap buffer
;
;-------------------------------------------------
;
; Format of the bitmap data :
;
; width
; height
; bitmap image
;
;-------------------------------------------------
PUBLIC IMGblt2
IMGblt2 PROC imageBuf, pitch, x, y, bitmapWidth, bitmapHeight, bitmapPtr
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
MOV EBX, bitmapWidth
MOV ECX, bitmapHeight
MOV EDX, pitch ; EDX = lineDiff
SUB EDX, EBX ; lineDiff = image_width - 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
@@putLine:
PUSH ECX
MOV ECX, EBX
REP MOVSB
ADD EDI, EDX ; EDX = lineDiff
POP ECX
LOOP @@putLine ; decrease the remain height and loop
@@end: ENDPROC
IMGblt2 ENDP
;----------- END OF FUNCTION IMGblt2 ----------
END