Bixby Sayz Posted November 25, 2011 Share Posted November 25, 2011 Been messing around with various tutorials on forms/canvas. There are routines to get the canvas of a bitmap, manipulate bitmaps, write bitmaps to bitmaps, write bitmaps to canvas, but no? way to get an existing canvas into a bitmap where you can work with it? Looking to take the canvas of a form and get it into some shape/form where the various manipulation functions (which all expect a bitmap) will work. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 25, 2011 Share Posted November 25, 2011 Afaik you can't reshape a form without using a plugin or API calls in SCAR, I could be wrong though. You can use [wiki=SafeCopyCanvas]SafeCopyCanvas[/wiki] combined with [wiki=GetBitmapCanvas]GetBitmapCanvas[/wiki] to get/set the bitmap of a canvas. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 25, 2011 Author Share Posted November 25, 2011 I'm missing something here. - SafeCopyCanvas copies Canvas to Canvas. None of the bitmap routines will work with this. - GetBitmapCanvas returns the Canvas of a Bitmap. Again none of the bitmap routines will work with a Canvas. If you are starting with a Canvas (of a form, of a timage, of a whatever) how do you get it into a form where the routines that expect a bitmap will work. (All of the useful functions expect a bitmap not a canvas). I'm not trying to resize anything. There is a routine to copy a bitmap with transparency to another BITMAP. What I want to do is copy that bitmap with transparency to a canvas. Which is where I flipped it around and asked "If I have a canvas, is there a way to get/treat that as a bitmap so all those useful functions will work?" The answer seems to be no. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 25, 2011 Share Posted November 25, 2011 You have to draw your image onto a bitmap, then use GetBitmapCanvas and SafeCopyCanvas to copy the bitmap onto the form's canvas. However, it's far better to just drop a TImage onto your form and copying the bitmap directly to it with TBitmapFromBmp. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 25, 2011 Author Share Posted November 25, 2011 Was trying to avoid using a TImage, but that is the only thing that works. But that still doesn't answer the question if that TImage has some existing content I want to pull off to use elsewhere, what then? Puzzler for another day. I got what I needed for now. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 25, 2011 Share Posted November 25, 2011 Well, that's what I'm trying to explain, you can use SafeCopyCanvas to copy from or to a bitmap canvas. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 25, 2011 Author Share Posted November 25, 2011 from or to a bitmap canvas.That's the point: there is no bitmap! There is a way to take a bitmap and get a canvas. There is a way to copy/convert a bitmap to a canvas. There is a way to copy a canvas to a canvas. There is no way (that I am aware of) to take a canvas and get a bitmap. There are a lot of useful routines but they all require a bitmap. If your source is a canvas then you are screwed. If you try to substitute a bitmap for a canvas in the copy routine you mentioned you crash SCAR. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 25, 2011 Share Posted November 25, 2011 Why? You just create a bitmap and copy it on there? Bmp := BitmapFromString(w, h, ''); Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 25, 2011 Author Share Posted November 25, 2011 Yeah, I was being incredibly dense there. Gotta stop trying to script when overtired. Sorry Freddy. Quote Link to comment Share on other sites More sharing options...