TftBmpFromSdRotate()

… visits
Parent Previous Next

Syntax

TftBmpFromSdRotate(sFileName As sStringParameter1, wX_Pos As wTftLibParameter2, wY_Pos As wTftLibParameter3, wAngleDeg As wTftLibParameter4, bTransparent As bTftLibParameter1, wAlphaColor As wTftLibParameter6, bInvert As bTftLibParameter2, bOverlay As bTftLibParameter3), Byte

Overview

Draws a BMP image from an SD card and rotates it counter-clockwise by the specified angle, optionally applying transparency, color inversion, and pixel overlay effects.


Rotations of 0°, 90°, 180°, and 270° use optimized, high-speed algorithms. All other angles use a generic rotation method.

Parameters

Parameter

Description

sFileName

BMP file name in 8.3 format, maximum 12 characters including the dot and extension.

wX_Pos

X-coordinate of the image’s lower-left corner.

wY_Pos

Y-coordinate of the image’s lower-left corner.

wAngleDeg

Rotation angle in degrees (counter-clockwise).

bTransparent

Transparency mode:
0 – Normal drawing (no transparency)
1 – Transparent drawing (skip pixels matching the alpha color)

wAlphaColor

Alpha-key color used when transparency is enabled.

bInvert

Color inversion:
0 – Normal colors
1 – Invert image colors

bOverlay

Pixel overlay mode:
0 – NONE Direct pixel replacement
1 – OR Lightens overlapping areas (bitwise OR)
2 – AND Keeps only common bits
3 – XOR Highlights differences
4 – NAND Inverted intersection
5 – NOR Inverted union
6 – XNOR Preserves matching pixels
7 – ADD Adds color values (brightening effect)
8 – SUB Subtracts color values (darkening effect)
9 – AVG Averages source and destination colors
10 – SCR Screen blend (inverse multiply)
11 – MUL Multiply blend (darkens overlaps)
12 – CON Contrast-enhancing blend

Return value

Value

Meaning

0

Success

1

No response from SD card

2

Card not formatted as FAT16 or FAT32

3

File not found

4

File already in use

5

Read/write error

99

Image exceeds screen boundaries

Important Notes:

Due to the FAT16/FAT32 sequential cluster read mechanism, this function uses forward-mapped rotation, which is slower and produces lower visual quality than backward-mapped rotation.


All other rotation routines in TFT Graphic Library 2 use backward mapping, which is faster and produces higher-quality results.

For best performance and quality, consider loading the image into a sprite buffer or FLASH memory (which allow random access) and then applying arbitrary-angle rotation using backward mapping.

Additional Notes:

Effect processing order: Transparency → Color Inversion → Overlay → Draw

Transparent drawing is slower because pixels are processed individually instead of in block mode.

Overlay effects are slower because each destination pixel must be read and written.

If the global TftPixelCheck flag is enabled:

Images completely outside the visible area are not drawn.

Partially visible images are clipped to screen boundaries.


For maximum performance when no rotation or effects are required, use TftBmpFromSd(), which is significantly faster.

Created with the Personal Edition of HelpNDoc: Full-featured EPub generator