colourreducer_definedpalette_post_01.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. w,h=getpicturesize()
  2. ok,op1,op2,op3,op4,op5,op6=inputbox("?","ibm-cga",0,0,1,-1,"aquarius",0,0,1,-1,"c64",0,0,1,-1,"thomson",0,0,1,-1,"msx1",0,0,1,-1,"mz700",0,0,1,-1)
  3. if ok==true then
  4. rpal={};gpal={};bpal={};
  5. for n=0,255,1 do
  6. rpal[n+1],gpal[n+1],bpal[n+1]=getcolor(n)
  7. setcolor(n,0x00,0x00,0x00)
  8. end
  9. if op1==1 then -- ibm-cga
  10. setcolor( 0,0x00,0x00,0x00);setcolor( 1,0x00,0x00,0xAA);setcolor( 2,0x00,0xAA,0x00);setcolor( 3,0x00,0xAA,0xAA)
  11. setcolor( 4,0xAA,0x00,0x00);setcolor( 5,0xAA,0x00,0xAA);setcolor( 6,0xAA,0x55,0x00);setcolor( 7,0xAA,0xAA,0xAA)
  12. setcolor( 8,0x55,0x55,0x55);setcolor( 9,0x55,0x55,0xFF);setcolor(10,0x55,0xFF,0x55);setcolor(11,0x55,0xFF,0xFF)
  13. setcolor(12,0xFF,0x55,0x55);setcolor(13,0xFF,0x55,0xFF);setcolor(14,0xFF,0xFF,0x55);setcolor(15,0xFF,0xFF,0xFF)
  14. end
  15. if op2==1 then -- aquarius
  16. setcolor( 0,0x10,0x10,0x10);setcolor( 1,0xf0,0x10,0x10);setcolor( 2,0x10,0xf0,0x10);setcolor( 3,0xf0,0xe8,0x10)
  17. setcolor( 4,0x20,0x20,0xd8);setcolor( 5,0xf0,0x10,0xf0);setcolor( 6,0x30,0xc0,0xc0);setcolor( 7,0xf0,0xf0,0xf0)
  18. setcolor( 8,0xc0,0xc0,0xc0);setcolor( 9,0x28,0xa8,0xa8);setcolor(10,0xc0,0x20,0xc0);setcolor(11,0x40,0x10,0x88)
  19. setcolor(12,0xf0,0xf0,0x70);setcolor(13,0x20,0xc8,0x40);setcolor(14,0xa8,0x20,0x20);setcolor(15,0x30,0x30,0x30)
  20. end
  21. if op3==1 then -- c64
  22. setcolor( 0,0x00,0x00,0x00);setcolor( 1,0xff,0xff,0xff);setcolor( 2,0x88,0x39,0x32);setcolor( 3,0x67,0xB6,0xBD)
  23. setcolor( 4,0x8B,0x3F,0x96);setcolor( 5,0x55,0xA0,0x49);setcolor( 6,0x40,0x31,0x8D);setcolor( 7,0xBF,0xCE,0x72)
  24. setcolor( 8,0x8B,0x54,0x29);setcolor( 9,0x57,0x42,0x00);setcolor(10,0xB8,0x69,0x62);setcolor(11,0x50,0x50,0x50)
  25. setcolor(12,0x78,0x78,0x78);setcolor(13,0x94,0xE0,0x89);setcolor(14,0x78,0x69,0xC4);setcolor(15,0x9F,0x9F,0x9F)
  26. end
  27. if op4==1 then -- thomson
  28. setcolor( 0,0x00,0x00,0x00);setcolor( 1,0xff,0x00,0x00);setcolor( 2,0x00,0xff,0x00);setcolor( 3,0xff,0xff,0x00)
  29. setcolor( 4,0x00,0x00,0xff);setcolor( 5,0xff,0x00,0xff);setcolor( 6,0x00,0xff,0xff);setcolor( 7,0xff,0xff,0xff)
  30. setcolor( 8,0xbb,0xbb,0xbb);setcolor( 9,0xdd,0x77,0x77);setcolor(10,0x77,0xdd,0x77);setcolor(11,0xdd,0xdd,0x77)
  31. setcolor(12,0x77,0x77,0xdd);setcolor(13,0xdd,0x77,0xee);setcolor(14,0xbb,0xff,0xff);setcolor(15,0xee,0xbb,0x00)
  32. end
  33. if op5==1 then -- msx1
  34. setcolor( 0,0x00,0x00,0x00);setcolor( 1,0x00,0x00,0x00);setcolor( 2,0x3E,0xB8,0x49);setcolor( 3,0x74,0xD0,0x7D)
  35. setcolor( 4,0x59,0x55,0xE0);setcolor( 5,0x80,0x76,0xF1);setcolor( 6,0xB9,0x5E,0x51);setcolor( 7,0x65,0xDB,0xEF)
  36. setcolor( 8,0xDB,0x65,0x59);setcolor( 9,0xFF,0x89,0x7D);setcolor(10,0xCC,0xC3,0x5E);setcolor(11,0xDE,0xD0,0x87)
  37. setcolor(12,0x3A,0xA2,0x41);setcolor(13,0xB7,0x66,0xB5);setcolor(14,0xCC,0xCC,0xCC);setcolor(15,0xFF,0xFF,0xFF)
  38. end
  39. if op6==1 then -- mz700
  40. setcolor( 0,0x00,0x00,0x00);setcolor( 1,0x00,0x00,0xFF);setcolor( 2,0xFF,0x00,0x00);setcolor( 3,0xFF,0x00,0xFF)
  41. setcolor( 4,0x00,0xFF,0x00);setcolor( 5,0x00,0xFF,0xFF);setcolor( 6,0xFF,0xFF,0x00);setcolor( 7,0xFF,0xFF,0xFF)
  42. end
  43. for y=0,h-1,1 do
  44. for x=0,w-1,1 do
  45. c=getpicturepixel(x,y)
  46. c2=matchcolor(rpal[c+1],gpal[c+1],bpal[c+1])
  47. putpicturepixel(x,y,c2)
  48. end;end
  49. end