Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
nishanthe  
#1 Posted : Friday, October 07, 2005 8:41:32 PM(UTC)
nishanthe

Rank: Member

Groups: Member
Joined: 10/7/2005(UTC)
Posts: 10

Hi All Friends at Aurigma, I am currently developping an on-line virtual guitar designing application with Flash. for that I am hoping to use Aurigma GM for ActiveX with ASP..It seems to me that all the feature that want to have for the application is already available with this magnifcient component, But I am not clear enough about the one functionality. I have a one layer with flash that has feathered edges, and need to select the colors..with flash, I can do that, But I want to generate an Image, for that, I think I will need to overlay a color for a PNG image. Can somebody tell me that, is there any way to get the effect like Photoshop's Layer->Color Overlay effect? NB: I have attached a simple PNG image that simply show my requirement Thank you in advance, -Nishanthe
nishanthe attached the following image(s):
transparent_gradient.png
Andrew  
#2 Posted : Monday, October 17, 2005 1:56:11 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 865

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
Hi Nishanthe, Please tell about it more detailed. Do you have a mask for each guitar shape? Are all guitars solid-color, or you need to handle multiple colors (like sunburst, etc)?
nishanthe  
#3 Posted : Wednesday, October 19, 2005 12:12:02 PM(UTC)
nishanthe

Rank: Member

Groups: Member
Joined: 10/7/2005(UTC)
Posts: 10

Hi Andrew, thank you for responding. I link of my project. yes with flash I use mask of a guitar shape, I want to render the Bursts with Aurigma component (you will be get an idea after seeing the demo)... http://www.wmslk.com/vguitar again thank you for your courtesy regarding the matter. -Nishanthe
Andrew  
#4 Posted : Wednesday, October 19, 2005 4:53:34 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 865

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
Hi Nishanthe, Please find a code sample below. I hope it will help you. There are two input files are used:
  • tele.png - unpainted guitar image
  • tele-mask.png - mask image for the guitar
Variables intColor and intOpacity manipulate with the result color and opacity respectively. Also, you can play with a combine mode is common alpha blending is not what you need.
Code:
<!-- METADATA TYPE="typelib" UUID="{3CE48541-DE7A-4909-9314-9D0ED0D1CA5A}"-->
<%

Dim intOpacity
Dim intColor

intOpacity = 255
intColor = &hFF00FF00 ' Green

Dim objGuitarBitmap ' File containing the guitar image
Dim objMask ' File containing the guitar body mask
Dim objColorLayer ' Colored layer which will be blended with original image

Set objGuitarBitmap = Server.CreateObject("GraphicsMill.Bitmap")
Set objMask = Server.CreateObject("GraphicsMill.Bitmap")
Set objColorLayer = Server.CreateObject("GraphicsMill.Bitmap")

' Load the original file and the mask
objGuitarBitmap.LoadFromFile Server.MapPath("tele.png")
objMask.LoadFromFile Server.MapPath("tele-mask.png")
 
' Creating the color layer. It should be of the same size as mask
objColorLayer.CreateNew objMask.Width, objMask.Height, Format32bppArgb, intColor

' Use the mask as an alpha channel for the color layer. Now when we try to 
' alpha blend objColorLayer with objGuitarBitmap, colors will be blended
' according to the mask
objColorLayer.Channels.Replace objMask, 3

' Blend 
objColorLayer.DrawOnBitmap objGuitarBitmap, , , , , , , , , CombineModeAlpha, intOpacity

objGuitarBitmap.SaveToStream Response

%>
Please let me know if you have any problems with it.

Edited by user Sunday, December 23, 2007 4:40:32 PM(UTC)  | Reason: Not specified

nishanthe  
#5 Posted : Sunday, October 23, 2005 12:36:08 PM(UTC)
nishanthe

Rank: Member

Groups: Member
Joined: 10/7/2005(UTC)
Posts: 10

Thank you for your generosity and co-ordination andrew. I will try and let you know. and I am also trying to use Flash 8, Bitmap Class' getPixel and store the data in an array...and send to ASP, and again generate the image with setPixel method of GM for ActiveX. which method do you think will be efficient from the method you mentioned above and the method I am described here? thank you again -Nishanthe
Andrew  
#6 Posted : Monday, October 24, 2005 12:31:39 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 865

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
SetPixel method works very slow. It is not recommended to generate entire bitmap through this method (i.e. iterate through each pixel of the bitmap and call SetPixel for it). It is ok to use SetPixel only if you make few calls of it per one bitmap.
nishanthe  
#7 Posted : Thursday, October 27, 2005 10:33:18 PM(UTC)
nishanthe

Rank: Member

Groups: Member
Joined: 10/7/2005(UTC)
Posts: 10

thank you andrew, I will let you know the updates.. -Nishanthe
nishanthe  
#8 Posted : Saturday, December 03, 2005 2:03:19 PM(UTC)
nishanthe

Rank: Member

Groups: Member
Joined: 10/7/2005(UTC)
Posts: 10

Hi Andrew, After quite long time. I tested your sample with following files 1. tele.jpg 2. mask.png (8 bit-grascale created with photoshop) but when I run the script I get following error. GraphicsMill.Bitmap.2.0 error '80070057' Method Replace failed. Argument 'newChannel' has an unappropriate value (It should be 8-bit grayscale bitmap.). /graphicsmill/test.asp, line 28 I hope you will be able to help me withthis. thank you -Nishanthe
Andrew  
#9 Posted : Friday, January 06, 2006 12:52:22 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 865

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
Perhaps you saved the mask.png file as 24-bit or 8-bit indexed. I recommend to call ConvertTo8bppGrayscale before replacing the channel:
Code:
...
objMask.Data.ConvertTo8bppGrayscale
objColorLayer.Channels.Replace objMask, 3
...

Edited by user Sunday, December 23, 2007 5:10:05 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.