Post Reply 
Custom Text Formatting (Previously: Getting long results in a program)
04-10-2024, 09:00 PM (This post was last modified: 04-11-2024 05:01 AM by komame.)
Post: #59
RE: Getting long results in Program
Tyann,

A single buffer with normal height is sufficient.

The algorithm is as follows:
  1. copy the target region from Gx to the buffer
  2. [if the background color is specified => draw the backgroud]
  3. [if a frame or underline is enabled => draw them]
  4. [if italics are enabled => shift the content of the buffer left in 3-line blocks]
  5. overlay the text using TEXTOUT_P
  6. [if a strikethrough is enabled => draw it]
  7. [if bold is enabled => overlay the text again (shifted 1 pixel to the right or overlaid in the same location)
  8. [if italics are disabled => copy the buffer to Gx in one step using transparency]
  9. [if italics are enabled] => copy the buffer in 3-line blocks with a right shift directly to Gx, also applying transparency.

Note that when there is no transparency or no italics, the steps are exactly the same, you just skip the block shifting or simply set the alpha value in BLIT_P to 255 (255 = no transparency).

I have now realized that BLIT_P has another bug (in total 3 that I have found myself), because the last two parameters ([c] and [alpha]) should be swapped, as currently when using the [alpha] value, the [c] parameter is also required, which may cause unexpected skipping of copying pixels of color specified in [c].

EDIT:
When I analyze it now, points 3 and 6 could be drawn directly on Gx at the very end. This should simplify the implementation somewhat (although this approach is not entirely my style).

Best wishes

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Getting long results in Program - komame - 04-10-2024 09:00 PM
RE: Custom Text Formatting - Tyann - 04-15-2024, 06:55 PM
RE: Custom Text Formatting - komame - 04-15-2024, 07:42 PM
RE: Custom Text Formatting - Tyann - 04-16-2024, 04:38 AM
RE: Custom Text Formatting - komame - 04-16-2024, 06:02 AM



User(s) browsing this thread: 72 Guest(s)