Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:44 23 Nov 2024 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 : Picomite 2 HDMI MODE 2 Playing with MAP

Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 06:32pm 10 Sep 2024
Copy link to clipboard 
Print this post

I had taken a little time today to play with the color palette in Mode 2.
So I took a 16 color image from the Atari ST and "scanned" it under MMB4W and created a text file which assigns the pixel colors to a number (0-15) and saved the colors in in MMB4W BGR Format.
Unfortunately, the colors could not be easily converted to a map. I have not yet fully understood the coding here. Therefore, in my small example, I still set the colors per map by hand.



Maptest2.zip

I think the result is nevertheless impressive


Edited 2024-09-11 21:45 by Martin H.
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 01:04pm 23 Sep 2024
Copy link to clipboard 
Print this post

Showing 16 Color BMPs using MAP Command:


'The Power of 16 Colors

'PicoMiteHDMI only - MMBasic Version 6.00.00b8 or higher

'Reads and shows 4 Bit uncompressed BMP Files in up to 640x480 resolution
' and sets the Colors using the new MAP Command
MODE 2
Map reset:Map set
CLS
Dim integer w,h,f,cl,c
Do
 MODE 2
 Read File$:If file$="end" Then Restore :Read file$
 Open file$ For random As #1
 read_BMP_Header
 Map set
 If h>240 Then MODE 3
 hi=MM.VRes
 yofs=(hi-h)/2
 yofs=hi-yofs
 Seek #1,of+1'54+65
 For y=yofs To yofs-h-2 Step -1
   For x=0 To w-1 Step 2
     l$=Input$(1,1):cl=Asc(l$)
     Pixel x,y,Map(cl>>4):Pixel x+1,y,Map(cl And 15)
   Next
 Next
 Close #1
 'display the used colors
 For c=0 To 15:cl=Map(c):Box c*20,0,20,10,,cl,cl:Next
 Pause 2000
Loop
Data "chess.bmp","wasserfall2-4.bmp","waterfall.bmp","ST_Graph.bmp","outrun_a.b
mp"
Data "end"
Sub read_BMP_Header
Local l$
WStart= &H13
Hstart= &H17
MPStart= 55
'read offset of Picture data
Seek #1,11
l$=Input$(1,1):of=Asc(l$)
l$=Input$(1,1):Inc of,256*(Asc(l$))
'read Picture width
Seek #1,WStart
l$=Input$(1,1):W=Asc(l$)
l$=Input$(1,1):Inc w,256*(Asc(l$))
'read Picture height
Seek #1,HStart
l$=Input$(1,1):h=Asc(l$)
l$=Input$(1,1):Inc h,256*(Asc(l$))
'convert the Color data to Map
Seek #1,MPStart
For F=0 To 15
l$=Input$(1,1):B=Asc(l$)
l$=Input$(1,1):G=Asc(l$)
l$=Input$(1,1):R=Asc(l$)
l$=Input$(1,1)'fillbyte
   Map(f)=RGB(R,G,B)
Next
End Sub


the Program and some Sample BMPs
DecodeBmp.zip
'no comment
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 01:26pm 23 Sep 2024
Copy link to clipboard 
Print this post

Sixteen colors? Very nice.


Edited 2024-09-23 23:35 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 01:29pm 23 Sep 2024
Copy link to clipboard 
Print this post

  lizby said  Sixteen colors? Very nice.

I also find it very impressive. Using the MAP command/function, we now have the option of setting the RGB values of the 16 colors individually
'no comment
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 01:38pm 23 Sep 2024
Copy link to clipboard 
Print this post

Those images in your zip file actually look much crisper and more subtle than the copies I made of them and posted.

~
Edited 2024-09-23 23:38 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 01:57pm 23 Sep 2024
Copy link to clipboard 
Print this post

They are dithered by my Paint Programm, find a nice Picture,
resized to 320x200/240 or 640x480 and saved as 4 Bit BMP.


so you can put together your own little slideshow.
But, the big advantage is that you can work in Mode 2 as before, but you are no longer bound to the RGB(121) colors
Edited 2024-09-24 00:14 by Martin H.
'no comment
 
Print this page


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

© JAQ Software 2024