Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / copy bitmap bug?

Author
Message
RFrijhoff
2
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 28th Mar 2014 11:53
When copying a loaded bitmap into another, something weird happens. When the size of the bitmap is 482x790 and you perform a copy bitmap where the size of the source image is greater then the destination image copy bitmap works as it should be. However when the size is e.g. the same, the screen remains blank.

Working Code:

OffscreenBitmapNumber=999
BitmapNumber=0

set window size 1280,960

load bitmap "Puzzles\anza.jpg",OffscreenBitmapNumber
if bitmap exists(OffscreenBitmapNumber)=1
copy bitmap OffscreenBitmapNumber,0,0,482,790,BitmapNumber,0,0,241,385
endif
set current bitmap BitmapNumber
wait key

Non-working code:
Only 1 line changed:
copy bitmap OffscreenBitmapNumber,0,0,482,790,BitmapNumber,0,0,482,790

Also when using the working line, the image displayed in the window is relatively sized to the window and not the size given in the command. Resulting in a larger or smaller image then it should be. Which probably is the cause of the forementioned problem.

System Specs:
Windows 7 64-bit sp1
Intel I5-3470 Quad core 3.2 GHz
16 Gb intern
MSI NVidia GT630 4GB driver:311.06
DB update level: 7.62

Attachments

Login to view attachments
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 30th Mar 2014 13:54
Interesting bug report.

I've just done some tests and I'm fairly sure the problem is connected in some non obvious way with the window resolution used in your project settings.

I could reproduce your black screen whenever I used values where at least one dimension was larger than the window resolution set in the project.

For example, my default project setting is 640x480. Your code "works" (i.e. no black screen) if I use values such as

+ Code Snippet

but I get the black screen as soon as I change that to

+ Code Snippet

What seems to be happening is that your window is being interpreted as a bitmap with dimensions corresponding to your project settings - but the actual size on screen is measured in pixels relating to the desktop resolution. So, using my default settings with a window resolution of 640x480 the copy bitmap command seems to treat your 1280x960 sized window as a bitmap with size 640x480 and scales accordingly. Hence the following rescales the original 482x790 image to fill the window:

+ Code Snippet

If I use the following instead I get a small black border on the right hand side and along the bottom:

+ Code Snippet

Hope this makes sense.

This is probably not a bug - more likely just the way the commands work.

If I change the project window resolution to something else, say 1600x900, then the problems occur when the target bitmap width or height resolutions exceed 1600 or 900 respectively.



Powered by Free Banners
RFrijhoff
2
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 1st Apr 2014 13:40 Edited at: 1st Apr 2014 15:58
You say that you could reproduce the problem when one dimension was larger than the window resolution set in the project. However, as you can see in my code, both horizontal as well as vertical size of both source and destination bitmap (482,792) are smaller then the window resolution (1280,960) so neither of the bitmaps are (physically) larger then the window resolution, still I got a blank screen.
It's probably because the virtual (by lack of a better description for it) size is bigger than the windows resolution after the copy.

I tried another picture e.g. with the size 125x83
+ Code Snippet

Although the destination bitmap is now twice as big as the source bitmap (physically), it still works, because the picture still isn't scaled bigger (virtually) then the window resolution, while the physical dimensions are still smaller then the window resolution.
I tried to find any correlation, but no luck so far.

Unless I did misread your comment.

If this is really the way how the copy bitmap works, it is not how you expect it to work. I mean, if you have 2 identical buckets and one has water in it and when you pour the water into the other bucket, it's not logical to expect the water to expand causing the other bucket to overflow. Which basically happens here.

Update:
The problem seems to be caused by the load bitmap function and not the copy bitmap. When performing the following code:
+ Code Snippet
The same problem occurs: black screen. Somehow the load bitmap function resizes the bitmap during loading, because the physical bitmap on disk is smaller then the window resolution and should therefore be displayed without any problems.

Attachments

Login to view attachments
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 1st Apr 2014 16:01 Edited at: 1st Apr 2014 16:02
Quote: "smaller then the window resolution (1280,960)"


No, you've misunderstood. That is the window size not the window resolution. Read my post again.

Quote: "Unless I did misread your comment."


Yes, you have.

The window resolution is set using the set display mode command - or the project setting.

Just change the window resolution in the project settings to a suitable value and you'll see what I mean. See picture below:





Powered by Free Banners

Attachments

Login to view attachments
RFrijhoff
2
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 2nd Apr 2014 11:12
My apologies for the misunderstanding, but the fact remains that even after setting the window resolution to the correct size, the problem still exists.[img]G:\Development\Dark Basic\Settings.png[/img]
Even more the problem partially also occurs with the load image/sprite function. In that case, the image is displayed instead of a black screen, but still in the wrong size.
+ Code Snippet

I also tried different settings for the screen type, but no effect.
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 2nd Apr 2014 17:54
Quote: "but the fact remains that even after setting the window resolution to the correct size, the problem still exists."


What "correct size" did you use? And, yes, you'll still have the problem - but with different image sizes as I mentioned before.

You need to scale your image to fit the right bit of the window area. Your sprite code works perfectly here. What screen resolution and window sizes are you using?

I can't see your screen shot because you haven't uploaded it from your computer. Include the image as an attachment.



Powered by Free Banners
RFrijhoff
2
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 3rd Apr 2014 11:54
Sorry, something went wrong. Attachment should now be available. Screen resolution on pc is 1920x1080, in the project settings it's set to 1280x960, window size in the code is set to 1280x960, bitmap sizes (source and destination) are both 482x790. I already tried project settings 1920x1080 and window size 1920x1080. Still no dice.

+ Code Snippet
with my desktop resolution set to 1920x1080 and the project window resolution also to 1920x1080 (although it doesn't really matter as it happens with every setting). The image size used is 482x790 (for the image: see my first post).

Attachments

Login to view attachments
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 3rd Apr 2014 13:27 Edited at: 3rd Apr 2014 13:28
Puzzling.

The attached image is what I see when I use the following settings:

Screen Type: window
Window Resolution: 1600x900

As you can see, the image fits in neatly as it should (the image is 482x790 like yours).

The settings you show in your screenshot are the Default settings - but what are you using for that particular project? Look at the Properties tab as I showed in my earlier screenshot. What shows there?

[Edit: forgot to add screenshot Should be here now.]



Powered by Free Banners

Attachments

Login to view attachments
RFrijhoff
2
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 4th Apr 2014 14:36
When you mentioned that the screenshot was of the default settings, I was. So I searched for about 5 minutes on my screen to see that somewhere at the bottom there where some tabs with icons. So I tried these and yes there was a properties tab. Changed the setting to 1280x960, and now it works correct indeed. However, there is no mention at all in the help file about the tabs, Also at start, the tabs are really small, so only an icon and one letter was displayed. So there is no way I could know about this at the start.

Thank you very much for your patience and explanations. Seems there is no problem after all (except for the missing information in the help file).
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 5th Apr 2014 15:43
Quote: "Seems there is no problem after all (except for the missing information in the help file)."


I agree with that completely.

Glad you got it sorted.

Yes, I'm so used to using those various tabs that I forget they might not be obvious to newcomers.

I hope you have fun with DBPro - many of us have had years of productive coding fun out of it and there's usually someone around who can clear up the occasional obscurity.

Also, as you suggest, the "Getting Started" part of the Help file looks completely out of date to me. Not very helpful.

I'm so used to opening up new software and browsing all the buttons and tabs before actually doing anything I tend not to look at the Help file except as a last resort. In fact having just looked at the "Getting Started" section I don't recall ever having looked at it closely before.



Powered by Free Banners

Login to post a reply

Server time is: 2017-03-23 04:16:23
Your offset time is: 2017-03-23 04:16:23