Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:00 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 - BLIT

Author Message
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 08:35am 20 Oct 2020
Copy link to clipboard 
Print this post

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: Belgium
Posts: 255
Posted: 09:20am 20 Oct 2020
Copy link to clipboard 
Print this post

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:
  Quote  
The MAP commands allow the programmer to set the colours used in 8-bit
colour modes. Each value in the 8-bit colour pallet can be set to an
independent 24-bit colour.


Cheers,
Ruben/Epsilon.
Epsilon CMM2 projects
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 09:22am 20 Oct 2020
Copy link to clipboard 
Print this post

  Quote   Maybe some other way???


Think about PAGE AND_PIXELS
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 10:30am 20 Oct 2020
Copy link to clipboard 
Print this post

  Quote  Think about PAGE AND_PIXELS

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: Canada
Posts: 1132
Posted: 01:02am 21 Oct 2020
Copy link to clipboard 
Print this post

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.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025