![]() |
Forum Index : Microcontroller and PC projects : CMM2 - BLIT
Author | Message | ||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi, again some newbie question. I already replaced using TEXT+FONT with use of BLIT, because of need to change chcracter shape dynamically, during the program run. BLIT works nice and fast and with last paramater bit 4 set, I don't need to care about background. But, I need to change "character" color (foreground), so I'm looking for the fastest way to do it: 1. I'm Using 8 bit color 2. My "font" is created, stored and updated in PAGE 1 in 8x8 matric, color 1 as fontshape, color 0 as background. 3. Right now, I'm able to BLIT char in PAGE 0 just in color 1 with transparent background, but I need to replace color 1 with any chosen color Ways I found now: 1. Copy character manualy, read PIXEL from PAGE 1, when color 1 then set PIXEL on PAGE 0 with color X. It will be slow, not using speed of BLIT 2. CSUB. Either for copy or replace color 1 with color X or write complete text routine. It will work, but using CSUBs is not the nicest way... 3. extend BLIT command for parameter with replacement color. So color 0 could be used as transparent as is, any other color will be replaced by new chosen color. For me perfect way, then can be BLIT used as very nice TEXT replacement/extension, but FW update needed. 4. Maybe some other way??? Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
epsilon![]() Senior Member ![]() Joined: 30/07/2020 Location: BelgiumPosts: 255 |
Hi Jiri, I don't fully understand what you're trying to do, but with the MAP command you can redefine the colour map. I just wanted to make sure you're aware of that. From the User Guide: Cheers, Ruben/Epsilon. Epsilon CMM2 projects |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Think about PAGE AND_PIXELS |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi Peter, I already on the begin thought about it, but I'm not sure, how exactly it works (in the documentation is not too much about it). When I have on PAGE1 pixel with color 255 and on PAGE2 on the same dimensions pixel with color 13 and I use PAGE_AND_PIXELS , what will be the result? It's pixel with color 13 (13 AND 255), so AND is done between colors of the x,y pixels? This way I could: 1. modify "font" color on PAGE1 with colors 0 (background) and 255 (foreground) 2. on PAGE2 prepeare box with coreponding color in right place for character needed 3. do PAGE_AND_PIXEL 1,2,2 4. BLIT coresponding character from PAGE2 to PAGE0 It's pity, that either this logical function can't be used directly in BLIT or PAGE_AND_PIXEL doesn't have parameter for area (x,y,w,h), but still (hopefully) faster solution then clean BASIC... Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
Sasquatch wrote a CSUB in this thread that might help with your colour changing needs. I put it in a demo program in the 20th posting in the thread. Sasquatch's routine will change any non-zero pixel in the specified rectangle to the specified colour number. I used the routine on a line by line basis to change pixels to varying shades of gray to fade text in and out. Visit Vegipete's *Mite Library for cool programs. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |