Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 6:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Easy method to give User a Colour-picker Palette
PostPosted: April 12th, 2009, 12:42 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
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.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Last edited by Lar_123 on April 16th, 2009, 12:17 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: updated version of the Script
PostPosted: April 13th, 2009, 5:33 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
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.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Last edited by Lar_123 on April 16th, 2009, 12:36 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: April 16th, 2009, 12:33 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
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. :wink:

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.


Attachments:
File comment: Easy to use and very flexible to adapt -- Runtime Colour Chooser
UserRuntimeColourPalette_RGB_ver3.zip [36.22 KiB]
Downloaded 1302 times

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi
Top
 Profile  
 
 Post subject: UserRuntimeColourPalette_RGB_ver3.zip
PostPosted: July 12th, 2009, 3:33 am 
Offline

Joined: March 27th, 2008, 3:19 pm
Posts: 9
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


For this message jpguillon has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: July 12th, 2009, 4:55 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
login to the forum -- then you will see the file.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Part of Painting Publication?
PostPosted: October 31st, 2009, 9:22 pm 
Offline

Joined: November 19th, 2004, 1:36 pm
Posts: 178
Location: Birmingham
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 :(

_________________
Opus Pro 05
http://www.waspinagermanhelmet.co.uk


For this message Craig Gilman has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: November 1st, 2009, 4:11 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
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.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: November 1st, 2009, 1:35 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
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?

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group