Skip to content

Commit

Permalink
new 8 bit palette mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroNick2020 committed Feb 20, 2023
1 parent cb1cb41 commit 9e7a897
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 82 deletions.
8 changes: 7 additions & 1 deletion rm.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="27">
<Units Count="28">
<Unit0>
<Filename Value="rm.lpr"/>
<IsPartOfProject Value="True"/>
Expand Down Expand Up @@ -272,6 +272,12 @@
<Filename Value="rmapi.pas"/>
<IsPartOfProject Value="True"/>
</Unit26>
<Unit27>
<Filename Value="rmcolorxga.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RMXgaColorDialog"/>
<ResourceBaseClass Value="Form"/>
</Unit27>
</Units>
</ProjectOptions>
<CompilerOptions>
Expand Down
3 changes: 2 additions & 1 deletion rm.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Forms, pascalscript, lazcolorpalette, rmmain, rmcore, rmtools, rmcolor,
rmcolorvga, rmabout, rmamigacolor, rwraw, rwpal, rmamigarwxgf, rwgif,
rmexportprops, rmxgfcore, rwpng, mapcore, mapeditor, rwmap, mapexiportprops,
gwbasic, spriteimport, wraylib, rmcodegen, rwaqb, rmapi
gwbasic, spriteimport, wraylib, rmcodegen, rwaqb, rmapi, rmcolorxga
{ you can add units after this };

{$R *.res}
Expand All @@ -29,6 +29,7 @@
Application.CreateForm(TMapEdit, MapEdit);
Application.CreateForm(TMapExportForm, MapExportForm);
Application.CreateForm(TSpriteImportForm, SpriteImportForm);
Application.CreateForm(TRMXgaColorDialog, RMXgaColorDialog);
Application.Run;
end.

2 changes: 1 addition & 1 deletion rmabout.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,lclintf;

Const
ProgramName ='Raster Master v1.4 R74';
ProgramName ='Raster Master v1.4 R75';
ProgramLicense = 'Released under MIT License';

type
Expand Down
128 changes: 69 additions & 59 deletions rmcolorvga.lfm
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
object RMVgaColorDialog: TRMVgaColorDialog
Left = 685
Height = 348
Top = 362
Width = 632
Left = 569
Height = 278
Top = 337
Width = 506
BorderStyle = bsDialog
Caption = 'VGA Color'
ClientHeight = 348
ClientWidth = 632
DesignTimePPI = 120
ClientHeight = 278
ClientWidth = 506
LCLVersion = '2.0.10.0'
object ColorPalette: TColorPalette
AnchorSideRight.Side = asrBottom
Left = 16
Left = 13
Height = 120
Top = 8
Top = -3
Width = 474
ButtonHeight = 60
ButtonWidth = 60
Expand All @@ -25,120 +24,131 @@ object RMVgaColorDialog: TRMVgaColorDialog
ParentColor = False
end
object Shape1: TShape
Left = 32
Height = 84
Top = 208
Width = 81
Left = 26
Height = 67
Top = 166
Width = 65
end
object TrackBar1: TTrackBar
Left = 152
Height = 39
Top = 200
Width = 253
Left = 122
Height = 31
Top = 160
Width = 202
Max = 63
OnChange = TrackBar1Change
Position = 0
ShowSelRange = False
TickMarks = tmTopLeft
TickStyle = tsNone
ParentFont = False
TabOrder = 0
end
object TrackBar2: TTrackBar
Left = 152
Height = 39
Top = 232
Width = 253
Left = 122
Height = 31
Top = 186
Width = 202
Max = 63
OnChange = TrackBar2Change
Position = 0
ShowSelRange = False
TickMarks = tmTopLeft
TickStyle = tsNone
ParentFont = False
TabOrder = 1
end
object TrackBar3: TTrackBar
Left = 152
Height = 39
Top = 264
Width = 253
Left = 122
Height = 31
Top = 211
Width = 202
Max = 63
OnChange = TrackBar3Change
Position = 0
ShowSelRange = False
TickMarks = tmTopLeft
TickStyle = tsNone
ParentFont = False
TabOrder = 2
end
object Label1: TLabel
Left = 137
Height = 20
Top = 200
Width = 9
Left = 110
Height = 15
Top = 160
Width = 7
Caption = 'R'
ParentColor = False
ParentFont = False
end
object Label2: TLabel
Left = 137
Height = 20
Top = 232
Width = 10
Left = 110
Height = 15
Top = 186
Width = 8
Caption = 'G'
ParentColor = False
ParentFont = False
end
object Label3: TLabel
Left = 137
Height = 20
Top = 264
Width = 9
Left = 110
Height = 15
Top = 211
Width = 7
Caption = 'B'
ParentColor = False
ParentFont = False
end
object Label4: TLabel
Left = 416
Height = 20
Top = 200
Width = 9
Left = 333
Height = 15
Top = 160
Width = 7
Caption = 'R'
ParentColor = False
ParentFont = False
end
object Label5: TLabel
Left = 416
Height = 20
Top = 232
Width = 10
Left = 333
Height = 15
Top = 186
Width = 8
Caption = 'G'
ParentColor = False
ParentFont = False
end
object Label6: TLabel
Left = 416
Height = 20
Top = 264
Width = 9
Left = 333
Height = 15
Top = 211
Width = 7
Caption = 'B'
ParentColor = False
ParentFont = False
end
object Button1: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 528
Height = 31
Top = 307
Width = 94
Left = 423
Height = 25
Top = 245
Width = 75
Anchors = [akRight, akBottom]
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'OK'
OnClick = OKClick
ParentFont = False
TabOrder = 3
end
object VGAIndexLabel: TLabel
Left = 40
Height = 20
Top = 168
Width = 72
Left = 32
Height = 15
Top = 134
Width = 58
Caption = 'VGA Index:'
ParentColor = False
ParentFont = False
end
end
20 changes: 17 additions & 3 deletions rmcore.pas
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ TRMCoreBase = class(TObject)
PaletteModeAmiga8 = 9;
PaletteModeAmiga16 = 10;
PaletteModeAmiga32 = 11;
PaletteModeXGA = 12; //like VGA but we can edit full 8 bits of Palette (no shifting from 6 bit values to 8 bit values)
PaletteModeXGA256 = 13; //like PaletteModeXGA but with 256 colors


MonoDefault : array[0..1] of TRMColorRec = ((r:0;g:0;b:0),
Expand Down Expand Up @@ -565,8 +567,8 @@ function ColorsInPalette(pm : integer) : integer;
ColorsInPalette:=0;
Case pm of PaletteModeMono, PaletteModeAmiga2:ColorsInPalette:=2;
PaletteModeCGA0,PaletteModeCGA1,PaletteModeAmiga4:ColorsInPalette:=4;
PaletteModeEGA,PaletteModeVGA,PaletteModeAmiga16:ColorsInPalette:=16;
PaletteModeVGA256:ColorsInPalette:=256;
PaletteModeEGA,PaletteModeVGA,PaletteModeAmiga16,PaletteModeXGA:ColorsInPalette:=16;
PaletteModeVGA256,PaletteModeXGA256:ColorsInPalette:=256;
PaletteModeAmiga8:ColorsInPalette:=8;
PaletteModeAmiga32:ColorsInPalette:=32;
end;
Expand Down Expand Up @@ -624,6 +626,11 @@ function ColIndexToHoverInfo(colIndex : integer; pm : integer) : string;
RMCoreBase.Palette.GetColor(colindex,cr);
ColIndexstr:=ColIndexStr+#13#10+'R:'+IntToStr(EightToSixBit(cr.r))+' G:'+IntToStr(EightToSixBit(cr.g))+' B:'+IntToStr(EightToSixBit(cr.b));
end
else if (pm=PaletteModeXGA) or (pm=PaletteModeXGA256) then
begin
RMCoreBase.Palette.GetColor(colindex,cr);
ColIndexstr:=ColIndexStr+#13#10+'R:'+IntToStr(cr.r)+' G:'+IntToStr(cr.g)+' B:'+IntToStr(cr.b);
end
else if isAmigaPaletteMode(pm) then
begin
RMCoreBase.Palette.GetColor(colindex,cr);
Expand Down Expand Up @@ -1009,8 +1016,15 @@ procedure TRMPalette.PasteFromCBToPalette;
cr.b:=SixToEightBit(EightToSixBit(cr.b));
SetColor(i,cr);
end;
end
else if (pm=PaletteModeXGA) or (pm=PaletteModeXGA256) then //Frb 9/2023 is the future and we have a real 8 bit color mode
begin
for i:=0 to convertColors-1 do
begin
GetCBColor(i,cr); //no bit shifting required
SetColor(i,cr);
end;
end;

end;


Expand Down
8 changes: 8 additions & 0 deletions rmmain.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,14 @@ object RMMainForm: TRMMainForm
Caption = 'VGA Palette 256'
OnClick = PaletteVGA256Click
end
object PaletteXGA: TMenuItem
Caption = 'XGA Palette'
OnClick = PaletteXGAClick
end
object PaletteXGA256: TMenuItem
Caption = 'XGA Palette 256'
OnClick = PaletteXGA256Click
end
object PaletteAmiga: TMenuItem
Caption = 'Amiga'
object PaletteAmiga2: TMenuItem
Expand Down
Loading

0 comments on commit 9e7a897

Please sign in to comment.