Padding Me On The Head
BlitzMax Forums/BlitzMax Beginners Area/Padding Me On The Head
| ||
As I'm working on rebuilding an image editor, I need to have the ability of loading an image that fits into a larger. Now I know I can load an image, say 512x512 pixels. Display that on the screen, then grab a larger portion, say 800x600 pixels from a say 1024x768 pixel screen. But now riddle me this ! How do I create a single image say 4096x4096 in size with the select image inserted at the top-left-hand corner of it, or it could even be in the bottom-right-hand corner ? You can't merely draw it on the screen and capture a larger portion because the maximum size of the screen itself is only 1024x768. Some other method must be done. How would you do it and with what code ? |
| ||
Hello. Try the TPixmap.Paste method: http://www.blitzbasic.com/Community/posts.php?topic=75531#843914 |
| ||
I needed to know this sub-command, "paste" not listed in standard graphics help. This opens up some interesting image storage possibilities for future coding. Nicely done, Kryzon ! |
| ||
Oh, wanted to add, this may not be possible. Is it possible to use PASTE and "tile" as a MASK, Kryzon ? That is, SourcePaint, SourceMask, SourceXOR, SourceAND SourceOR ? I know SetBlend does not affect a Pixmap. |
| ||
/"Padding"? |
| ||
You will have to do "tiling" on your own. Stretching will be a bit harder as you have to do it in software ... if you come up with something nice, please present it here - as this then allows for software "render to texture" (needed for animation effects of GUI elements - which often contain stretched images but also alpha-channels). bye Ron |
| ||
There is no functionality already written for combining pixmaps like that, as far as I know. Paste uses MemCpy internally, so it just replaces pixels in one pixmap with those of another. But the pixels are there, nothing stops someone from writing an extended version of Paste that uses a mask or some specific way of combining parts of the pixmaps. |