Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
46 user(s) are online (30 user(s) are browsing Forums)

Members: 0
Guests: 46

more...

Support us!

Headlines

 
  Register To Post  

CompositeTags
Home away from home
Home away from home


See User information
CompositeTags(COMPOSITE_Src_Over_Dest,  clock_bm
            
,win->RPort -> BitMap
        
,COMPTAG_DestX,0
        
,COMPTAG_DestY,0
        
,TAG_DONE);


This code renders out side my window, on top of screen, how to fix it?

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: CompositeTags
Not too shy to talk
Not too shy to talk


See User information
If you want clipping you need to blit into a RastPort and not into a bitmap. I don't have the autodocs for CompositeTags here in front of me. If it does not allow to specify a RastPort as destination, then it is not meant to be used to blit into a window.

You could fake it by using

COMPTAG_DestX,win->LeftEdge + win->BorderLeft,
COMPTAG_DestY,win->TopEdge + win->BorderTop,

but this only works if your window is the frontmost one, i.e. not covered by parts of other windows.


Edit: now I read the autodocs and as it seems there is no way to specify a RastPort as destination for CompositeTags.

So if you don't need alpha blending, you should use BltBitMapRastPort instead.

If you need alpha blending, you have to
- allocate a new bitmap with BMF_DISPLAYABLE set and the window's bitmap as friend
- copy the area of the window you want to manipulate into the new bitmap using ClipBlit()
- use CompositeTags() with the new bitmap as destination
- copy the new bitmap back into the window using BltBitMapRastPort() or ClipBlit().

Perhaps using a window with WA_SuperBitMap would make things a bit easier.


Edited by thomas on 2012/10/26 7:52:22
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
@LiveForIt
I checked what my code does when I don't use a buffer: I make a BMF_DISPLAYABLE friend-bitmap clone of the window's bitmap (effectively a temporary buffer) but only for the area I want to update, then I use CompositeTagList() or BltMaskBitMapRastPort() as appropriate, then I use ClipBlit() to update the window with the modified bitmap.

This should be *relatively* fast since all blits are between bitmaps that are stored in video memory.

@thomas Quote:
- copy the new bitmap back into the window using BltBitMapRastPort() or ClipBlit().

It would be a very BAD idea to use BltBitMapRastPort() to write directly to the window, because on non-composited windows this will overwrite any windows above the window you are modifying.

But yes, there doesn't appear to be any legal way of doing an alpha (or masked!) blit directly into a window.

Author of the PortablE programming language.
Go to top
Re: CompositeTags
Amigans Defender
Amigans Defender


See User information
Er, is everybody missing BltBitMapTags() which is perfectly able to to alpha blits (in fact, it was the only way in 4.0).

Quote:

It would be a very BAD idea to use BltBitMapRastPort() to write directly to the window, because on non-composited windows this will overwrite any windows above the window you are modifying.


This is also wrong, as the rastport will do clipping for you, so as long as you blit to the window's rastport what you blit will only end up in that window.

Actually I didn't know there was a ClipBlit function, and it looks identical to BltBitMapRastPort to me.

Go to top
Re: CompositeTags
Not too shy to talk
Not too shy to talk


See User information
Quote:

Chris wrote:
Actually I didn't know there was a ClipBlit function, and it looks identical to BltBitMapRastPort to me.


ClipBlit is the only function which accepts a RastPort as *source*. If you want to blit *from* a window to somewhere else, you need to use it.


Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
@Chris Quote:
is everybody missing BltBitMapTags() which is perfectly able to to alpha blits

My SDK documentation says nothing about alpha blitting for that function. As far as I can see, it is not better/worse than for OS3.x.

Quote:
This is also wrong, as the rastport will do clipping for you, so as long as you blit to the window's rastport what you blit will only end up in that window.

All I can say is that (I believe) I was using BltBitMapRastPort() into my window's rasterport, and I discovered it was overwriting overlapping windows when Compositing was disabled. I was advised to use ClipBlit() to solve my problem (which it did).

Here is what the SDK says about ClipBlit():
Quote:
Performs the same function as BltBitMap(), except that it
takes into account the Layers and ClipRects of the layer library,
all of which are (and should be) transparent to you. So, whereas
BltBitMap() requires pointers to BitMaps, ClipBlit requires pointers
to the RastPorts that contain the Bitmaps, Layers, etcetera.

If you are going to blit blocks of data around via the RastPort of
your Intuition Window, you must call this routine (rather than
BltBitMap()).


So basically, BltBitMap() (and I think probably BltBitMapRastPort() also) do a single blit without taking account of overlapping windows being emulated by Intuition. You need to use ClipBlit() to ensure that works.

Author of the PortablE programming language.
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
@ChrisH
Quote:
@Chris Quote:
Quote:

is everybody missing BltBitMapTags() which is perfectly able to to alpha blits

My SDK documentation says nothing about alpha blitting for that function. As far as I can see, it is not better/worse than for OS3.x.


Have you been to the optician lately? From my oldest copy of the SDK (so that's older than 53.15 but I'm not sure how much older as files were copied from my AOne and lost their filestamps)

NAME
       BltBitMapTagList 
-- Blit from any source to any destination (V51).

Note the 51 there, BltBitmapTags never existed for 3.x. I'm not sure when it was introduced exactly but I updated AWeb to use it sometime during the prerelease era IIRC

BLITA_SrcTypeBLITA_DestType (int32) - specifies the type of the
        source 
(BLITA_Source) and destination (BLITA_Dest). The following
        types are supported
:
        
BLITT_BITMAP (default) - a simple bitmap (struct BitMap *).
        
BLITT_RASTPORT a rastport (struct RastPort *).
        
BLITT_TEMPLATE a monochrome template (PLANEPTR), see BltTemplate()
         for 
more informationOnly supported by BLITA_SrcType.
        
BLITT_ALPHATEMPLATE an 8bit alpha templatemust be as large
         
as the source bitmap (APTR). Only supported by BLITA_SrcType.
        
BLITT_CHUNKY an 8bit chunky buffer (APTR)
        
BLITT_RGB24 24bit RGB buffer (APTR).
        
BLITT_ARGB32 32bit ARGB buffer (APTR).

---
snip---

       
BLITA_AlphaMask (APTR) - the alpha mask to applydefaults to
        NULL
Source bitmap and mask must have the same dimension.

       
BLITA_UseSrcAlpha (BOOL) - use alpha data stored in the source
        object 
for transparent blits, default is FALSEBLITA_UseSrcAlpha,
        
BLITA_UseDstAlpha (see below) and BLITA_AlphaMask are mutually-
        
exclusive.

       
BLITA_UseDstAlpha (BOOL) - use alpha data stored in the destination
        object 
for transparent blits, default is FALSEBLITA_UseSrcAlpha,
        
BLITA_UseDstAlphaBLITA_AlphaMask are mutually-exclusive.



Go to top
Re: CompositeTags
Amigans Defender
Amigans Defender


See User information
Quote:
All I can say is that (I believe) I was using BltBitMapRastPort() into my window's rasterport, and I discovered it was overwriting overlapping windows when Compositing was disabled. I was advised to use ClipBlit() to solve my problem (which it did).


All I can say is "weird". I have never seen this problem, and I always draw to windows through RastPorts, using various graphics.library functions. I rarely draw direct to BitMaps (and *never* to window or screen BitMaps)

Quote:

So basically, BltBitMap() (and I think probably BltBitMapRastPort() also) do a single blit without taking account of overlapping windows being emulated by Intuition. You need to use ClipBlit() to ensure that works.


BltBitMapRastPort will always take clipping into account, as will any function that draws through a RastPort, rather than direct to a BitMap.

The difference, as Thomas states, is that source is also a RastPort for ClipBlit.

BltBitMap however, will overwrite anything it likes.

Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
@broadblues Quote:
Have you been to the optician lately?

I had another look, and it appears that SDK Browser (v1.6) is showing the BltBitMap() stuff when I click on BltBitMapTags(), hence why there was nothing about alpha stuff.

This is a nice discovery, because it means I could add accelerated (alpha) blitting to my graphics engine for AmigaOS4.0.

@chris
What is the benefit for BltBitMapRastPort() over ClipBlit() then? The autodocs don't make this clear. (I can try replacing ClipBlit() with BltBitMapRastPort(), if there is an advantage in doing so.)

Author of the PortablE programming language.
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
Quote:

What is the benefit for BltBitMapRastPort() over ClipBlit() then? The autodocs don't make this clear. (I can try replacing ClipBlit() with BltBitMapRastPort(), if there is an advantage in doing so.


BlitBitmapRastPort blits from a Bitmap to a Rastport

ClipBlit blits from a Rastport to a Rastport.

I'm not sure but I think that ClipBlit takes the cliping in *both* rastports into account.


Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
Thanks for great comments.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
I noticed that CMPTAG_DestX some how affect COMTAG_SrcX, is that correct behavior?

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
@LiveForIt
The following might help you:
http://cairographics.org/operators/

There was another better guide to Duff Porter stuff, but I can't find it.

Author of the PortablE programming language.
Go to top
Re: CompositeTags
Home away from home
Home away from home


See User information
I don’t want to add alien API, because of dependencies.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: CompositeTags
Not too shy to talk
Not too shy to talk


See User information
>cairo operators ...I don’t want to add alien API
No no ChrisH was meaning "here there is some docs about the alpha operators used in CompositeTags (same as Cairo)"

See also here for operators
http://www.amiga-ng.org/prntopic.php? ... &topic=1286&post_id=17251

Alain Thellier

Go to top

  Register To Post

 




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




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project