Jump to content

  • Log In with Google      Sign In   
  • Create Account


gretty

Member Since 27 Dec 2009
Offline Last Active Jun 22 2014 07:10 PM
-----

#5112008 Insert Image into SQLite3 Database: Unsure whats causing the error

Posted by gretty on 25 November 2013 - 07:49 PM

First of all, SQLite doesn't care whether your blob is a valid PNG image.

Second, please try to understand what you are doing.
"Someone advised me to use byte[] instead of a string or etc" is not a matter of opinion: the function you are trying to call is declared as int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)), you cannot pass what you want as a parameter.

Third, RTFM.
Why are you goofing around with DllImport instead of using the proper .Net wrapper (system.data.sqlite.org)? Code examples like http://stackoverflow.com/questions/625029/how-do-i-store-and-retrieve-a-blob-from-sqlite are easy to find.

 

You're pretty rude and thats putting it politely. Dont assume I haven't read the ******* manual because I have (I am aware of a much simpler way to achieve what I am trying to do, ie, use system.data.sqlite). I am using Unity3d where you cant use system.data.sqlite.org so you are forced to use the C API, this may have changed in the latest release of Unity3d though.

 

I'll accept that you (incorrectly) assumed my ignorance but I dont accept your aggressive condescending demeanour. You were never obliged to reply to my thread so there's no reason to be angry and I'm telling you, dont reply to my threads in the future.




#4879152 Extract the R, G, B values from a Flash decimal number

Posted by gretty on 31 October 2011 - 11:56 PM

Hello

I have colour values from a Flash application that are ARGB format(A being the alpha/transparency value).

I have to convert that long decimal number to a RGB/Hexadecimal number in Javascript. I REALLY struggle with bitwise operations. In Flash the colour white is represented by the decimal number: 16777215, black is obviously 0. Other colours are like: 84545883, 4803910 etc which I have no idea what colour they are.

Do you know how I can extract the individual R, G, B & A values from a long(8 digit) number?

Can you help me get these functions to extract the (R,G,B,A) values?

function getA( num )
{
   // eg value for num is 84545883
   return (parseInt(num,10)) & 0xFF000000;  // does this correctly get the A value from a ARGB value?
}

function getR( num )
{
   // eg value for num is 84545883
   return (parseInt(num,10)) & 0x00FF0000;  // does this correctly get the R value from a ARGB value?
}

function getG( num )
{
   // eg value for num is 84545883
   return (parseInt(num,10)) & 0x0000FF00;  // does this correctly get the G value from a ARGB value?
}




PARTNERS