Thats my variation code for signature.
Why dont you use the function BmpBitsSize(winCroquiHandle->bitmapP)?
instead of RowBytes and Height.

//salva uma tela offscreen em um ponteiro para Bmp
BitmapPtr   salveTela(RectangleType *coordenadasBmp){
   WinHandle    winCroquiHandle;        //handle para o form
croqui
        BitmapPtr       croquiBmpPtr=NULL;      //bmpPtr local para
retorno
        UInt16  bytesLinha,altura;
        DWord      romVersao;
        
        if (gBitmapPtr){                    //se ja existe o bmp
                MemPtrFree(gBitmapPtr);          //libere o ponteiro
                gBitmapPtr=NULL;
        }
        //criando o handle para a janela do form croqui(mais
especificamente para o croqui)
        
winCroquiHandle=WinCreateOffscreenWindow(coordenadasBmp->extent.x,coordenadasBmp->extent.y,genericFormat,&err);
        if(!err){
           //copie o croqui da janela atual(parametro NULL) para
winCroquiHandle, nas coordenadas de dst 0,0..
           //..modo scrCopy aka winPaint(3.5)
           WinCopyRectangle(NULL,winCroquiHandle,coordenadasBmp,0,0,scrCopy);
           FtrGet(sysFtrCreator,sysFtrNumROMVersion,&romVersao);
         if(romVersao>=versao35){
              bytesLinha=winCroquiHandle->bitmapP->rowBytes;
//pegando qtde de bytes por linha do handle
                   altura=winCroquiHandle->bitmapP->height;
//pegando altura do handle
            croquiBmpPtr=MemPtrNew(sizeof(BitmapType)+(bytesLinha*altura));
//alocando o ponteiro para bmp j� criado em funcao de
bytesLinha e altura do handle
                   if (croquiBmpPtr){
//se bem sucedido na alocacao..
                           
MemSet(croquiBmpPtr,sizeof(BitmapType)+(bytesLinha*altura),0);
//..defina todos os bytes do bmp como 0(diretamente na
memoria)
                        
                           croquiBmpPtr->width=winCroquiHandle->bitmapP->width;
//copiando a largura do handle para o bmp ptr
                        croquiBmpPtr->height=winCroquiHandle->bitmapP->height;
//copiando a altura do handle para o bmp ptr
                        croquiBmpPtr->rowBytes=winCroquiHandle->bitmapP->rowBytes;
//copiando a qtde de bytes por linha do handle para o bmp
ptr
                        croquiBmpPtr->pixelSize=winCroquiHandle->bitmapP->pixelSize;
//copiando a profundidade do handle para o bmp ptr
                        croquiBmpPtr->nextDepthOffset=NULL;
//endereco para o cabecalho do proximo bmp da
familia(proximo DepthPixel)
                        
                        // CreateOffscreenWindow does not, by default,
create a compressed window
                        
croquiBmpPtr->flags.compressed=winCroquiHandle->bitmapP->flags.compressed;
                        croquiBmpPtr->version=1;    //0 = OS=1.0, 1 =
OS>1.0, 2=transparencia
                        croquiBmpPtr->flags.hasColorTable=0;   //n�o possui
tabela de cores propria
                        
                        // Move the offscreen bits into our bitmap.  The
baseAddr field
                        // contains the bit array of our bitmap for 1-bit,
uncompressed bitmaps.  
                    
MemMove((Ptr)((ULong)(croquiBmpPtr)+sizeof(BitmapType)),BmpGetBits(winCroquiHandle->bitmapP),BmpBitsSize(winCroquiHandle->bitmapP));
         
            }
         }else{ 
            //UInt16  tamanhoBmp=2500;
            UInt16  tamanhoBmp=(coordenadasBmp->extent.x+7)/8*coordenadasBmp->extent.y;
            croquiBmpPtr=MemPtrNew(sizeof(BitmapType)+tamanhoBmp);
//alocando o ponteiro para bmp j� criado em funcao de
            if (croquiBmpPtr){              
               MemSet(croquiBmpPtr,sizeof(BitmapType)+(tamanhoBmp),0);
//..defina todos os bytes do bmp como 0(diretamente na
memoria)
               croquiBmpPtr->width=158;          //copiando
a largura do handle para o bmp ptr
                        croquiBmpPtr->height=125;        //copiando a
altura do handle para o bmp ptr
                        croquiBmpPtr->rowBytes=(158+7)/8;    //copiando a
qtde de bytes por linha do handle para o bmp ptr
                        croquiBmpPtr->pixelSize=1;  //copiando a
profundidade do handle para o bmp ptr
                        croquiBmpPtr->nextDepthOffset=NULL;
//endereco para o cabecalho do proximo bmp da
familia(proximo DepthPixel)                             
                        // CreateOffscreenWindow does not, by default,
create a compressed window
                        croquiBmpPtr->flags.compressed=0;
                        //croquiBmpPtr->version=1;    //0 = OS=1.0, 1 =
OS>1.0, 2=transparencia
                        croquiBmpPtr->flags.hasColorTable=0;   //n�o possui
tabela de cores propria
               
MemMove((Ptr)((ULong)(croquiBmpPtr)+sizeof(BitmapType)),winCroquiHandle->displayAddrV20,tamanhoBmp);
         
            }
         }              
                WinDeleteWindow(winCroquiHandle,false);   //destruindo o
handle para o croqui
        }
        return croquiBmpPtr;    //mudar, carregar o croqui em vez
de retornar
}
On Tue, 27 Mar 2001 16:37:17 -0500
 "Laor, Boaz" <[EMAIL PROTECTED]> wrote:
> after you switch the gDeviceP-> to bitmapP->
> 
> 
> what do you do on this line in GetSignatureBitmap(
> RectangleType*
> theBoundsPtr )? it gives me an error 
> 
> MemMove( (Ptr)((ULong)(theBitmapPtr) +
> sizeof(BitmapType)),DeviceWindowGetPointer(theWindowHandle),
> theRowBytes *
> theHeight);
> 
> 
> the size allocated to the  theRowBytes = 8012 and the
> Height = 114  is that
> too big of a memory chunk to move?  because when i do
> this...
> 
> theRowBytes = theWindowHandle->bitmapP->rowBytes;
> theHeight = theWindowHandle->bitmapP->height;
> 
> these are the values that it returns.  is something wrong
> with that?
> 
> boaz
> 
> -- 
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/

________________________________________________
Don't E-Mail, ZipMail! http://www.zipmail.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to