From deep_sky at ...761... Fri Dec 16 00:46:17 2016 From: deep_sky at ...761... (RichardB) Date: Thu, 15 Dec 2016 16:46:17 -0700 (MST) Subject: [Gambas-devel] Transparent DrawingArea Message-ID: <1481845577367-58023.post@...752...> I?m trying to develop an app in Gambas v3.9.1 that uses a transparent DrawingArea layered over a PictureBox ? the intention is to load a picture into the PictureBox and mark points (or lines) on the DrawingArea for measurement. I?m a newbie to Gambas ? does anyone have any advice on how to get this to work? Or is there a better way to do this? -- View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023.html Sent from the gambas-devel mailing list archive at Nabble.com. From moviga at ...758... Fri Dec 16 09:28:17 2016 From: moviga at ...758... (Moviga Technologies) Date: Fri, 16 Dec 2016 09:28:17 +0100 Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: <1481845577367-58023.post@...752...> References: <1481845577367-58023.post@...752...> Message-ID: <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> You can draw the image in the DrawingArea, and then draw on top of it. Den 16. des. 2016 00:46, skrev RichardB: > I?m trying to develop an app in Gambas v3.9.1 that uses a transparent > DrawingArea layered over a PictureBox ? the intention is to load a picture > into the PictureBox and mark points (or lines) on the DrawingArea for > measurement. I?m a newbie to Gambas ? does anyone have any advice on how to > get this to work? Or is there a better way to do this? > > > > -- > View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023.html > Sent from the gambas-devel mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel From gambas.fr at ...176... Fri Dec 16 11:35:57 2016 From: gambas.fr at ...176... (Fabien Bodard) Date: Fri, 16 Dec 2016 11:35:57 +0100 Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> Message-ID: Maybe you can share your code so we can drive you in the good way. And say us what is your goal. 2016-12-16 9:28 GMT+01:00 Moviga Technologies : > You can draw the image in the DrawingArea, and then draw on top of it. > > > Den 16. des. 2016 00:46, skrev RichardB: >> I?m trying to develop an app in Gambas v3.9.1 that uses a transparent >> DrawingArea layered over a PictureBox ? the intention is to load a picture >> into the PictureBox and mark points (or lines) on the DrawingArea for >> measurement. I?m a newbie to Gambas ? does anyone have any advice on how to >> get this to work? Or is there a better way to do this? >> >> >> >> -- >> View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023.html >> Sent from the gambas-devel mailing list archive at Nabble.com. >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Fabien Bodard From deep_sky at ...761... Mon Dec 19 22:24:50 2016 From: deep_sky at ...761... (RichardB) Date: Mon, 19 Dec 2016 14:24:50 -0700 (MST) Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> Message-ID: <1482182690315-58033.post@...752...> Thanks for the advice - much appreciated. But I'm still having problems. I tried a simple test by creating a form with just a single button (btnImage) and a DrawingArea (dwgImage) on it. I added the following code to the button's click function: Public Sub btnImage_Click() Dim hImage As Image Dialog.Path = "/ home / gambas / projects / images" Dialog.Filter = ["Image files (* .jpg; * .jpeg; * .png; * .bmp)", "All files (*. *)"] If Dialog.OpenFile() Then Return hImage = New Image hImage.Load(Dialog.Path) dwgImage.Resize(hImage.Width, hImage.Height) dwgImage.Clear() Draw.Begin(dwgImage) Draw.Fillcolor = Color.Gray Draw.FillStyle = Fill.Solid Draw.Rect(0, 0, hImage.Width, hImage.Height) Draw.Image(hImage, 0, 0) Draw.End dwgImage.Visible = True Catch Message.Warning(Error.Text & "!") End When run, the dialog opens fine, I select the image ok...but it fails on the "Draw.Begin(dwgImage) " line, with the error "Cannot paint outside of draw event handler". I can't see where I've made an error. Thanks again for your help. -- View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023p58033.html Sent from the gambas-devel mailing list archive at Nabble.com. From gambas.fr at ...176... Tue Dec 20 10:05:37 2016 From: gambas.fr at ...176... (Fabien Bodard) Date: Tue, 20 Dec 2016 10:05:37 +0100 Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: <1482182690315-58033.post@...752...> References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> <1482182690315-58033.post@...752...> Message-ID: You cant drawing in a DrawingArea outside the draw event. Gambas use ascynchronous drawing. (You can nevertheless set the cache mode to true) But prefer this : Private $hImage as Image Public Sub btnImage_Click() Dialog.Path = "/ home / gambas / projects / images" Dialog.Filter = ["Image files (* .jpg; * .jpeg; * .png; * .bmp)", "All files (*. *)"] If Dialog.OpenFile() Then Return $hImage = New Image $hImage.Load(Dialog.Path) dwgImage.Resize(hImage.Width, hImage.Height) dwgImage.Refresh Catch Message.Warning(Error.Text & "!") End Public Sub dwgImage_Draw() Draw.Fillcolor = Color.Gray Draw.FillStyle = Fill.Solid Draw.Rect(0, 0, $hImage.Width, $hImage.Height) Draw.Image($hImage, 0, 0) Draw.End End Nota: The Draw Class is Deprecated, prefer the use of the Paint Class for drawing. Paint is vector based and is far more powerfull. (and the current Draw class is based on the paint one) The _Draw Sub with the _Data sub of the grid view is one of the fabulous things of gambas. But it take a little bit of cerebral training, because thinking in term of separate Data / Viewer is not natural. But so powerfull. 2016-12-19 22:24 GMT+01:00 RichardB : > Thanks for the advice - much appreciated. But I'm still having problems. > > I tried a simple test by creating a form with just a single button > (btnImage) and a DrawingArea (dwgImage) on it. I added the following code > to the button's click function: > > Public Sub btnImage_Click() > Dim hImage As Image > Dialog.Path = "/ home / gambas / projects / images" > Dialog.Filter = ["Image files (* .jpg; * .jpeg; * .png; * .bmp)", "All > files (*. *)"] > If Dialog.OpenFile() Then Return > hImage = New Image > hImage.Load(Dialog.Path) > dwgImage.Resize(hImage.Width, hImage.Height) > dwgImage.Clear() > Draw.Begin(dwgImage) > Draw.Fillcolor = Color.Gray > Draw.FillStyle = Fill.Solid > Draw.Rect(0, 0, hImage.Width, hImage.Height) > Draw.Image(hImage, 0, 0) > Draw.End > dwgImage.Visible = True > Catch > Message.Warning(Error.Text & "!") > End > > When run, the dialog opens fine, I select the image ok...but it fails on the > "Draw.Begin(dwgImage) " line, with the error "Cannot paint outside of draw > event handler". I can't see where I've made an error. > > Thanks again for your help. > > > > -- > View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023p58033.html > Sent from the gambas-devel mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today.http://sdm.link/intel > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Fabien Bodard From deep_sky at ...761... Wed Dec 21 03:08:27 2016 From: deep_sky at ...761... (RichardB) Date: Tue, 20 Dec 2016 19:08:27 -0700 (MST) Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> <1482182690315-58033.post@...752...> Message-ID: <1482286107233-58052.post@...752...> Hi Fabien: Thanks for your advice. Still having problems. I've changed my code to what you gave me: Private $hImage As Image Public Sub btnImage_Click() Dialog.Path = "/ home / gambas / projects / images" Dialog.Filter = ["Image files (* .jpg; * .jpeg; * .png; * .bmp)", "All files( * . * )"] If Dialog.OpenFile() Then Return $hImage = New Image $hImage.Load(Dialog.Path) dwgImage.Resize($hImage.Width, $hImage.Height) dwgImage.Refresh Catch Message.Warning(Error.Text & "!") End Public Sub dwgImage_Draw() Draw.Begin(dwgImage) Draw.Fillcolor = Color.Gray Draw.FillStyle = Fill.Solid Draw.Rect(0, 0, $hImage.Width, $hImage.Height) Draw.Image($hImage, 0, 0) Draw.End End Public Sub btnDraw_Click() dwgImage_Draw End Running the code will allow me to open the dialog and select a jpg. Stopping the code after executing the "$hImage.Load(Dialog.Path)" line shows me that the value of Pixels for $hImage is "Out of bounds" and that the height and width are both 0, so something is causing the image load to fail. The Dialog.Path is correct, showing the correct path and filename. The Cached property for dwgImage is True. What am I missing? -- View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023p58052.html Sent from the gambas-devel mailing list archive at Nabble.com. From gambas.fr at ...176... Thu Dec 22 10:33:15 2016 From: gambas.fr at ...176... (Fabien Bodard) Date: Thu, 22 Dec 2016 10:33:15 +0100 Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: <1482286107233-58052.post@...752...> References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> <1482182690315-58033.post@...752...> <1482286107233-58052.post@...752...> Message-ID: Ok Richard this is a working exemple just for you. Fill free to query us about all you want. -------------- next part -------------- A non-text attachment was scrubbed... Name: DemoToRiChardB-0.0.1.tar.gz Type: application/x-gzip Size: 12253 bytes Desc: not available URL: From deep_sky at ...761... Thu Dec 22 21:14:37 2016 From: deep_sky at ...761... (RichardB) Date: Thu, 22 Dec 2016 13:14:37 -0700 (MST) Subject: [Gambas-devel] Transparent DrawingArea In-Reply-To: References: <1481845577367-58023.post@...752...> <91f31c8a-1efa-7839-2f03-de4815919adf@...758...> <1482182690315-58033.post@...752...> <1482286107233-58052.post@...752...> Message-ID: <1482437677338-58056.post@...752...> Thanks Fabien! That's precisely what I was looking for. -- View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023p58056.html Sent from the gambas-devel mailing list archive at Nabble.com.