Vistas de página en total

viernes, 4 de abril de 2014

FILL RECTANGLE

Función para realizar RECTANGULOS RELLENOS apoyandolnos en la función LINEA.

Macro DE LLAMADA para ampliar en GRAPHICS.MAC

GRAPHICS.MAC
;Dibuja un rectangulo lleno
fillrectangle macro x0,y0,x1,y1,color
ifndef _fillrectangle
        extrn _fillrectangle:near
endif
        mov ax,x0
        push ax
        mov ax,y0
        push ax
        mov ax,x1
        push ax
        mov ax,y1
        push ax
        mov ax,color
        push ax
        call _fillrectangle
        

 endm  


FRECTAN.ASM
; Copyright (C) 2013  José Ángel Moneo Fernández

;    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 3 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/>.
.model compact,pascal

        public _fillrectangle
.data

.code
       ;algoritmo Bresenham
_fillrectangle proc uses ax cx bx ,x0,y0,x1,y1,color
        mov cx,y0
        mov bx,y1
        mov ax,y0       ;COMPRUEBA EL MAYOR PARA ORDENAR EL BUCLE
        cmp ax,y1
        jbe correcto
        ;invertir  las y
        mov cx,y1       
        mov bx,y0
correcto:                        ;BUCLE DE LÍNEAS
        line x0,cx,x1,cx,color
        inc cx
        cmp cx,bx
        jne correcto
        ret
_fillrectangle endp

end

miércoles, 2 de abril de 2014

RECTANGLE


Función para realizar rectangulos apoyandolnos en la función linea.

Macro DE LLAMADA para ampliar en GRAPHICS.MAC

GRAPHICS.MAC
;Dibuja un rectangulo
rectangle macro x0,y0,x1,y1,color
ifndef _rectangle
        extrn _rectangle:near
endif
        mov ax,x0
        push ax
        mov ax,y0
        push ax
        mov ax,x1
        push ax
        mov ax,y1
        push ax
        mov ax,color
        push ax
        call _rectangle
       
 endm 




RECTAN.ASM
; Copyright (C) 2013  José Ángel Moneo Fernández

;    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 3 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/>.
include graphics.mac


.model compact,pascal

        public _rectangle
.data

.code
       ;algoritmo Bresenham
_rectangle proc uses ,x0,y0,x1,y1,color
        line x0,y0,x1,y0,color
        line x0,y1,x1,y1,color
        line x0,y0,x0,y1,color
        line x1,y0,x1,y1,color
        ret
_rectangle endp

end