Archive for 'Nbsp Nbsp Nbsp Nbsp Nbsp'

object:setDrag property in corona

Turns any movieclip into a draggable object when drag is set as true.

The limitX and limitYparameters limit the dragging to either the x or y axis, and the bounds parameter can be used to specify drag boundaries for the object as {left, top, width, height}.

The onPress, onDrag and onRelease parameters take the names of functions to be called when those events occur. All parameters are optional.

myAnim:setDrag{ drag=true, limitX=false, limitY=false, onPress=myPressFunction, onDrag=myDragFunction,
               onRelease=myReleaseFunction, bounds={ 10, 10, 200, 50 }}

To turn off the draggable property again, set “drag” to false:

myAnim:setDrag{ drag=false }

TrueColor handling in php

color3

For Truecolor images the colors are simple 31-bit longs. Or,it is composed of 4 bytes .

The highest or leftmost bit in the alpha channel is not used which means the alpha channel can onlyhave values from 0 to 127.  You can use the ImageColorAllocate() as with paletted images, but you can also specify the color
directly.

<?php

$im  = ImageCreateTruecolor(300,256);

for($r=0; $r<256; $r++)

{

$col = ImageColorAllocate($im,$r,0,0);

ImageLine($im, 0,$r, 100, $r, $col);

}

for($g=0; $g<256; $g++)

{

$col = ImageColorAllocate($im,0,$g,0);

ImageLine($im, 100,255-$g, 200, 255-$g,
$col);

}

for($b=0; $b<256; $b++)

{

$col = ImageColorAllocate($im,0,0,$b);

ImageLine($im, 200,$b, 300, $b, $col);

}

Header('Content-Type: image/png');ImagePNG($im);

?>

output:

<?

$im = ImageCreateTrueColor(256,60);

for($x=0; $x<256; $x++)

{

ImageLine($im, $x, 0, $x, 19, $x);

ImageLine($im, 255-$x, 20, 255-$x, 39, $x<<8);

ImageLine($im, $x, 40, $x, 59, $x<<16);

}

Header('Content-Type: image/png');ImagePNG($im);

?>

output:

We Can Build Your App for You. Lets Get Started !