M msains Member Licensed User Longtime User Oct 18, 2019 #1 Calling BitMapCreator Experts. I have a GrayScale Bitmap (see picture) of dimensions 199 x 262. I would like to (programmatically) put a border around it and save it (again) as a .bmp The border I put around it must cause the final combined bmp to ... a) have dimensions of Exactly 512 x 512 b) The border must be filled with pixels that copy the original bmp's pixel(0, 0) I guess another way of saying this is that I would like to place the original bmp more or less in the centre of a new 512 x 512 bmp whose background is made up of pixels like the original's Pixel(0, 0) For (arithmetical) simplicity let's say the borders dimensions would be (in pixels) Top & Bottom Borders = 512 x 125, Left Border = 157 x 512, Right Border = 156 x 512 I'm really impressed by the BitMapCreator lib but just can't get into it that easily. A bit of practical help (like the above) might help to get started into it more quickly. Is this something that BitMapCreator can do (like - in its sleep) with only a few lines of code ? Attachments BabiesKitty_gs.jpg 21.4 KB · Views: 760
Calling BitMapCreator Experts. I have a GrayScale Bitmap (see picture) of dimensions 199 x 262. I would like to (programmatically) put a border around it and save it (again) as a .bmp The border I put around it must cause the final combined bmp to ... a) have dimensions of Exactly 512 x 512 b) The border must be filled with pixels that copy the original bmp's pixel(0, 0) I guess another way of saying this is that I would like to place the original bmp more or less in the centre of a new 512 x 512 bmp whose background is made up of pixels like the original's Pixel(0, 0) For (arithmetical) simplicity let's say the borders dimensions would be (in pixels) Top & Bottom Borders = 512 x 125, Left Border = 157 x 512, Right Border = 156 x 512 I'm really impressed by the BitMapCreator lib but just can't get into it that easily. A bit of practical help (like the above) might help to get started into it more quickly. Is this something that BitMapCreator can do (like - in its sleep) with only a few lines of code ?
Sagenut Expert Licensed User Longtime User Oct 18, 2019 #2 I did not understood exactly what the Background should be. This example does not use BitmapCreator but could give You and idea to make what You wish. Attachments Bitmap Border.zip Bitmap Border.zip 30.9 KB · Views: 602 Upvote 0
I did not understood exactly what the Background should be. This example does not use BitmapCreator but could give You and idea to make what You wish.
E emexes Expert Licensed User Longtime User Oct 18, 2019 #3 msains said: The border I put around it must cause the final combined bmp to ... a) have dimensions of Exactly 512 x 512 Click to expand... Depending on what you then do with the bordered image, another way might be: - create a Panel that is 512 x 512 pixels - add an ImageView to the panel, so that its position coordinates are relative to the panel - load the .bmp to the ImageView - set the Panel to be solid color of the (0, 0) pixel of the ImageView - center horizontally with ImageView.Left = (Panel.Width - ImageView.Width) / 2 - center vertically likewise You can then move the Panel around the screen as required. Some panels have a SnapShot method that will return the image with the border. Upvote 0
msains said: The border I put around it must cause the final combined bmp to ... a) have dimensions of Exactly 512 x 512 Click to expand... Depending on what you then do with the bordered image, another way might be: - create a Panel that is 512 x 512 pixels - add an ImageView to the panel, so that its position coordinates are relative to the panel - load the .bmp to the ImageView - set the Panel to be solid color of the (0, 0) pixel of the ImageView - center horizontally with ImageView.Left = (Panel.Width - ImageView.Width) / 2 - center vertically likewise You can then move the Panel around the screen as required. Some panels have a SnapShot method that will return the image with the border.
M msains Member Licensed User Longtime User Oct 18, 2019 #4 Thanking you guys profusely .... however I'm holding out for a BitMapCreator answer (if it is even appropriate of course) Upvote 0
Thanking you guys profusely .... however I'm holding out for a BitMapCreator answer (if it is even appropriate of course)
E emexes Expert Licensed User Longtime User Oct 18, 2019 #5 msains said: however I'm holding out for a BitMapCreator answer Click to expand... No worries I know my post didn't meet your opening criteria, but I figured I'd pop out a different way of doing it anyway because: 1/ always good to have a backup plan 2/ usually good to see things from alternative perspective Upvote 0
msains said: however I'm holding out for a BitMapCreator answer Click to expand... No worries I know my post didn't meet your opening criteria, but I figured I'd pop out a different way of doing it anyway because: 1/ always good to have a backup plan 2/ usually good to see things from alternative perspective
klaus Expert Licensed User Longtime User Oct 18, 2019 #6 Here you are, with BitmapCreator: Attachments CreateBitmap.zip CreateBitmap.zip 30.6 KB · Views: 594 Upvote 0
M msains Member Licensed User Longtime User Oct 18, 2019 #7 emexes said: No worries I know my post didn't meet your opening criteria, but I figured I'd pop out a different way of doing it anyway because: 1/ always good to have a backup plan 2/ usually good to see things from alternative perspective Click to expand... Thanks emexes, couldn't agree more ! A very nice solution that worked well. Awesome community of developers here - including yourself and SageNut. Upvote 0
emexes said: No worries I know my post didn't meet your opening criteria, but I figured I'd pop out a different way of doing it anyway because: 1/ always good to have a backup plan 2/ usually good to see things from alternative perspective Click to expand... Thanks emexes, couldn't agree more ! A very nice solution that worked well. Awesome community of developers here - including yourself and SageNut.
M msains Member Licensed User Longtime User Oct 18, 2019 #8 klaus said: Here you are, with BitmapCreator: View attachment 84773 Click to expand... Thank you Klaus. Very elegant and works great. I was experimenting in BMC with 'brushes' and not really getting anywhere. This is much simpler and I can work up to using 'brushes' later. I also appreciate all the comments in your code. You must be a teacher or lecturer because the explanations are brief but very instructive. Thanks again. Upvote 0
klaus said: Here you are, with BitmapCreator: View attachment 84773 Click to expand... Thank you Klaus. Very elegant and works great. I was experimenting in BMC with 'brushes' and not really getting anywhere. This is much simpler and I can work up to using 'brushes' later. I also appreciate all the comments in your code. You must be a teacher or lecturer because the explanations are brief but very instructive. Thanks again.
klaus Expert Licensed User Longtime User Oct 18, 2019 #9 Did you have a look at the B4X Graphics Booklet? It has a chapter BitmapCreator. Upvote 0
M msains Member Licensed User Longtime User Oct 18, 2019 #10 klaus said: Did you have a look at the B4X Graphics Booklet? It has a chapter BitmapCreator. Click to expand... No - I wish I had known there was a booklet. Probably my fault for not finding it - but It would possibly have given me the solid start on BMC that I needed. Once again the value of this great community is shown. Thanks again. Upvote 0
klaus said: Did you have a look at the B4X Graphics Booklet? It has a chapter BitmapCreator. Click to expand... No - I wish I had known there was a booklet. Probably my fault for not finding it - but It would possibly have given me the solid start on BMC that I needed. Once again the value of this great community is shown. Thanks again.