Download S1D13A04 TECHNICAL MANUAL - Digi-Key

Transcript
Page 86
Epson Research and Development
Vancouver Design Center
9.2.10 Pattern Fill BitBLT with Transparency
This operation is very similar to the Pattern Fill BitBLT with the difference being that one
color can be specified to be transparent. Whenever the Transparent color is encountered in
the pattern data the destination is left as is. This operation is useful to create hatched or
striped patterns where the original image shows through the hatching.
The requirements for this BitBLT are the same as for the Pattern Fill BitBLT the only
change in programming is that the BitBLT Operation field of REG[8008h] must be set to
07h and the BitBLT Background color register, REG[8020h] must be set to the desired
color.
Example 17: Fill a 100 x 150 rectangle at the screen coordinates x = 10, y = 20 with
the pattern in off-screen memory at offset 27000h using a 320x240 display at a color depth of 8 bpp. The first pixel (upper left corner) of the
rectangle is the pattern pixel at x = 3, y = 4. Transparent color is blue (assumes LUT index 1).
1. Calculate the destination address (upper left corner of destination rectangle), using the
formula:
DestinationAddress = (y × ScreenStride) + (x × BytesPerPixel)
= (20 × 320) + (10 × 1)
= 6410
= 190Ah
where:
BytesPerPixel = 1 for 8 bpp
BytesPerPixel = 2 for 16 bpp
ScreenStride = DisplayWidthInPixels × BytesPerPixels = 320 for 8 bpp
Program the BitBLT Destination Start Address Register. REG[8010h] is set to 190Ah.
2. Calculate the source address. This is the address of the pixel in the pattern that is the
origin of the destination fill area. The pattern begins at offset 1M, but the first pattern
pixel is at x = 3, y = 4. Therefore, an offset within the pattern itself must be calculated.
SourceAddress
= PatternOffset + StartPatternY × 8 × BytesPerPixel + StartPatternX × BytesPerPixel
= 156K + (4 × 8 × 1) + (3 × 1)
= 156K + 35
= 159779
= 27023h
where:
BytesPerPixel = 1 for 8 bpp
BytesPerPixel = 2 for 16 bpp
Program the BitBLT Source Start Address Register. REG[800Ch] is set to 27023h.
3. Program the BitBLT Width Register to 100 - 1. REG[8018h] is set to 63h (99 decimal).
S1D13A04
X37A-G-003-05
Programming Notes and Examples
Issue Date: 2002/08/21