[amirus] Re: [amirus] прозрачность

  • From: Алексей Владимирович Иванов <mail@xxxxxxx>
  • To: amirus@xxxxxxxxxxxxx
  • Date: Tue, 6 Jan 2009 10:36:20 +0300


05.01.2009, в 20:10, Andy Parfenov написал(а):

Сначало было слово...

Есть такая штука - Elephant которая демонстрирует возможности функции прозрачности Ambient, мне интересно имеются ли исходники или какое нибудь описание с примерами, как реализовать данную
возможность. У меня есть задумки на одну програмку.

Пишите письма мелким почерком...




Вообщем нашёл я свои опыты.
Вообщем принцип понятен должен быть из кода.

#define __NOLIBBASE__
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <pragma/cgxsystem_lib.h>

#include "Transparent.h"

struct Library *SysBase, *DOSBase, *IntuitionBase, *GfxBase, *CGXSystemBase;

struct Window *win;

VOID handle_window_events(struct Window *win);

__saveds int main()
{
        SysBase = *((struct Library **)4L);
        if(DOSBase = OpenLibrary("dos.library", 0))
        {
                if(IntuitionBase = OpenLibrary("intuition.library", 0))
                {
                        if(GfxBase = OpenLibrary("graphics.library", 0))
                        {
                                if(CGXSystemBase = 
OpenLibrary("cgxsystem.library", 0))
                                {
                        

                                        if(win = OpenWindowTags(NULL, WA_Left, 
000,
                                                                                
                                                                        WA_Top, 
000,
                                                                                
                                                                        
WA_InnerWidth, 200,
                                                                                
                                                                        
WA_InnerHeight, 200,
                                                                                
                                                                        
WA_IDCMP,           IDCMP_CLOSEWINDOW,
                                                                                
                                                                        
WA_CloseGadget,     TRUE,
//                                                                              
                                                                        
WA_BackFill, LAYERS_NOBACKFILL,
                                                                                
                                                                        
WA_Flags, WFLG_DRAGBAR,
                                                                                
                                                                        
                                                                                          
                                                              WA_Title, 
"Transparent",
                                                                                
                                                                        
TAG_DONE))
                                        {
                                                struct Region *Region;
                                                struct Rectangle *rect;
                                                Region = NewRegion();
rect = (struct Rectangle *)AllocVec(sizeof(struct Rectangle), MEMF_PUBLIC|MEMF_CLEAR);
                                                                rect->MinX = 15;
                                                                rect->MinY = 15;
                                                                rect->MaxX = 
100;
                                                                rect->MaxY = 
100;
                                                                
OrRectRegion(Region, rect);


                                                
InstallTransparentRegion(win->WLayer, Region);

      handle_window_events(win);


                                        CloseWindow(win);
                                        }
                                        else FPrintf(Output(), "Не смог открыть 
Окно.");
                                        CloseLibrary(CGXSystemBase);
                                }
                                else FPrintf(Output(), "Не смог открыть 
cgxsystem.library.");
                                CloseLibrary(GfxBase);
                        }
                        else FPrintf(Output(), "Не смог открыть 
graphics.library.");
                        CloseLibrary(IntuitionBase);
                }
                else FPrintf(Output(), "Не смог открыть Intuition.library");

                CloseLibrary(DOSBase);
        }
        return 0;
}

VOID handle_window_events(struct Window *win)
{
struct IntuiMessage *msg;
BOOL done = FALSE;

while (! done)
    {
    /* We have no other ports of signals to wait on,
    ** so we'll just use WaitPort() instead of Wait()
    */
    WaitPort(win->UserPort);

    while ( (! done) &&
            (msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
        {
/* use a switch statement if looking for multiple event types */
        if (msg->Class == IDCMP_CLOSEWINDOW)
            done = TRUE;

        ReplyMsg((struct Message *)msg);
        }
    }
}







Other related posts: