English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 22 December 2018, 03:02   #1
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Blitz- cannot blit a shape

Hi,
Where do I have a mistake in the following code?
At the end, there is a BLIT command which shows nothing.... but... When I replace it with BLOCK everything works.

Code:
BLITZ
BlitzKeys On
InitCopList 0,$0014
CreateDisplay 0

BitMap 0,320,256,4
DisplayBitMap 0,0

InitShape 0,32,16,4
ShapesBitMap 0,1
BitMapOutput 1
Locate 0,0
Print "test" 
Free BitMap 1

Use BitMap 0

While Joyb(0)=0
 If RawStatus($45) Then Goto finito
 If RawStatus($50) Then Blit 0,0,0 ;BLOCK works here
Wend

finito:
End
peceha is offline  
Old 22 December 2018, 04:29   #2
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
I believe you have to add a displaybitmap command inside your while loop to see the result of the blit on the.bitmap
Shatterhand is offline  
Old 22 December 2018, 09:50   #3
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Quote:
Originally Posted by Shatterhand View Post
I believe you have to add a displaybitmap command inside your while loop to see the result of the blit on the.bitmap
Hi,
Just added DisplayBitMap after Blit but it did not change anything. Still Block command seems to work but Blit doesnt.
There is one more thing, if I get and use a shape with GetaShape command (from pre-made graphics) then Blit works fine
peceha is offline  
Old 22 December 2018, 10:54   #4
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
I've never had initshape / shapebitmap working. It works the other way around - draw to a bitmap and get the shape.
E-Penguin is offline  
Old 22 December 2018, 11:57   #5
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Looks like a good idea.
Thanks
peceha is offline  
Old 29 March 2021, 19:52   #6
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Quote:
Originally Posted by E-Penguin View Post
I've never had initshape / shapebitmap working. It works the other way around - draw to a bitmap and get the shape.
Well, it's been long time since that post but I think it is worth mentioning.

Looks like quite accidentally I found the way to make ShapesBitMap work.

The wrong way:
Code:
BitMap 1,16,16,4
GetaShape 1,0,0,15,15
Free BitMap 1

ShapesBitMap 1,1
Use Bitmap 1
Boxf 0,0,15,15,5            ;<-- this will never show up on shape 1
Free Bitmap 1
correct way:
Code:
BitMap 1,16,16,4
Boxf 0,0,15,15,7            ;<--- this line is required, that's all
GetaShape 1,0,0,15,15       ;the new shape cannot be transparrent
Free BitMap 1               ;for ShapesBitMap to work

ShapesBitMap 1,1
Use Bitmap 1
Boxf 0,0,15,15,5
Free Bitmap 1
peceha is offline  
Old 29 March 2021, 22:13   #7
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Totally missed this thread back in the day, but it's probably that your shape doesn't have a cookie associated with it, meaning when you blit it, it's transparent. Drawing the box forces it because it's not transparent from the start, but try adding
Code:
MakeCookie 1
(where 1 is the shape number) after you draw to the blank shape, and it should blit just fine, even with transparent areas.
Daedalus is offline  
Old 30 March 2021, 08:57   #8
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Ha,
you are right!
MakeCookie is the way to go.
peceha is offline  
Old 10 April 2021, 23:56   #9
Nightshft
Registered User
 
Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Posts: 615
Related to this:

Can you blit shapes opaque (so colour 0 gets written to target and is not transparent) without using "block"?

What I tried:
When you turn Autocookie off before GetAShape, so the shape is without cookie and blit the shape normally, you wont see anything. I expected the blit to be full-size and opaque without cookie, but seems that in that case it doesnt blit anything. (Which matches your post #7 Daedalus).

Changing blitmode to solidMode didnt help either. All the pixels contained in the cookie received the highest colour (all the bitplanes get switched to 1). Is this intended behaviour or do I miss something?

It works with block but is there a way using a normal blit command?
Nightshft 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
How to calculate possible blit times? Tigerskunk Coders. Asm / Hardware 32 11 January 2022 08:24
[Found: Numerix] Obscure PD Shape Fitting Game manic23 Looking for a game name ? 19 30 March 2019 18:16
Blitting part of a shape? earok Coders. Blitz Basic 3 01 December 2017 03:45
How do you get the Handle of an existing Shape? earok Coders. Blitz Basic 1 22 April 2017 11:00
Can amiblitz (blitz basic2) blit an image per bitplane? Michael Parent Coders. General 7 29 October 2009 17:59

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 16:14.

Top

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