summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-07-16 16:41:50 +0000
committerIan C <ianc@noddybox.co.uk>2020-07-16 16:41:50 +0000
commit9b7f485577be49d1b87e6d928d1ca130c743d020 (patch)
treec792f02ed15b278d9a244846c2f52b862e114942
parent801926dcf4444621516a0979f7a70135cd756f32 (diff)
Added make palette button to New form.
-rw-r--r--SpriteEd/Main.storyboard11
-rw-r--r--SpriteEd/SpriteSetController.cs298
-rw-r--r--SpriteEd/SpriteSetController.designer.cs13
3 files changed, 317 insertions, 5 deletions
diff --git a/SpriteEd/Main.storyboard b/SpriteEd/Main.storyboard
index 2130430..0ac35fa 100644
--- a/SpriteEd/Main.storyboard
+++ b/SpriteEd/Main.storyboard
@@ -445,6 +445,17 @@ Gw
</connections>
</popUpButtonCell>
</popUpButton>
+ <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aJ0-LX-f1G">
+ <rect key="frame" x="66" y="82" width="157" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <buttonCell key="cell" type="push" title="Create RGB Palette" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="U46-6k-J6L">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="OnCreateRGBPalette:" target="Drs-be-wgu" id="ylu-lI-WHe"/>
+ </connections>
+ </button>
</subviews>
</view>
<connections>
diff --git a/SpriteEd/SpriteSetController.cs b/SpriteEd/SpriteSetController.cs
index 65f872d..dd2ce75 100644
--- a/SpriteEd/SpriteSetController.cs
+++ b/SpriteEd/SpriteSetController.cs
@@ -214,5 +214,303 @@ namespace SpriteEd
{
m_palette[(uint)m_PaletteNumber.IntValue] = Util.ColourNS(m_ColourWell.Color);
}
+
+ partial void OnCreateRGBPalette(NSObject sender)
+ {
+ switch(m_palette.Size)
+ {
+ case 2:
+ SetMonoPalette();
+ break;
+
+ case 4:
+ SetColourPalette();
+ break;
+
+ case 16:
+ // Taken from RGBI palette
+ //
+ m_palette[0] = new Colour(0x00, 0x00, 0x00);
+ m_palette[1] = new Colour(0x00, 0x00, 0x80);
+ m_palette[2] = new Colour(0x00, 0x80, 0x00);
+ m_palette[3] = new Colour(0x00, 0x80, 0x80);
+ m_palette[4] = new Colour(0x80, 0x00, 0x00);
+ m_palette[5] = new Colour(0x80, 0x00, 0x80);
+ m_palette[6] = new Colour(0x80, 0x80, 0x00);
+ m_palette[7] = new Colour(0xaa, 0xaa, 0xaa);
+ m_palette[8] = new Colour(0x55, 0x55, 0x55);
+ m_palette[9] = new Colour(0x00, 0x00, 0xff);
+ m_palette[10] = new Colour(0x00, 0xff, 0x00);
+ m_palette[11] = new Colour(0x00, 0xff, 0xff);
+ m_palette[12] = new Colour(0xff, 0x00, 0x00);
+ m_palette[13] = new Colour(0xff, 0x00, 0xff);
+ m_palette[14] = new Colour(0xff, 0xff, 0x00);
+ m_palette[15] = new Colour(0xff, 0xff, 0xff);
+ break;
+
+ case 256:
+ // Taken from Spectrum Next sprite bitmap
+ //
+ m_palette[0] = new Colour(0x00, 0x00, 0x00);
+ m_palette[1] = new Colour(0x55, 0x00, 0x00);
+ m_palette[2] = new Colour(0xaa, 0x00, 0x00);
+ m_palette[3] = new Colour(0xff, 0x00, 0x00);
+ m_palette[4] = new Colour(0x00, 0x24, 0x00);
+ m_palette[5] = new Colour(0x55, 0x24, 0x00);
+ m_palette[6] = new Colour(0xaa, 0x24, 0x00);
+ m_palette[7] = new Colour(0xff, 0x24, 0x00);
+ m_palette[8] = new Colour(0x00, 0x48, 0x00);
+ m_palette[9] = new Colour(0x55, 0x48, 0x00);
+ m_palette[10] = new Colour(0xaa, 0x48, 0x00);
+ m_palette[11] = new Colour(0xff, 0x48, 0x00);
+ m_palette[12] = new Colour(0x00, 0x6c, 0x00);
+ m_palette[13] = new Colour(0x55, 0x6c, 0x00);
+ m_palette[14] = new Colour(0xaa, 0x6c, 0x00);
+ m_palette[15] = new Colour(0xff, 0x6c, 0x00);
+ m_palette[16] = new Colour(0x00, 0x90, 0x00);
+ m_palette[17] = new Colour(0x55, 0x90, 0x00);
+ m_palette[18] = new Colour(0xaa, 0x90, 0x00);
+ m_palette[19] = new Colour(0xff, 0x90, 0x00);
+ m_palette[20] = new Colour(0x00, 0xb4, 0x00);
+ m_palette[21] = new Colour(0x55, 0xb4, 0x00);
+ m_palette[22] = new Colour(0xaa, 0xb4, 0x00);
+ m_palette[23] = new Colour(0xff, 0xb4, 0x00);
+ m_palette[24] = new Colour(0x00, 0xd8, 0x00);
+ m_palette[25] = new Colour(0x55, 0xd8, 0x00);
+ m_palette[26] = new Colour(0xaa, 0xd8, 0x00);
+ m_palette[27] = new Colour(0xff, 0xd8, 0x00);
+ m_palette[28] = new Colour(0x00, 0xfc, 0x00);
+ m_palette[29] = new Colour(0x55, 0xfc, 0x00);
+ m_palette[30] = new Colour(0xaa, 0xfc, 0x00);
+ m_palette[31] = new Colour(0xff, 0xfc, 0x00);
+ m_palette[32] = new Colour(0x00, 0x00, 0x24);
+ m_palette[33] = new Colour(0x55, 0x00, 0x24);
+ m_palette[34] = new Colour(0xaa, 0x00, 0x24);
+ m_palette[35] = new Colour(0xff, 0x00, 0x24);
+ m_palette[36] = new Colour(0x00, 0x24, 0x24);
+ m_palette[37] = new Colour(0x55, 0x24, 0x24);
+ m_palette[38] = new Colour(0xaa, 0x24, 0x24);
+ m_palette[39] = new Colour(0xff, 0x24, 0x24);
+ m_palette[40] = new Colour(0x00, 0x48, 0x24);
+ m_palette[41] = new Colour(0x55, 0x48, 0x24);
+ m_palette[42] = new Colour(0xaa, 0x48, 0x24);
+ m_palette[43] = new Colour(0xff, 0x48, 0x24);
+ m_palette[44] = new Colour(0x00, 0x6c, 0x24);
+ m_palette[45] = new Colour(0x55, 0x6c, 0x24);
+ m_palette[46] = new Colour(0xaa, 0x6c, 0x24);
+ m_palette[47] = new Colour(0xff, 0x6c, 0x24);
+ m_palette[48] = new Colour(0x00, 0x90, 0x24);
+ m_palette[49] = new Colour(0x55, 0x90, 0x24);
+ m_palette[50] = new Colour(0xaa, 0x90, 0x24);
+ m_palette[51] = new Colour(0xff, 0x90, 0x24);
+ m_palette[52] = new Colour(0x00, 0xb4, 0x24);
+ m_palette[53] = new Colour(0x55, 0xb4, 0x24);
+ m_palette[54] = new Colour(0xaa, 0xb4, 0x24);
+ m_palette[55] = new Colour(0xff, 0xb4, 0x24);
+ m_palette[56] = new Colour(0x00, 0xd8, 0x24);
+ m_palette[57] = new Colour(0x55, 0xd8, 0x24);
+ m_palette[58] = new Colour(0xaa, 0xd8, 0x24);
+ m_palette[59] = new Colour(0xff, 0xd8, 0x24);
+ m_palette[60] = new Colour(0x00, 0xfc, 0x24);
+ m_palette[61] = new Colour(0x55, 0xfc, 0x24);
+ m_palette[62] = new Colour(0xaa, 0xfc, 0x24);
+ m_palette[63] = new Colour(0xff, 0xfc, 0x24);
+ m_palette[64] = new Colour(0x00, 0x00, 0x48);
+ m_palette[65] = new Colour(0x55, 0x00, 0x48);
+ m_palette[66] = new Colour(0xaa, 0x00, 0x48);
+ m_palette[67] = new Colour(0xff, 0x00, 0x48);
+ m_palette[68] = new Colour(0x00, 0x24, 0x48);
+ m_palette[69] = new Colour(0x55, 0x24, 0x48);
+ m_palette[70] = new Colour(0xaa, 0x24, 0x48);
+ m_palette[71] = new Colour(0xff, 0x24, 0x48);
+ m_palette[72] = new Colour(0x00, 0x48, 0x48);
+ m_palette[73] = new Colour(0x55, 0x48, 0x48);
+ m_palette[74] = new Colour(0xaa, 0x48, 0x48);
+ m_palette[75] = new Colour(0xff, 0x48, 0x48);
+ m_palette[76] = new Colour(0x00, 0x6c, 0x48);
+ m_palette[77] = new Colour(0x55, 0x6c, 0x48);
+ m_palette[78] = new Colour(0xaa, 0x6c, 0x48);
+ m_palette[79] = new Colour(0xff, 0x6c, 0x48);
+ m_palette[80] = new Colour(0x00, 0x90, 0x48);
+ m_palette[81] = new Colour(0x55, 0x90, 0x48);
+ m_palette[82] = new Colour(0xaa, 0x90, 0x48);
+ m_palette[83] = new Colour(0xff, 0x90, 0x48);
+ m_palette[84] = new Colour(0x00, 0xb4, 0x48);
+ m_palette[85] = new Colour(0x55, 0xb4, 0x48);
+ m_palette[86] = new Colour(0xaa, 0xb4, 0x48);
+ m_palette[87] = new Colour(0xff, 0xb4, 0x48);
+ m_palette[88] = new Colour(0x00, 0xd8, 0x48);
+ m_palette[89] = new Colour(0x55, 0xd8, 0x48);
+ m_palette[90] = new Colour(0xaa, 0xd8, 0x48);
+ m_palette[91] = new Colour(0xff, 0xd8, 0x48);
+ m_palette[92] = new Colour(0x00, 0xfc, 0x48);
+ m_palette[93] = new Colour(0x55, 0xfc, 0x48);
+ m_palette[94] = new Colour(0xaa, 0xfc, 0x48);
+ m_palette[95] = new Colour(0xff, 0xfc, 0x48);
+ m_palette[96] = new Colour(0x00, 0x00, 0x6c);
+ m_palette[97] = new Colour(0x55, 0x00, 0x6c);
+ m_palette[98] = new Colour(0xaa, 0x00, 0x6c);
+ m_palette[99] = new Colour(0xff, 0x00, 0x6c);
+ m_palette[100] = new Colour(0x00, 0x24, 0x6c);
+ m_palette[101] = new Colour(0x55, 0x24, 0x6c);
+ m_palette[102] = new Colour(0xaa, 0x24, 0x6c);
+ m_palette[103] = new Colour(0xff, 0x24, 0x6c);
+ m_palette[104] = new Colour(0x00, 0x48, 0x6c);
+ m_palette[105] = new Colour(0x55, 0x48, 0x6c);
+ m_palette[106] = new Colour(0xaa, 0x48, 0x6c);
+ m_palette[107] = new Colour(0xff, 0x48, 0x6c);
+ m_palette[108] = new Colour(0x00, 0x6c, 0x6c);
+ m_palette[109] = new Colour(0x55, 0x6c, 0x6c);
+ m_palette[110] = new Colour(0xaa, 0x6c, 0x6c);
+ m_palette[111] = new Colour(0xff, 0x6c, 0x6c);
+ m_palette[112] = new Colour(0x00, 0x90, 0x6c);
+ m_palette[113] = new Colour(0x55, 0x90, 0x6c);
+ m_palette[114] = new Colour(0xaa, 0x90, 0x6c);
+ m_palette[115] = new Colour(0xff, 0x90, 0x6c);
+ m_palette[116] = new Colour(0x00, 0xb4, 0x6c);
+ m_palette[117] = new Colour(0x55, 0xb4, 0x6c);
+ m_palette[118] = new Colour(0xaa, 0xb4, 0x6c);
+ m_palette[119] = new Colour(0xff, 0xb4, 0x6c);
+ m_palette[120] = new Colour(0x00, 0xd8, 0x6c);
+ m_palette[121] = new Colour(0x55, 0xd8, 0x6c);
+ m_palette[122] = new Colour(0xaa, 0xd8, 0x6c);
+ m_palette[123] = new Colour(0xff, 0xd8, 0x6c);
+ m_palette[124] = new Colour(0x00, 0xfc, 0x6c);
+ m_palette[125] = new Colour(0x55, 0xfc, 0x6c);
+ m_palette[126] = new Colour(0xaa, 0xfc, 0x6c);
+ m_palette[127] = new Colour(0xff, 0xfc, 0x6c);
+ m_palette[128] = new Colour(0x00, 0x00, 0x90);
+ m_palette[129] = new Colour(0x55, 0x00, 0x90);
+ m_palette[130] = new Colour(0xaa, 0x00, 0x90);
+ m_palette[131] = new Colour(0xff, 0x00, 0x90);
+ m_palette[132] = new Colour(0x00, 0x24, 0x90);
+ m_palette[133] = new Colour(0x55, 0x24, 0x90);
+ m_palette[134] = new Colour(0xaa, 0x24, 0x90);
+ m_palette[135] = new Colour(0xff, 0x24, 0x90);
+ m_palette[136] = new Colour(0x00, 0x48, 0x90);
+ m_palette[137] = new Colour(0x55, 0x48, 0x90);
+ m_palette[138] = new Colour(0xaa, 0x48, 0x90);
+ m_palette[139] = new Colour(0xff, 0x48, 0x90);
+ m_palette[140] = new Colour(0x00, 0x6c, 0x90);
+ m_palette[141] = new Colour(0x55, 0x6c, 0x90);
+ m_palette[142] = new Colour(0xaa, 0x6c, 0x90);
+ m_palette[143] = new Colour(0xff, 0x6c, 0x90);
+ m_palette[144] = new Colour(0x00, 0x90, 0x90);
+ m_palette[145] = new Colour(0x55, 0x90, 0x90);
+ m_palette[146] = new Colour(0xaa, 0x90, 0x90);
+ m_palette[147] = new Colour(0xff, 0x90, 0x90);
+ m_palette[148] = new Colour(0x00, 0xb4, 0x90);
+ m_palette[149] = new Colour(0x55, 0xb4, 0x90);
+ m_palette[150] = new Colour(0xaa, 0xb4, 0x90);
+ m_palette[151] = new Colour(0xff, 0xb4, 0x90);
+ m_palette[152] = new Colour(0x00, 0xd8, 0x90);
+ m_palette[153] = new Colour(0x55, 0xd8, 0x90);
+ m_palette[154] = new Colour(0xaa, 0xd8, 0x90);
+ m_palette[155] = new Colour(0xff, 0xd8, 0x90);
+ m_palette[156] = new Colour(0x00, 0xfc, 0x90);
+ m_palette[157] = new Colour(0x55, 0xfc, 0x90);
+ m_palette[158] = new Colour(0xaa, 0xfc, 0x90);
+ m_palette[159] = new Colour(0xff, 0xfc, 0x90);
+ m_palette[160] = new Colour(0x00, 0x00, 0xb4);
+ m_palette[161] = new Colour(0x55, 0x00, 0xb4);
+ m_palette[162] = new Colour(0xaa, 0x00, 0xb4);
+ m_palette[163] = new Colour(0xff, 0x00, 0xb4);
+ m_palette[164] = new Colour(0x00, 0x24, 0xb4);
+ m_palette[165] = new Colour(0x55, 0x24, 0xb4);
+ m_palette[166] = new Colour(0xaa, 0x24, 0xb4);
+ m_palette[167] = new Colour(0xff, 0x24, 0xb4);
+ m_palette[168] = new Colour(0x00, 0x48, 0xb4);
+ m_palette[169] = new Colour(0x55, 0x48, 0xb4);
+ m_palette[170] = new Colour(0xaa, 0x48, 0xb4);
+ m_palette[171] = new Colour(0xff, 0x48, 0xb4);
+ m_palette[172] = new Colour(0x00, 0x6c, 0xb4);
+ m_palette[173] = new Colour(0x55, 0x6c, 0xb4);
+ m_palette[174] = new Colour(0xaa, 0x6c, 0xb4);
+ m_palette[175] = new Colour(0xff, 0x6c, 0xb4);
+ m_palette[176] = new Colour(0x00, 0x90, 0xb4);
+ m_palette[177] = new Colour(0x55, 0x90, 0xb4);
+ m_palette[178] = new Colour(0xaa, 0x90, 0xb4);
+ m_palette[179] = new Colour(0xff, 0x90, 0xb4);
+ m_palette[180] = new Colour(0x00, 0xb4, 0xb4);
+ m_palette[181] = new Colour(0x55, 0xb4, 0xb4);
+ m_palette[182] = new Colour(0xaa, 0xb4, 0xb4);
+ m_palette[183] = new Colour(0xff, 0xb4, 0xb4);
+ m_palette[184] = new Colour(0x00, 0xd8, 0xb4);
+ m_palette[185] = new Colour(0x55, 0xd8, 0xb4);
+ m_palette[186] = new Colour(0xaa, 0xd8, 0xb4);
+ m_palette[187] = new Colour(0xff, 0xd8, 0xb4);
+ m_palette[188] = new Colour(0x00, 0xfc, 0xb4);
+ m_palette[189] = new Colour(0x55, 0xfc, 0xb4);
+ m_palette[190] = new Colour(0xaa, 0xfc, 0xb4);
+ m_palette[191] = new Colour(0xff, 0xfc, 0xb4);
+ m_palette[192] = new Colour(0x00, 0x00, 0xd8);
+ m_palette[193] = new Colour(0x55, 0x00, 0xd8);
+ m_palette[194] = new Colour(0xaa, 0x00, 0xd8);
+ m_palette[195] = new Colour(0xff, 0x00, 0xd8);
+ m_palette[196] = new Colour(0x00, 0x24, 0xd8);
+ m_palette[197] = new Colour(0x55, 0x24, 0xd8);
+ m_palette[198] = new Colour(0xaa, 0x24, 0xd8);
+ m_palette[199] = new Colour(0xff, 0x24, 0xd8);
+ m_palette[200] = new Colour(0x00, 0x48, 0xd8);
+ m_palette[201] = new Colour(0x55, 0x48, 0xd8);
+ m_palette[202] = new Colour(0xaa, 0x48, 0xd8);
+ m_palette[203] = new Colour(0xff, 0x48, 0xd8);
+ m_palette[204] = new Colour(0x00, 0x6c, 0xd8);
+ m_palette[205] = new Colour(0x55, 0x6c, 0xd8);
+ m_palette[206] = new Colour(0xaa, 0x6c, 0xd8);
+ m_palette[207] = new Colour(0xff, 0x6c, 0xd8);
+ m_palette[208] = new Colour(0x00, 0x90, 0xd8);
+ m_palette[209] = new Colour(0x55, 0x90, 0xd8);
+ m_palette[210] = new Colour(0xaa, 0x90, 0xd8);
+ m_palette[211] = new Colour(0xff, 0x90, 0xd8);
+ m_palette[212] = new Colour(0x00, 0xb4, 0xd8);
+ m_palette[213] = new Colour(0x55, 0xb4, 0xd8);
+ m_palette[214] = new Colour(0xaa, 0xb4, 0xd8);
+ m_palette[215] = new Colour(0xff, 0xb4, 0xd8);
+ m_palette[216] = new Colour(0x00, 0xd8, 0xd8);
+ m_palette[217] = new Colour(0x55, 0xd8, 0xd8);
+ m_palette[218] = new Colour(0xaa, 0xd8, 0xd8);
+ m_palette[219] = new Colour(0xff, 0xd8, 0xd8);
+ m_palette[220] = new Colour(0x00, 0xfc, 0xd8);
+ m_palette[221] = new Colour(0x55, 0xfc, 0xd8);
+ m_palette[222] = new Colour(0xaa, 0xfc, 0xd8);
+ m_palette[223] = new Colour(0xff, 0xfc, 0xd8);
+ m_palette[224] = new Colour(0x00, 0x00, 0xfc);
+ m_palette[225] = new Colour(0x55, 0x00, 0xfc);
+ m_palette[226] = new Colour(0xaa, 0x00, 0xfc);
+ m_palette[227] = new Colour(0xff, 0x00, 0xff);
+ m_palette[228] = new Colour(0x00, 0x24, 0xfc);
+ m_palette[229] = new Colour(0x55, 0x24, 0xfc);
+ m_palette[230] = new Colour(0xaa, 0x24, 0xfc);
+ m_palette[231] = new Colour(0xff, 0x24, 0xfc);
+ m_palette[232] = new Colour(0x00, 0x48, 0xfc);
+ m_palette[233] = new Colour(0x55, 0x48, 0xfc);
+ m_palette[234] = new Colour(0xaa, 0x48, 0xfc);
+ m_palette[235] = new Colour(0xff, 0x48, 0xfc);
+ m_palette[236] = new Colour(0x00, 0x6c, 0xfc);
+ m_palette[237] = new Colour(0x55, 0x6c, 0xfc);
+ m_palette[238] = new Colour(0xaa, 0x6c, 0xfc);
+ m_palette[239] = new Colour(0xff, 0x6c, 0xfc);
+ m_palette[240] = new Colour(0x00, 0x90, 0xfc);
+ m_palette[241] = new Colour(0x55, 0x90, 0xfc);
+ m_palette[242] = new Colour(0xaa, 0x90, 0xfc);
+ m_palette[243] = new Colour(0xff, 0x90, 0xfc);
+ m_palette[244] = new Colour(0x00, 0xb4, 0xfc);
+ m_palette[245] = new Colour(0x55, 0xb4, 0xfc);
+ m_palette[246] = new Colour(0xaa, 0xb4, 0xfc);
+ m_palette[247] = new Colour(0xff, 0xb4, 0xfc);
+ m_palette[248] = new Colour(0x00, 0xd8, 0xfc);
+ m_palette[249] = new Colour(0x55, 0xd8, 0xfc);
+ m_palette[250] = new Colour(0xaa, 0xd8, 0xfc);
+ m_palette[251] = new Colour(0xff, 0xd8, 0xfc);
+ m_palette[252] = new Colour(0x00, 0xfc, 0xfc);
+ m_palette[253] = new Colour(0x55, 0xfc, 0xfc);
+ m_palette[254] = new Colour(0xaa, 0xfc, 0xfc);
+ m_palette[255] = new Colour(0xff, 0xff, 0xff);
+ break;
+ }
+
+ OnPaletteStepper(m_PaletteStepper);
+ }
}
}
diff --git a/SpriteEd/SpriteSetController.designer.cs b/SpriteEd/SpriteSetController.designer.cs
index 4b4ecf7..28d5848 100644
--- a/SpriteEd/SpriteSetController.designer.cs
+++ b/SpriteEd/SpriteSetController.designer.cs
@@ -54,6 +54,9 @@ namespace SpriteEd
[Action ("OnColourWell:")]
partial void OnColourWell (Foundation.NSObject sender);
+ [Action ("OnCreateRGBPalette:")]
+ partial void OnCreateRGBPalette (Foundation.NSObject sender);
+
[Action ("OnHeightStepper:")]
partial void OnHeightStepper (Foundation.NSObject sender);
@@ -114,6 +117,11 @@ namespace SpriteEd
m_PaletteNumber = null;
}
+ if (m_PaletteSize != null) {
+ m_PaletteSize.Dispose ();
+ m_PaletteSize = null;
+ }
+
if (m_PaletteStepper != null) {
m_PaletteStepper.Dispose ();
m_PaletteStepper = null;
@@ -128,11 +136,6 @@ namespace SpriteEd
m_WidthStepper.Dispose ();
m_WidthStepper = null;
}
-
- if (m_PaletteSize != null) {
- m_PaletteSize.Dispose ();
- m_PaletteSize = null;
- }
}
}
}