About Monkey 2 › Forums › Monkey 2 Projects › ColorTagz
This topic contains 7 replies, has 2 voices, and was last updated by cocon 4 months ago.
-
AuthorPosts
-
October 7, 2018 at 7:27 am #15510
Small app I’m working on.
Drag drop image, pick colors to make a tagAttachments:
October 8, 2018 at 9:58 am #15516More or less getting finished now with added help, color spreads, ability to nudge colors up/down in tone.
Loading and saving now complete with loading of (jasc) .pal and .mx2palette files.
I’ve created a number of ‘default’ colortagz to play with and now need to work on image export
Then I’ll begin importing of the colortagz code into my other editors
October 8, 2018 at 1:53 pm #15517first look at FontSprite editor with new ColorTagz loaded
October 10, 2018 at 6:25 am #15519Almost finished now:
You can see an image has been dropped and some colors picked from the image.The toolbar has 2 extra ‘export’ icons for exporting the results as images:
the current ColorTag:
and also the colorTagz that have been defined
One the export is completely finished I will also up the loading code
December 14, 2018 at 4:06 pm #15689Really great design, I can get many ideas from this.
December 15, 2018 at 7:37 am #15692I’ll up the loading code in the next few days
December 15, 2018 at 7:44 am #15693OK. Here’s the core colorTagz code with the loading routines:
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586class ColorTagzCorefield Path:string = ""field Count:int = -1field Active:bool[, ] = New bool[256, 5]field Red:ubyte[, ] = New ubyte[256, 5]field Green:ubyte[, ] = New ubyte[256, 5]field Blue:ubyte[, ] = New ubyte[256, 5]field CurrentColor:int = 0method AddTagColor:bool( tag:int, col:int, r:ubyte, g:ubyte, b:ubyte )If tag < 0 or tag > 255 Then Return FalseIf col < 0 or col > 4 Then Return falseCurrentColor = colIf tag > Count ThenCount = tagEnd IfActive[ tag, col ] = trueRed[ tag, col ] = rGreen[ tag, col ] = gBlue[ tag, col ] = b' Print tag+" "+r+" "+g+" "+bIf r = 0 And g = 0 And b = 0 Then Return Falsereturn TrueEnd methodmethod Load:bool( path:string )Local file := Stream.Open( path, "r" )If Not file Then Return falseLocal header:string = file.ReadCString()If header = "mx2tagz" ThenPath = pathLocal count:int = file.ReadUInt()Local check1:int = file.ReadUInt()Local check2:int = file.ReadUInt()If check1 <> 9947 or check2 <> 8873 Then Return false' Print count+" Colors"Count = countIf count < 256 ThenLocal k:intLocal red:UbyteLocal green:UbyteLocal blue:UbyteFor k = 0 to countred = file.ReadUByte()green = file.ReadUByte()blue = file.ReadUByte()AddTagColor( k, 0, red, green, blue )red = file.ReadUByte()green = file.ReadUByte()blue = file.ReadUByte()AddTagColor( k, 1, red, green, blue )red = file.ReadUByte()green = file.ReadUByte()blue = file.ReadUByte()AddTagColor( k, 2, red, green, blue )red = file.ReadUByte()green = file.ReadUByte()blue = file.ReadUByte()AddTagColor( k, 3, red, green, blue )red = file.ReadUByte()green = file.ReadUByte()blue = file.ReadUByte()AddTagColor( k, 4, red, green, blue )nextEnd IfEnd iffile.Close()Return trueEnd methodEnd ClassDecember 15, 2018 at 8:34 pm #15696In every drawing application there is only one swatch to draw with, a primary and secondary. My idea is to have a random color every time, that is chosen at random out of a set colors.
P.S. The starting code was this. I did expanded the code with by adding a few more tools like spray dots and such. But now I am ready to build a proper brush engine for more control.
-
AuthorPosts
You must be logged in to reply to this topic.