Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 5:33 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Colour Picker > Convert result into hex
PostPosted: January 21st, 2010, 11:58 am 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
Does anyone know how I can convert the returned value from the colour picker dll into another format such as hex? :?

There is a good example of this dll in the sample publications > external dll demonstration


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 21st, 2010, 2:10 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
Jez,

Simply do a search in this forum for these two terms: RGB Hex

There's a sample .imp already posted etc, etc.

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


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 21st, 2010, 3:11 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Might be wrong, but I don't think it's that simple.

The DLL doesn't return the RGB value. It returns the single colour value that Opus is able to create using the RGB function, but I don't think there is a inverse function.

I'm not even sure that it would be possible as the value returned by the DLL appears to a linear representation of the True Colour scheme.

However, the DLL might have other undocumented functions or DW might tweak it to return the hex value. The other alternative is to find a third party DLL.

I might be way off on this one though...

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 22nd, 2010, 12:57 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
Mack's probably right. And I overlooked the 'picker DLL' part of the question.

Check this out (for ARGB): http://msdn.microsoft.com/en-us/magazine/cc164113.aspx

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


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 22nd, 2010, 12:28 pm 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
Is the colour picker .dll (TestCallDLL.dll) made by DW? If so, it would be good if it could return a value that we could work with.


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 22nd, 2010, 12:39 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
The value returned is the RGB value as number, you need a bit of script to turn the number into a hex string, which I'm sure somebody had done somewhere.

Note that it might come out as BGR, and you'll have to swap B and R.


For this message Dave Emberton has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 22nd, 2010, 1:04 pm 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
Ok, done it :D

Code:
function decColor2hex(color) {
   colArr = color.toString(16).toUpperCase().split('');
   numChars = colArr.length
   for (a = 0; a < (6 - numChars); a++) {
      colArr.unshift("0")
      }
   return ("#"+colArr.join(''));
}
function Array_unshift() {
  var A_u = 0
  for (A_u = this.length-1; A_u >= 0; A_u--) {
   this[A_u + arguments.length] = this[A_u]
   }
  for (A_u = 0; A_u < arguments.length; A_u++) {
   this[A_u] = arguments[A_u]
   }
  return this.length
  }
if (typeof Array.prototype.unshift == "undefined") {
  Array.prototype.unshift = Array_unshift
  }



For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 22nd, 2010, 1:23 pm 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
Good point Dave!

Update:
Code:
function decColor2hex(color) {
   colArr = color.toString(16).toUpperCase().split('');
   numChars = colArr.length
   for (a = 0; a < (6 - numChars); a++) {
      colArr.unshift("0")
      }
   var a = colArr[0]
   var b = colArr[1]
   var c = colArr[2]
   var d = colArr[3]
   var e = colArr[4]
   var f = colArr[5]
   return ("#"+e+f+c+d+a+b);
}


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 22nd, 2010, 3:02 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Doh,

I actually converted to hex and got some value that didn't correspond.

Ockham need not apply :-)

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Colour Picker > Convert result into hex
PostPosted: April 29th, 2014, 1:16 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

Was able to find a solution, outside of Opus, using the accompanying C# utility instead (can convert the Access code to hex). Opus passes the picked color, using the Access code, to the utility, which can convert it, to set a border color.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 28 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group