Post Reply 
Custom Text Formatting (Previously: Getting long results in a program)
04-13-2024, 07:52 AM (This post was last modified: 04-13-2024 07:59 AM by komame.)
Post: #67
Custom text formatting (was: Getting long results in Program)
Good morning Tyann,

I think I've found a solution to the problem with BLIT_P. I conducted several tests, and it seems to be working correctly. To verify this, I drew a smooth gradient bar of a given color, from darkest to lightest. This way, I obtained all possible shades of blue (without any other color additives). Then I applied BLIT_P with the [c] parameter set to 128, which resulted in a blank line in the middle (because I excluded this color from copying) - which is consistent with the assumptions. However, when I added any transparency coefficient to this color (e.g., [c] = {128,255}), all colors were copied correctly. The specified color is irrelevant; what matters is that the transparency coefficient is set within the range of 1 to 255 (for 0, it behaves like a regular color and doesn't copy). I think this approach resolves the inconvenient limitation of BLIT_P.

Here is the program I used for this test:

Code:
EXPORT ALPHA_BLEND_T()
BEGIN
 LOCAL x,alpha_color;
 RECT_P();
 DIMGROB_P(G1,256,50,#FFFFFF);
 FOR x FROM 0 TO 255 DO
  LINE_P(G1,x,0,x,25,x);
  LINE_P(G1,x,26,x,50,RGB(x,x,255));
 END;
 alpha_color:={128,255}; // change it to 128
 BLIT_P(G0,31,80,G1,0,0,255,50,alpha_color,128);
 RECT_P(29,78,287,131,#0,{0,255});
 WAIT(-1);
END;

Regarding managing transparency as the 10th parameter, it doesn't appear complex to me. In fact, it seems quite straightforward. I think it's worth revisiting my idea with a fixed number of parameters (instead of list) for "atextout" (in this case, it will already be 10). I'm convinced that this will simplify the code.

Consider a modification that will allow handling letters with accents for small fonts. To me, it's a rather significant flaw.

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


Messages In This Thread
Custom text formatting (was: Getting long results in Program) - komame - 04-13-2024 07:52 AM
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: 67 Guest(s)