English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 11 September 2015, 10:38   #1
dalton
tulou
 
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
Prevent intuition/OpenScreen from clearing custom bitmap?

Hi,

I have some troubles creating a screen from a picture I have prepared beforehand in chip ram.

It seems to me that OpenScreen actually clears the bitmap. I'm aware of the SCREENQUIET flag which prevents drawing of the title bar. But is there anyway to prevent clearing of the bitmap?

Cheers
dalton is offline  
Old 11 September 2015, 12:53   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
If you have your bitmap structure set up and initialize a rastport for it, I think you can pass the rastport to openscreen on Kickstart version 2+.
Samurai_Crow is offline  
Old 11 September 2015, 14:10   #3
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
One of the fields in the BitMap or NewScreen structs are probably initialized wrong. Have you specified BMF_DISPLAYABLE in BitMap.Flags, and CUSTOMBITMAP in NewScreen.Type?

EDIT: for a 320*256 interleaved bitmap in 32 colors:
Code:
struct BitMap bmp = {
  .BytesPerRow = 200,
  .Rows = 256,
  .Depth = 5,
  .Planes[0] = Picture,
  .Planes[1] = Picture+40,
  .Planes[2] = Picture+80,
  .Planes[3] = Picture+120,
  .Planes[4] = Picture+160,
  .Flags = BMF_DISPLAYABLE|BMF_INTERLEAVED,
  .pad = 0
};

struct NewScreen newscr = {
  .LeftEdge = 0, .TopEdge = 0,
  .Width = 320, .Height = 256,
  .Depth = 5,
  .CustomBitMap = &bmp,
  .ViewModes = 0,
  .Type = CUSTOMSCREEN|CUSTOMBITMAP|SCREENQUIET,
  .DefaultTitle = NULL, .Font = NULL, .Gadgets = NULL
};
Leffmann is offline  
Old 11 September 2015, 18:51   #4
dalton
tulou
 
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
That's very similar to what I have. I'm trying to display a picture which is four bitplanes interleaved. Hires.

But just comes out black If I use AllocBitmap and copy my picture to that bitmap after opening the screen, it works.

Code:
	extern UBYTE picture[256][4][80];

	struct NewScreen new_screen =
	{
		.LeftEdge = 0,
		.TopEdge = 0,
		.Width = 640,
		.Height = 256,
		.Depth = 4,
		.DetailPen = DETAILPEN,
		.BlockPen = BLOCKPEN,
		.ViewModes = HIRES,
		.Type = CUSTOMSCREEN | CUSTOMBITMAP | SCREENQUIET,
		.Font = &(struct TextAttr)
		{
			.ta_Name = "topaz.font",
			.ta_YSize = 8,
			.ta_Style = 0,
			.ta_Flags = 0,
		},
		.DefaultTitle = "My screen", 
		.Gadgets = NULL,
		.CustomBitMap = &(struct BitMap)
		{
			.BytesPerRow = 80*4,
			.Rows = 256,
			.Flags = BMF_DISPLAYABLE | BMF_INTERLEAVED,
			.Depth = 4,
			.pad = 0,
			.Planes =
			{
				picture[0][0],
				picture[0][1],
				picture[0][2],
				picture[0][3],
			},
		},
	};

	struct Screen *screen = OpenScreen(&new_screen);
dalton is offline  
Old 11 September 2015, 19:05   #5
dalton
tulou
 
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
Gah, found the problem, sorry! I'm opening a window right after opening the screen (to capture key strokes). The window hides the picture.

Code:
	struct NewWindow new_window =
	{
		0, 10,			// LeftEdge, TopEdge
		640, 256-10,	// Width, Height
		1, 0,			// DetailPen, BlockPen
		/*IDCMP_MOUSEMOVE | IDCMP_DELTAMOVE | */IDCMP_VANILLAKEY,	// IDCMPFlags
		WFLG_SIMPLE_REFRESH /* | WFLG_BACKDROP | WFLG_REPORTMOUSE */ | WFLG_BORDERLESS
			| WFLG_ACTIVATE | WFLG_RMBTRAP | WFLG_NOCAREREFRESH,
		NULL,		// FirstGadget
		NULL,		// CheckMark
		NULL,		// Title
		screen,		// Screen
		NULL,		// BitMap
		0, 0,		// MinWidth, MinHeight
		0, 0,		// MaxWidth, MaxHeight
		CUSTOMSCREEN
	};
This raises the question: can I have a window without covering the screen?
dalton is offline  
Old 11 September 2015, 19:37   #6
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Quote:
Originally Posted by dalton View Post
This raises the question: can I have a window without covering the screen?
Did you tried to set window tag WA_CustomScreen ( NewWindow.Screen ) with your Screen ?
Mean you first open screen and then open window and above tag is set to proper valule.
Asman is offline  
Old 12 September 2015, 02:48   #7
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by dalton View Post
This raises the question: can I have a window without covering the screen?
Yes, the 2.0 Workbench where the window can be transformed from backdrop to resizable is an illustration of it if I recall correctly. This was not possible with the 1.3 Kickstart I believe.

However I cannot recall whether a windowless screen is capable of preserving the parts of its background which are covered by windows. I am under the impression that only windows which are flagged with
BITMAP<something>
(or
<something>BITMAP
) can survive being covered by other windows but I am not too sure screens are capable of similar feats.

I seem to recall reading that one explicitly had to use a backdrop borderless window with aforementioned
BITMAPstuff
flag in order to be able to preserve a screen's background. But if I were you i would not rely on such an unreliable source of information as my memory.

This said, I am 100% confident that this information is covered in the RKMs.

Update: I gave a quick look at the Graphics data structures and the corresponding Intuition ones (
Screen
notably) and I am fairly confident that screens bitmaps are not preserved when covered by overlapping windows. The
Bitmap
field of the
Screen
structure is a copy of the one held by the graphics.library's for the corresponding screen but there are no fields which could hold the overlapped contents.
If you want to preserve the background bitmap you need a backdrop borderless
SUPERBITMAP
window. (So,
<something> = SUPER
)

However, it is not clear whether the creation of that window will result in the erasing of your screen content. You will have to try.

Update2: You can create a 1x1 pixel window to work around potential clearing, but now that I am digging deeper in my memories of the system I kinda recall that it's possible to have a window without bitmap which is used only to intercept user input. Once again, please verify in the RKMs, I am really not certain of that one.

Last edited by ReadOnlyCat; 12 September 2015 at 03:13. Reason: Added update with more info. And second update. :)
ReadOnlyCat is offline  
Old 12 September 2015, 08:39   #8
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Quote:
Originally Posted by dalton View Post
Gah, found the problem, sorry! I'm opening a window right after opening the screen (to capture key strokes). The window hides the picture.

This raises the question: can I have a window without covering the screen?
In 2.0 and above you could set the WA_BackFill tag to LAYERS_NOBACKFILL, then the window will be transparent. But this does not work in 1.3.

Another possible way is to open the screen without a custom bitmap, put your image into the NewWindow.Bitmap field and set the WFLG_SUPER_BITMAP flag.

Or just open the screen, open the window and BltBitMapRastPort your image into the window.
thomas is offline  
Old 12 September 2015, 22:59   #9
dalton
tulou
 
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 88
Solved it now using the SUPER_BITMAP flag of the window. I create a bitmap struct for the window which is identical to that of the screen, but its pointers are set to row 11 of the picture rather than row 0. Then I set the window to begin at row 11 of the screen and cover the entire width down to the bottom of the screen.

So basically the window draws on top of the screen, but it uses the same data so there's no visible difference

Thanks for all your replies!
dalton is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard Blits under intuition & Gif To "struct BitMap" converter krabob Coders. Asm / Hardware 2 15 September 2014 17:25
Clearing the X-bit oRBIT Coders. Asm / Hardware 6 22 April 2012 02:52
Clearing out some spares on Amibay! fitzsteve MarketPlace 7 10 January 2012 16:59
Clearing A1200 + 500+ ericmark MarketPlace 11 27 May 2009 00:50
will a NTSC A520 prevent me... NfernalNfluence support.Hardware 0 08 September 2007 12:07

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.28769 seconds with 15 queries