1. displaying bitmaps and deleting old bitmaps

Hello.
I am getting different pictures from the internet. They are of various
sizes. I display one, then anoher and I may want to redisplay one I had
previously displayed. Code is :
hBitmap = loadBitmapFromFile(hSle9),
then in onPaint  I am performing this code
 
             if db_table_size() > 0  then
                        if atom(hBitmap) then
                        deleteObject ( Bitmap54)
                                    extent = getExtent(MyWin)
                                    i = 241
                                    j = 42
                                    drawBitmap( MyWin, hBitmap, i, j)
                        end if
            end if
The pictures are not of the same size and so some of the previous
picture is left on the screen. How do I remove the previous picture
without forcing each picture to be the same size,  or must I edit each
picture in a photo program????
Thanks  for any help

new topic     » topic index » view message » categorize

2. Re: displaying bitmaps and deleting old bitmaps

On Mon, 5 Jan 2004 09:24:34 -0700, sixs <sixs at ida.net> wrote:

>picture is left on the screen. How do I remove the previous picture
>without forcing each picture to be the same size,  or must I edit each
>picture in a photo program????

You could perhaps drawRectangle() in the background colour with the
fill parameter set, maybe?

Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: displaying bitmaps and deleting old bitmaps

Whatever the equivalent is for this (below) in Win32lib

hdc   = c_func(xGetDC, {hwnd})
memdc = c_func(xCreateCompatibleDC, {hdc})
hbit  = c_func(xCreateCompatibleBitmap, {hdc, xScreen, yScreen})
junk  = c_func(xSelectObject,{memdc, hbit})
        
if not c_func(xPatBlt, {memdc, 0, 0, vxScreen, vyScreen, PATCOPY}) then end if 

Euman


----- Original Message ----- 
From: "sixs" <sixs at ida.net>
To: <EUforum at topica.com>
Sent: Monday, January 05, 2004 11:24 AM
Subject: displaying bitmaps and deleting old bitmaps


> 
> 
> Hello.
> I am getting different pictures from the internet. They are of various
> sizes. I display one, then anoher and I may want to redisplay one I had
> previously displayed. Code is :
> hBitmap = loadBitmapFromFile(hSle9),
> then in onPaint  I am performing this code
>  
>              if db_table_size() > 0  then
>                         if atom(hBitmap) then
>                         deleteObject ( Bitmap54)
>                                     extent = getExtent(MyWin)
>                                     i = 241
>                                     j = 42
>                                     drawBitmap( MyWin, hBitmap, i, j)
>                         end if
>             end if
> The pictures are not of the same size and so some of the previous
> picture is left on the screen. How do I remove the previous picture
> without forcing each picture to be the same size,  or must I edit each
> picture in a photo program????
> Thanks  for any help
>  
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: displaying bitmaps and deleting old bitmaps

----- Original Message ----- 
From: "sixs" <sixs at ida.net>
To: <EUforum at topica.com>
Subject: displaying bitmaps and deleting old bitmaps


> 
> 
> Hello.
> I am getting different pictures from the internet. They are of various
> sizes. I display one, then anoher and I may want to redisplay one I had
> previously displayed. Code is :
> hBitmap = loadBitmapFromFile(hSle9),
> then in onPaint  I am performing this code
>  
>              if db_table_size() > 0  then
>                         if atom(hBitmap) then
>                         deleteObject ( Bitmap54)
>                                     extent = getExtent(MyWin)
>                                     i = 241
>                                     j = 42
>                                     drawBitmap( MyWin, hBitmap, i, j)
>                         end if
>             end if
> The pictures are not of the same size and so some of the previous
> picture is left on the screen. How do I remove the previous picture
> without forcing each picture to be the same size,  or must I edit each
> picture in a photo program????
> Thanks  for any help
>  

You might be doing it the hard way. Why not consider using Win32lib's Bitmap
control? You don't have to worry about handling paint messages or resizing it as
its done automatically for you.

Here is an example program ...

-- example10.exw
-- This example opens a window, and places bitmaps in it.

without warning
include win32lib.ew

constant MainWindow =  
create( Window, "Click to show another bitmap", 0, Default, Default, 400,
    400, 0 )

constant BitmapArea =
    create( Bitmap, "", MainWindow, 0, 0, 132, 132,0 )

integer vBM_Index
object vBM_Files

procedure Change_Bitmap(integer self, integer event, sequence parms)
    
    if sequence(vBM_Files) and length(vBM_Files) > 0 then
        -- Every click gets the next bitmap
        vBM_Index += 1
        if vBM_Index > length(vBM_Files) then
            -- To back to first bitmap
            vBM_Index = 1
        end if
        setBitmap( BitmapArea, vBM_Files[vBM_Index][D_NAME] )
    end if

end procedure

vBM_Index = 0
vBM_Files = dir("*.bmp") -- Look for any bitmaps.
if not sequence(vBM_Files) or length(vBM_Files) = 0 then
VOID = message_box("This demo needs one or more bitmap vBM_Files in the
    directory.","",0)
end if    

setHandler(MainWindow, {w32HActivate, w32HClick}, routine_id( "Change_Bitmap" ))
WinMain( MainWindow, Maximize )

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu