News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

A simple Bitmap Question.

Started by G`HOST, December 10, 2005, 06:30:09 PM

Previous topic - Next topic

G`HOST

hi,
is there a way to display a particular portion of the Bitmap,Like we do in toolbar by selecting the index number?
Actually i want to associate bitmap ( from a strip of bitmaps )to the menuitems.So is there a way to get the handle of the particular bitmap from the strip.
From it an another question arises how to select a portion of a bitmap by its coordinates ?
{ Bitmap loaded by LoadBitmap call }

Whats wrong in the following code ?

mov ebx,0
.REPEAT
invoke SetMenuItemBitmaps,hSubMenu0,ebx,MF_BYPOSITION,hMenuBit1,hMenuBit2
inc ebx
.UNTIL (ebx<=4)


I just get 1 Bitmap.and the result of PrintDec ebx
Shows that the loop ends After executing once.
But if i change .UNTIL (ebx<=4) to .UNTIL (ebx==4) then the loop executes the required number of times.

Gustav


> Whats wrong in the following code ?

nothing. when .UNTIL is reached the first time, ebx will be 1, and since expression "1 <= 4" is true, the loop terminates. If you want the loop to be executed 4 times, you should write:

   .until (ebx >= 4)

hutch--

G`HOST,

If you wish to use strip bitmaps like it done in a toolbar, you chomp it up with BitBlit and write the result to number of  in memory bitmaps that you can then load into a button or similar.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

G`HOST

Quote from: Gustav on December 10, 2005, 10:33:56 PM

> Whats wrong in the following code ?

nothing. when .UNTIL is reached the first time, ebx will be 1, and since expression "1 <= 4" is true, the loop terminates. If you want the loop to be executed 4 times, you should write:

   .until (ebx >= 4)


Damn ,I must be in some other universe when i dicided to ask,dont know how i missed it.May be if i had given it some more time,I wont have asked it .Thanks anyway :U

Hutch,hi
never played around with bitblit function,but think its high time now. So i will start right now. :bg

Mincho Georgiev

G'HOST ,maybe an old example of mine woulld help you using BitBlt:


[attachment deleted by admin]

G`HOST

shaka_zulu,
                  thanx buddy  :U

G`HOST

Quote from: hutch-- on December 10, 2005, 11:42:42 PM
you chomp it up with BitBlit and write the result to number of  in memory bitmaps that you can then load into a button or similar.
What is memory Bitmaps are they same as Memory DCs ?
I tried to BitBlt from one memory dc to another but it doesnt seems to work.what could be the problem ?
is BitBlt not ment for memory dc to memory dc ? and can more then one Memory DCs be made?I am a bit confused i tried whatever i could but all in vain.

Kestrel

If API (or function or subroutine..) maybe change EBX's value.

you can use this:

    local  iCount
   
        :   :

    mov iCount, 0
    .repeat
   
        call ...
        invoke  ....
       
        inc iCount
   
    .until (iCount >= ??)               

G`HOST

Oh thats not a problem.
After playing with BitBlt ,what i am now trying to do is select a portion of the actual bitmap (which is been selected in to the memory dc created by call to "CreateCompatibleDC") in to an another memory dc and then stretch it and display it in the client area. so what i did is....                                                                         

invoke BeginPaint,hWnd,ADDR ps
               mov hdc,eax
               invoke CreateCompatibleDC,hdc
               mov hmemDC1,eax
               invoke CreateCompatibleDC,hdc
               mov hmemDC2,eax
               invoke SelectObject,hmemDC1,hBitmap
               invoke BitBlt,hmemDC2,0,0,50,50,hmemDC1,596,145,SRCCOPY
               invoke StretchBlt,hdc,...................................
               invoke DeleteDC,hmemDC1
                   invoke DeleteDC,hmemDC2
               invoke EndPaint,hWnd,ADDR ps


But it didnt work.Can somebody help?