New topic: Redacted Graphics in Threads
<http://forums.realsoftware.com/viewtopic.php?t=47321> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message SASS Post subject: Redacted Graphics in ThreadsPosted: Mon Mar 18, 2013 5:37 am Joined: Mon Dec 28, 2009 10:36 pm Posts: 3 I'm a novice, but I'm pretty good at adapting an example or code that someone else posts to fit what I'm programming. Trouble is, I don't always understand how it works. I've written a game with a feature that allows players to drop a photo on an image well, and then the program resizes it and gives it more of an artwork look by manipulating the color of each individual pixel. The problem comes with the redaction of graphics outside the paint routine of a canvas as I am using a thread to accomplish the color manipulation. Here is the thread: PosterPic.Run Sub Run() [assign values for variables w and h] OffscreenPicture=new Picture(w,h,32) for i =0 to w-1 for j = 0 to h-1 getcolor= AddPhotoWindow.photoCanvas.graphics.pixel(i,j)*** ConvertPixelColor Module1.ProcessRGB RestoreHexColor OffscreenPicture.Graphics.Pixel(i,j) = newcolor next next PosterCanvas.Graphics.DrawPicture OffscreenPicture,0,0*** End Sub [getcolor and newcolor are color properties of the thread] Here is the button routine that calls it: AddPhotoWindow.PosterizeBtn.Action Sub Action() DrawThread=new PosterPic DrawThread.PosterCanvas=PosterizationCanvas DrawThread.run End Sub *** indicates the lines that get flagged with redacted graphics commands. First, how can I get the pixel information and still use a thread? I know that I could dim getcolor as an array [getcolor(w,h)] and fill it from paint, but then wouldn't I lose the advantage of a thread? Second, as PosterCanvas is a canvas property of the thread and not a physical control on a window, how do I use paint? Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
