Digital Workshop http://forum.digitalworkshop.co.uk/ |
|
Easy method to give User a Colour-picker Palette http://forum.digitalworkshop.co.uk/viewtopic.php?f=13&t=3652 |
Page 1 of 1 |
Author: | Lar_123 [ April 12th, 2009, 12:42 pm ] |
Post subject: | Easy method to give User a Colour-picker Palette |
This Sample Pub is born out of a bit of frustration ---trying to give the User a way to change colour and texture on some objects. So I think I have 'given up' on SetTexture(), but pressed ahead with some colour setting set-ups. BTW, I still like that there is the real custom colour-picker via the DLL (demonstrated in Opus/DW sample pubs). However in the case I have in mind I wanted to give the User a good range of selections but avoid letting him get distracted trying to tweak a best colour. Here is a working method you can readily use and easily adapt. -It offers the User a Palette of ~150 colours. (you can decrease or increase that) -It takes the same standard (or even custom saved) palettes that you use in Opus editor. It reads-in those files. You simply ship one or more .pal files with your Pub. - Once loaded, you have ~direct access to the RGB values of those colours. - Think: launch a Page from a separate Chapter (though that's not required) If you can improve on this 'starter', sample Pub --- please post back with your ideas or extensions. Maybe the code could be improved. Possibly drag&drop 'painting'. Maybe we could have methods tailored to different types of objects (I mean polygons are different from other graphical objects... and buttons are in a class of their own when it comes to changing appearances.) But I think you'll find it is quite workable as it is. One last note: two reasons I pursued this direction. It is very easy to make a Custom palette in the Opus workspace (editor), and that saved .pal can be used here. The other driver is that I wanted to get at the html colour strings (eg, #D293F6)... failing that, I got at the RGB values. Cheers Larry [Edit: 041509] deleted attachment. Improved .imp available below. |
Author: | Lar_123 [ April 13th, 2009, 5:33 am ] |
Post subject: | updated version of the Script |
I've improved the Script to handle a couple cases where values may appear as undefined, and also simplified and cleaned-up some code that actually handles the RGB values. Seems speedier too. There is no change to the Pub or Page layout and objects. So simply download the updated, Rev 2, script and replace or delete the old Script_1 script object. If you have any doubts how to do this, the simplest to explain is this: Open the file in Notepad, Select All the text and Copy. Over in Opus Editor, edit the Script Object, Script_1. Delete all the current code, and Paste in all the new code. That's it. Advanced users may choose to "set external file" in the script editor and 'import' the Rev 2 file (it is .txt, so rename to .ils). One significant change is that the Pub Array now 'holds' four forms of the values for colour codes. For example: 132 45 210 132,45,210 RGB(132,45,210) as a string RGB(132,45,210) eval'd and stored as a number --- effective for making the actual colour/color change. Cheers. [Edit:] Seems the upload didn't take .ILS type. Try again as .TXT [Edit:] deleted the attachment, have revised/improved script included in .imp file below. |
Author: | Lar_123 [ April 16th, 2009, 12:33 am ] | ||
Post subject: | |||
Some additional tweaking and fixes. Have also added an action to step through a set of six supplied Palettes. New script is clean (I think) and fast. Debug pane is 'on' so you will see what is happening at a couple steps in the process. Script includes other 'inactive' debug lines you could also use. I have tried to document much of the action and events... pretty simple once you get past the unsimple parts. Easy to adapt. Attachment is working sample/demo pub. UserRuntimeColourPalette_RGB_ver3.zip Supercedes earlier posted .imp, and now INCLUDES the modified script code/file mentioned above... plus other improvements.
|
Author: | jpguillon [ July 12th, 2009, 3:33 am ] |
Post subject: | UserRuntimeColourPalette_RGB_ver3.zip |
where can i find your file. UserRuntimeColourPalette_RGB_ver3.zip. i need to allow my dyslexic user to choose a given colour background at the biggining that will be repeated automatically in all pages (polygon background) of the publication |
Author: | Paul [ July 12th, 2009, 4:55 am ] |
Post subject: | |
login to the forum -- then you will see the file. Paul |
Author: | Craig Gilman [ October 31st, 2009, 9:22 pm ] |
Post subject: | Part of Painting Publication? |
This looks as though it would be used in a painting program for choosing the colour of the pen/ink - is that what you're working on? I'd like to see how to create a simple painting tool that emulates a spray can - a simple program that allows you to select a colour for the paint, an eraser, a clear screen, a save to disk as image file, an option to increase/decrease brush size and possibly use stencils! Too bad I'm not a coder |
Author: | Lar_123 [ November 1st, 2009, 4:11 am ] |
Post subject: | |
Quote: - is that what you're working on? No. I was more interested in creating 'skins' and User theme preferences, more or less. The way it would work is a slide out panel... user tries different color sets (without going to full 88million colour selection of Windows Custom DLL picker). So I would create the compatible and complimentary colour schemes... let the user choose from a 'palette'. I do not find Opus all that 'friendly', nor 'easy to use' for User drawing and painting. Good that the features are there, but just cannot be as good as applications for paint/draw. Prove me wrong. I'd love to see this all work smoothly... and refined and fast. Quote: emulates a spray can
I doubt it. |
Author: | Lar_123 [ November 1st, 2009, 1:35 pm ] |
Post subject: | |
Quote: Quote:
emulates a spray can I doubt it. Actually, upon reconsidering, 'yes' I think this IS doable. Creating any kind of an 'undo' capability to remove sprayed paint might also be possible, even successive undos. You might use this post as a seed for your methods: viewtopic.php?t=1314&highlight=breadcrumb When I played with that (leaving a simple 'dot trail' along a single line or curved path), its performance was rather mediocre. Took a lot of processing power. You might find ways to greatly simplify and speed-up. Maybe it was the handling of clones that way that was slow?? In any case, emulating a spray can is a matter of specifying your radius or shape, and then placing the dots relative to the mouse position. You could even vary the hue/colour slightly for effect. (just take a chosen colour and randomly modulate the values for one of the RGB numbers... or maybe simpler, call for the colours from a palette). Have you thought of how you will save or recreate user paintings? |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |