Hi Rajeev, For this you can use Bitmap Data class.
On Dec 19, 1:10 pm, Rajveer Goud <[email protected]> wrote: > Hi dinesh thanks now i can draw on the background image also..!!! > > Can you please any one help about how to save the canvas background > image with drawn paint..!!! > > Regards > -------------- > Rajv > > On Dec 18, 6:40 pm, DineshKumar.T <[email protected]> wrote: > > > > > The same happens for background image also..... > > > On Thu, Dec 18, 2008 at 6:48 PM, DineshKumar. T > > <[email protected]>wrote: > > > > Hi Rajveer, > > > Actually it is drawing but behind the background color,you can check this > > > by setting backgroundColor="red" backgroundAlpha="0.2",meanwhile > > > let me find how to draw over this background color. > > > > Thanks and regards, > > > DineshKumar.T > > > > On Thu, Dec 18, 2008 at 11:36 AM, Rajveer Goud. <[email protected]>wrote: > > > >> Hi all..!!! > > > >> Iam working on flex paint ...i can draw on empty canvas by the mouse > > >> property isDrawing=true. > > >> but when i set background image for the canvas but iam unable to draw on > > >> the image . > > >> can any one provide me the info abt....!!! > > > >> The code i found is given below: > > > >> <?xml version="1.0" encoding="utf-8"?> > > > >> <mx:Application > > >> xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain"> <mx:Script> > > > >> <![CDATA[ > > >> *import* mx.rpc.events.ResultEvent; *private* *var* isDrawing:Boolean=* > > >> false*; *private* *var* x1:int; *private* *var* y1:int; *private* > > >> *var*x2:int; > > >> *private* *var* y2:int; *private* *var* drawColor:uint; *private* * > > >> function* doErase():*void* > > > >> { > > > >> canvas.graphics.clear(); > > > >> } > > >> *private* *function* doMouseDown():*void* > > > >> { > > > >> x1 = canvas.mouseX; > > > >> y1 = canvas.mouseY; > > > >> isDrawing = > > >> *true*; > > > >> } > > >> *private* *function* doMouseMove():*void* > > > >> { > > > >> x2 = canvas.mouseX; > > > >> y2 = canvas.mouseY; > > >> *if* (isDrawing) > > > >> { > > > >> canvas.graphics.lineStyle(2, drawColor); > > > >> canvas.graphics.moveTo(x1, y1); > > > >> canvas.graphics.lineTo(x2, y2); > > > >> x1 = x2; > > > >> y1 = y2; > > > >> } > > > >> } > > >> *private* *function* doMouseUp():*void* > > > >> { > > > >> isDrawing = > > >> *false*; > > > >> } > > >> */* > > > >> private function doSave():void > > > >> { > > > >> var bd:BitmapData = new BitmapData(canvas.width,canvas.height); > > > >> bd.draw(canvas); > > > >> var ba:ByteArray = PNGEnc.encode(bd); > > > >> ro.doUpload(ba); > > > >> }*/ > > >> * *private* *function* handleResult(event:ResultEvent):*void* > > > >> { > > >> *var* u:URLRequest = *new* URLRequest(*"servlet/DownloadImage?fileId="* + > > >> event.result.toString()); > > > >> navigateToURL(u, > > >> *"_blank"*); > > > >> } > > > >> ]]> > > >> </mx:Script> <mx:RemoteObject id="ro" destination="UploadImage-ro" > > > >> result="handleResult(event)" > > >> /> <mx:Panel title="FlexPaint"> <mx:Canvas id="canvas" width="300" > > >> height="300" > > > >> horizontalScrollPolicy=" > > >> off" verticalScrollPolicy="off" backgroundImage="assets/abc.JPG" > > > >> mouseDown="doMouseDown()" > > > >> mouseMove="doMouseMove()" > > > >> mouseUp="doMouseUp()" > > >> /> <mx:ControlBar> <mx:ColorPicker change="drawColor = > > >> event.target.selectedColor"/> <mx:Button label="Erase" click="doErase()" > > >> /> <mx:Button label="Save Image"/> </mx:ControlBar> </mx:Panel> > > > >> </mx:Application> > > > >> Regards > > > >> Rajveer- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

