SA-MP Forums Archive
[Include] beta iImage - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [Include] beta iImage (/showthread.php?tid=472573)



beta iImage 1.1 - ipsBruno - 29.10.2013

Fiz essa include agora pela madrugada, й mais uma parte integrante da IPSI!


Basicamente essa include carrega as informaзхes de imagens no formato BIT MAP (.bmp) em pawn. Podendo fazer usar em informaзхes gerais ou atй imprimir logos na tela de seus usuбrios usando Text Draw



Cуdigo


pawn Код:
/*
 *
 * iImage 1.1
 * Criado por Bruno da Silva
 * Include pertencente a IPSI
 * Agradecimentos ipsTeam e William Luigi por iBits
 *
*/



#define GetSizeX(%0)            %0[bitWidth]
#define GetSizeY(%0)            %0[bitHeigth]




enum bitmapType {

    bitType,
    bitSize,
    bitReserve1,
    bitReserve2,
    bitOffset,
    bitLen,
    bitWidth,
    bitHeigth,
    bitDados,
    bitCount,
    bitCompacto,
    bitImgSize,
    bitX,
    bitY,
    usadoCl,
    usadoClImp


};

stock GetPixelColor(File: imageFileex, xx, yy, arr[]) {

    new seek = 52;


    new n = (GetSizeY(arr) - yy ) * (GetSizeX(arr) % 4);
    new o = (GetSizeY(arr) - yy - 1 ) * GetSizeX(arr) ;
    new o_ = yy - (yy - xx) ;
    new b = 3;

    seek +=  (n + ((o + o_) * b));

    fseek( imageFileex, seek);

    static REX,GEX,BEX;

    BEX = fgetchar(imageFileex, 0, false);
    GEX = fgetchar(imageFileex, 0, false);
    REX = fgetchar(imageFileex, 0, false);


    return (REX<<24|GEX<<16|BEX<<8|0xFf);
}

stock File: OpenImage(img[], arr[]) {

    static File: imageFile ;

    if((imageFile = fopen(img, io_read))) {


        static bin[4];

        arr[bitmapType] = (fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8));


        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitSize] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];


        arr[bitReserve1] = fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8);
        arr[bitReserve2] = fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8);


        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitOffset] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];

        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitLen] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];


        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitWidth] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];

        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitHeigth] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];


        arr[bitDados] = fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8);
        arr[bitCount] = fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8);

        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitCompacto] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];

        arr[bitImgSize] = (fgetchar(imageFile, 0, false) | (fgetchar(imageFile, 0, false) << 8));


        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitX] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];

        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[bitY] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];



        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[usadoCl] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];


        bin[0] = fgetchar(imageFile, 0, false);
        bin[1] = fgetchar(imageFile, 0, false);
        bin[2] = fgetchar(imageFile, 0, false);
        bin[3] = fgetchar(imageFile, 0, false);

        arr[usadoClImp] =  (bin[3] << 24) | (bin[2] << 16) | (bin[1] << 8) | bin[0];

        return imageFile;
    }

    return File: false;
}

stock CloseImage(File: img) {
    return fclose(img);
}





Funзхes:


GetSizeX(array)

Pega o tamanho da imagem em largura






GetSizeY(array)


Pega o tamanho da imagem em altura






GetPixelColor(imagefile, pixelx, pixely, arrayheader)

Pega cor de um pixel dado




OpenImage("arquivo", arrayparaguardarinformacoes, arrayparaguardarpixels)


Essa funзгo й importante, pois serve para ler a imagem e armazenar os dados dela e um arquivo!


arrayparaguardarinformacoes vai guardar os dados como nъmero de blocos, qualidade da imagem, tamanho da imagem na vertical e na horizontal, etc.



E por fim! Meninas, nгo coloquem em seu servidor muitos coraзхeszinhos e meninos, nгo coloquem em seu servidor muitas caveirinhas. Fica feio


Respuesta: beta iImage - ipsBruno - 29.10.2013

Post reservado para futuras amostrar de screens.



Estarei indo pra academia agora, logo que voltar atualizarei o projeto. Fiz isto hoje porque me liberou um tempo com INPC (projeto que faзo com Will) e I_INI (projeto com Suyan)


Respuesta: beta iImage - DanDRT - 29.10.2013

Parabens Bruno, Will e Suy! *-*


Re: beta iImage - Menor - 29.10.2013

foda *-*


Re: beta iImage - PT - 29.10.2013

opa muito boa, agora sim os servidores podem colocar imagens ъnicas facilmente no seu login.


Re: beta iImage - Schocc - 29.10.2013

Muito bom essa manipulaзгo;


Re: beta iImage - smiiir - 29.10.2013

Muito bom parabйns


Re: beta iImage - N3XTMapper - 29.10.2013

iPsBruno realmente muito invoador e fod**


Re: beta iImage - WLSF - 29.10.2013

Muito bom, mais uma secundбria sendo lanзada.

Parabйns pelo projeto


Re: beta iImage - Juniiro3 - 29.10.2013

Fod@stico!

@Quanto mais saem includes mais ansioso eu fico pela IPSI