Mail Archives: djgpp/1999/01/01/11:23:37
Message-Id: | <199901011622.QAA01810@remus.clara.net>
|
From: | "Arthur" <arfa AT clara DOT net>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | RE: blit!
|
Date: | Fri, 1 Jan 1999 16:20:41 -0000
|
X-Priority: | 3 (Normal)
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook 8.5, Build 4.71.2173.0
|
Importance: | Normal
|
In-Reply-To: | <3.0.6.32.19981231133407.007d8ec0@tenforward.com>
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
Reply-To: | djgpp AT delorie DOT com
|
> ahem..how do i use allegro's "blit"? I see it in allegro
> tutorials but they never say HOW to use blit.
> the allegro documentation doesn't even explain it..
> all i need is something like this-->
>
> /** hline(BITMAP *bmp, int x, int y, int y2, int color); **/
>
> just an explanation like the above..thats all i want...
> thanks!
How well did you look? From the Allegro manual:
void blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int
dest_x, int dest_y, int width, int height);
Copies a rectangular area of the source bitmap to the destination bitmap.
The source_x and source_y parameters are the top left corner of the area to
copy from the source bitmap, and dest_x and dest_y are the corresponding
position in the destination bitmap. This routine respects the destination
clipping rectangle, and it will also clip if you try to blit from areas
outside the source bitmap.
You can blit between any parts of any two bitmaps, even if the two memory
areas overlap (ie. source and dest are the same, or one is sub-bitmap of the
other). You should be aware, however, that a lot of SVGA cards don't provide
separate read and write banks, which means that blitting from one part of
the screen to another requires the use of a temporary bitmap in memory, and
is therefore extremely slow. As a general rule you should avoid blitting
from the screen onto itself in SVGA modes.
In mode-X, on the other hand, blitting from one part of the screen to
another can be significantly faster than blitting from memory onto the
screen, as long as the source and destination are correctly aligned with
each other. Copying between overlapping screen rectangles is slow, but if
the areas don't overlap, and if they have the same plane alignment (ie.
(source_x%4) == (dest_x%4)), the VGA latch registers can be used for a very
fast data transfer. To take advantage of this, in mode-X it is often worth
storing tile graphics in a hidden area of video memory (using a large
virtual screen), and blitting them from there onto the visible part of the
screen.
If the GFX_HW_VRAM_BLIT bit in the gfx_capabilities flag is set, the current
driver supports hardware accelerated blits from one part of the screen onto
another. This is extremely fast, so when this flag is set it may be worth
storing some of your more frequently used graphics in an offscreen portion
of the video memory.
Unlike most of the graphics routines, blit() allows the source and
destination bitmaps to be of different color depths, so it can be used to
convert images from one pixel format to another.
James Arthur - jaa AT arfa DOT clara DOT net
http://www.jado.org/users/arfa/
ICQ#15054819
- Raw text -