English
Forum

several Memory-Bitmaps ?

 
- Page 1 -



Christian
Eichler
How always Have I a problem : How can I several (!) Memory-Bitmaps in Profan² 6.6 create ? with MCLS can time Yes one create, but not several ...
though would like I The Images then not the Festplatte zwischenspeichern (only that none on The idea comes, me To say I should me SaveBmp and LoadBmp works )

my 1. idea : WinAPI : commands (of my opinion to the right) found, installed, Error.

The Source :

as Error Message comes there then, the the image Test.bmp not stored go could .
How bekomm I that to that walk, I in Profan (ggf. over The WinAPI) several Memory-Bitmaps create and hereon too grab can ?

mfg your always komische Frangen stellender Christian !
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/20/07  
 



 
- Page 1 -



Christian
Eichler
640*480 wasn't possible, but Screenshot is nevertheless thereby

The swell line, The You warscheinlich without goggles garnet see should whom Graph present


5 kB
Hochgeladen:07/20/07
Downloadcounter105
Download
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/20/07  
 



lying the Wertebereich below one Longs or Floats?
 
07/20/07  
 



 
- Page 2 -



Nico
Madysa
with 6000*3000 Pixeln sure
 
Nico Madysa
07/20/07  
 



lying the Wertebereich below one Longs or Floats?
 
07/20/07  
 




Christian
Eichler
The Wertebereich of what ?

on the Image naturally in the Long ...
with the Definitions and Wertemenge the Graphen in Float ...
where I say must, I The Floatwerte first umrechne and then directly aufs paper draw, means not save ! I memory really quite no values, wären anyhow To many !

helps you the moreover ?
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/21/07  
 




Andreas
Miethe


Hello Chistian,

To Your code :
StartPaint heading The Output one other Window or Control circa, not on one DC, can means not functions.

If you with API works want then must You, the too with API-Zeichenfunktionen make, with the Profan-Zeichenfunktionen can You then nothing begin.

here an example, that one Memory bitmap anlegt, a line and a curve hereon draw, and the whole then in the Profanfenster indicating.
On these manner can You then too several Speicherbitmaps lay out and Show.
Def @CreateCompatibleBitmap(3) !gdi32.dll,CreateCompatibleBitmap
Def @CreateCompatibleDC(1) !gdi32.dll,CreateCompatibleDC
Def @SelectObject(2) !gdi32.dll,SelectObject
Def @ReleaseDC(2) !user32.dll,ReleaseDC
Def @DeleteDC(1) !gdi32.dll,DeleteDC
Def @BitBlt(9) !gdi32.dll,BitBlt
Def @PolyLineTo(3) !gdi32.dll,PolylineTo
Def @PolyBezierTo(3) !gdi32.dll,PolyBezierTo
Def @LineTo(3) !gdi32.dll,LineTo
Def @MoveToEx(4) !gdi32.dll,MoveToEx
Def @CreatePen(3) !gdi32.dll,CreatePen
Def @FloodFill(4) !gdi32.dll,FloodFill
Def @GetDC(1) !user32.dll,GetDC
Def @ReleaseDC(2) !user32.dll,ReleaseDC
Def @DeleteObject(1) !gdi32.dll,DeleteObject
SetTrueColor 1
CLS
Declare dc&,test&,pen&,Points#
Let dc&    = @CreateCompatibleDC(%hdc) DeviceContext produce
Let test&  = @CreateCompatibleBitmap(%HDC,640,480)hBitmap produce
Let pen&   = @CreatePen(0,1,RGB(0,0,255))Pen to that draw produce
@SelectObject(dc&,test&)hBitmap in DeviceContext
@SelectObject(dc&,pen&)Pen in DeviceContext
@FloodFill(dc&,0,0,RGB(255,255,255))hBitmap knows fill
@MoveToEx(dc&,0,0,0) to that Startpunkt
@LineTo(dc&,Width(%hwnd),Height(%hwnd))line characters
structure with Points lay out ( in this drop 3 spots )
Dim Points#,24
1. point
Long Points#,0 = 0  X
Long Points#,4 = 0  Y
2. point
Long Points#,8 = Width(%hwnd)/2
Long Points#,12 = Height(%hwnd)*2
2. point
Long Points#,16 = Width(%hwnd)
Long Points#,20 = 0
@MoveToEx(dc&,0,0,0)to that Startpunkt
@PolyBezierTo(dc&,Points#,3)Bezier-curve from point-structure
@BitBlt(%hdc,0,0,640,480,dc&,0,0,$CC0020)hBitmap on CLS-Window Show
@BitBlt(%hdc2,0,0,640,480,dc&,0,0,$CC0020)Hbitmap too to that Sicherungs-DC
memory straighten up
Dispose Points#
@DeleteObject(test&)
@DeleteObject(pen&)
@DeleteDC(dc&)

While 1

EndWhile

 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
07/21/07  
 




Christian
Eichler
Okay, thanks...
then can I on this place Yes same ask, what it of these DCs on itself has:

what has it of these DCs on itself ? what's this thing and why needed one something like ?
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/21/07  
 




Andreas
Miethe


Hello Christian,

One DC or Device Context is roughly said a structure The grafically Objects and its attributes contain.
grafically Objects are Bitmap,Brush,Font,Pen and Region.
each Window and Control but too one printer has one DC the with API-functions drawn go can.

CreateCompatibleDC() insert DC in memory on, this DC can then with SelectObject() one the o.g. grafischen Objects allocated go.

I hope I have the enough declared.
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
07/21/07  
 




Christian
Eichler
Öhm... Yes the ought to long, thanks !
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/21/07  
 




Christian
Eichler
@ Andreas : your code was somehow very unübersichtlich, I Have whom time so rewritten, How I it need can :
Def @CreateCompatibleBitmap(3) !gdi32.dll,CreateCompatibleBitmap
Def @CreateCompatibleDC(1) !gdi32.dll,CreateCompatibleDC
Def @SelectObject(2) !gdi32.dll,SelectObject
Def @DeleteDC(1) !gdi32.dll,DeleteDC
Def @BitBlt(9) !gdi32.dll,BitBlt
Def @LineTo(3) !gdi32.dll,LineTo
Def @CreatePen(3) !gdi32.dll,CreatePen
Def @FloodFill(4) !gdi32.dll,FloodFill
Def @DeleteObject(1) !gdi32.dll,DeleteObject
Def @MoveToEx(4) !gdi32.dll,MoveToEx
Def @GetPixelA(3) !gdi32.dll,GetPixel

Proc Strich

    Parameters DCHandle&, StrichX1&, StrichY1&, StrichX2&, StrichY2&, StrichFarbe&
    Declare Stift&
    Let Stift&=@CreatePen(0,1,StrichFarbe&)
    @SelectObject(DCHandle&,Stift&)
    @MoveToEx(DCHandle&,StrichX1&,StrichY1&,0)
    @LineTo(DCHandle&,StrichX2&,StrichY2&)
    @DeleteObject(Stift&)

ENDPROC

Proc SpeicherBitmap

    Parameters XBreite&, YBreite&
    Declare DC&, hBitMap&
    Let DC&=@CreateCompatibleDC(%hdc)
    Let hBitMap&=@CreateCompatibleBitmap(%hdc,XBreite&,YBreite&)
    @SelectObject(DC&,hBitMap&)
    @FloodFill(DC&,0,0,RGB(255,255,255))
    return DC&

ENDPROC

Proc LadeSpeicherBitmapX

    Parameters DCHandle&
    @BitBlt(%hdc,0,0,640,480,DCHandle&,0,0,$CC0020)
    @BitBlt(%hdc2,0,0,640,480,DCHandle&,0,0,$CC0020)

ENDPROC

Proc LadeSpeicherBitmap

    Parameters DCHandle&, XBreite&, YBreite&
    Declare m%, n%

    While m% < XBreite&

        Inc m%

        While n% < YBreite&

            Inc n%

            Ifnot @GetPixelA(DCHandle&,m%,n%)=@RGB(255,255,255)

                @BitBlt(%hdc,m%,n%,1,1,DCHandle&,m%,n%,$CC0020)
                @BitBlt(%hdc2,m%,n%,1,1,DCHandle&,m%,n%,$CC0020)

            EndIf

        EndWhile

        Let n%=0

    EndWhile

ENDPROC

Proc ZerstohreSpeicherBitmap

    Parameters DCHandle&
    @DeleteDC(DCHandle&)

ENDPROC

SetTrueColor 1
CLS @RGB(150,150,150)
Declare SBit1&
SpeicherBitmap 640,480
Let SBit1&=@&(0)
Strich SBit1&,0,0,100,50,@RGB(0,0,255)
Strich SBit1&,100,50,200,100,@RGB(0,255,0)
Strich SBit1&,200,100,300,150,@RGB(255,0,0)
Strich SBit1&,300,150,400,200,@RGB(0,0,255)
Strich SBit1&,400,200,500,250,@RGB(0,255,0)
Strich SBit1&,500,250,600,300,@RGB(255,0,0)
LadeSpeicherBitmap SBit1&,640,480
WaitInput
ZerstohreSpeicherBitmap SBit1&

only How I a single colour transparent get, there be I me not yet 100%-ig sure. in the example supra Although a Solution, but the is still very slow !
and for last Parameter in BitBlt Have so did i nothing suitable found !

mfg Christian

PS: I Have even yourself another API-function with reingemurkst !!!
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/21/07  
 




Andreas
Miethe


Hello Christian

I have your example time adjusted.
its now a new Procedur drin namens Drawtransparent

sees wild from, is hopefully enough comments.

in the Grunde power The Procedur your Memory bitmap just transparent and draw it on %HDC.

the goes though integral faster as your Procedur, there everything at a single blow displayed becomes.
Def @CreateCompatibleBitmap(3) !gdi32.dll,CreateCompatibleBitmap
Def @CreateCompatibleDC(1) !gdi32.dll,CreateCompatibleDC
Def @SelectObject(2) !gdi32.dll,SelectObject
Def @DeleteDC(1) !gdi32.dll,DeleteDC
Def @BitBlt(9) !gdi32.dll,BitBlt
Def @LineTo(3) !gdi32.dll,LineTo
Def @CreatePen(3) !gdi32.dll,CreatePen
Def @FloodFill(4) !gdi32.dll,FloodFill
Def @DeleteObject(1) !gdi32.dll,DeleteObject
Def @MoveToEx(4) !gdi32.dll,MoveToEx
Def @GetPixelA(3) !gdi32.dll,GetPixel
Def GetCurrentObject(2) ! gdi32,GetCurrentObject
Def SetBkColor(2) ! gdi32,SetBkColor
Def CreateBitmap(5) ! gdi32,CreateBitmap
DEF SetMapMode(2) ! GDI32,SetMapMode
DEF GetMapMode(1) ! GDI32,GetMapMode

Proc Strich

    Parameters DCHandle&, StrichX1&, StrichY1&, StrichX2&, StrichY2&, StrichFarbe&
    Declare Stift&
    Let Stift&=@CreatePen(0,1,StrichFarbe&)
    @SelectObject(DCHandle&,Stift&)
    @MoveToEx(DCHandle&,StrichX1&,StrichY1&,0)
    @LineTo(DCHandle&,StrichX2&,StrichY2&)
    @DeleteObject(Stift&)

ENDPROC

Proc SpeicherBitmap

    Parameters XBreite&, YBreite&
    Declare DC&, hBitMap&
    Let DC&=@CreateCompatibleDC(%hdc)
    Let hBitMap&=@CreateCompatibleBitmap(%hdc,XBreite&,YBreite&)
    @SelectObject(DC&,hBitMap&)
    @FloodFill(DC&,0,0,RGB(255,255,255))
    return DC&

ENDPROC

Proc LadeSpeicherBitmapX

    Parameters DCHandle&
    @BitBlt(%hdc,0,0,640,480,DCHandle&,0,0,$CC0020)
    @BitBlt(%hdc2,0,0,640,480,DCHandle&,0,0,$CC0020)

ENDPROC

Proc LadeSpeicherBitmap

    Parameters DCHandle&, XBreite&, YBreite&
    Declare m%, n%

    While m% < XBreite&

        Inc m%

        While n% < YBreite&

            Inc n%

            Ifnot @GetPixelA(DCHandle&,m%,n%)=@RGB(255,255,255)

                @BitBlt(%hdc,m%,n%,1,1,DCHandle&,m%,n%,$CC0020)
                @BitBlt(%hdc2,m%,n%,1,1,DCHandle&,m%,n%,$CC0020)

            EndIf

        EndWhile

        Let n%=0

    EndWhile

ENDPROC

Proc ZerstohreSpeicherBitmap

    Parameters DCHandle&
    @DeleteDC(DCHandle&)

ENDPROC

NEW !

Proc DrawTransparent

    Parameters inDC&,w&,h&,transcolor&
    Declare hhBitmap&,BitmapHandle&
    Declare HdcTemp&,HdcBack&,HdcObject&,HdcMem&,hdcSave&
    Declare BmpAndBack&,BmpAndObject&,BmpAndMem&,BmpSave&
    Declare BmpBackOld&,BmpObjectOld&,BmpMemOld&,BmpSaveOld&
    Declare CColor&
    temporaerDC lay out
    Let HdcTemp& = CreateCompatibleDC(%hdc)
    Let hhBitMap&=@CreateCompatibleBitmap(%hdc,w&,h&)
    SelectObject(HdcTemp&,hhBitMap&)
    BitBlt(HdcTemp&,0,0,w&,h&,inDC&,0,0,$0CC0020)
    one couple memory-DCs lay out
    Let HdcBack&   = CreateCompatibleDC(%hdc)
    Let HdcObject& = CreateCompatibleDC(%hdc)
    Let HdcMem&    = CreateCompatibleDC(%hdc)
    Let HdcSave&   = CreateCompatibleDC(%hdc)
    Bitmaps lay out
    monochrom DC
    Let BmPAndBack&   = CreateBitmap(w&,h&,1,1,0)
    Let BmPAndObject& = CreateBitmap(w&,h&,1,1,0)
    colour
    Let BmPAndMem&    = CreateCompatibleBitmap(%hdc,w&,h&)
    Let BmPSave&      = CreateCompatibleBitmap(%hdc,w&,h&)
    SetMapMode(HdcTemp&,GetMapMode(%hdc))
    each memory-DC must one Bitmap selektieren to that Save the data
    Let BmpBackOld&   = SelectObject(HdcBack&,BmPAndBack&)
    Let BmpObjectOld& = SelectObject(HdcObject&,BmpAndObject&)
    Let BmpMemOld&    = SelectObject(HdcMem&,BmpAndMem&)
    Let BmpSaveOld&   = SelectObject(HdcSave&,BmpSave&)
    Bitmaps secure because it ueberschrieben becomes
    BitBlt (HdcSave&,0,0,w&,h&,HdcTemp&,0,0,$0CC0020)
    transparency-colour fuer temporaerDC settle
    Let CColor& = SetBkColor(HdcTemp&,TransColor&)
    an Object-mask lay out fuer the Bitmaps lay out
    From QuellBitmap in Monochrom-Bitmap
    BitBlt(HdcObject&,0,0,w&,h&,HdcTemp&,0,0,$0CC0020)
    Backgroundcolor fuer temoraerDC is knows
    SetBkColor(HdcTemp&,rgb(255,255,255))
    Object-mask invertieren
    BitBlt(HdcBack&,0,0,w&,h&,HdcObject&,0,0,$0330008)
    HDC-background in that MemoryDC copy
    BitBlt(HdcMem&,0,0,w&,h&,%hdc,0,0,$0CC0020)
    area disguise in the the Bitmaps appear
    BitBlt(HdcMem&,0,0,w&,h&,HdcObject&,0,0,$08800C6)
    transparenten area disguise
    BitBlt(HdcTemp&,0,0,w&,h&,HdcBack&,0,0,$08800C6)
    XOR Bitmap with background HDC
    BitBlt(HdcMem&,0,0,w&,h&,HdcTemp&,0,0,$0EE0086)
    transparentes Bitmap in HDC copy
    BitBlt(%hdc,0,0,w&,h&,HdcMem&,0,0,$0CC0020)
    and in that memory-HDC copy
    BitBlt(%hdc2,0,0,w&,h&,HdcMem&,0,0,$0CC0020)
    memory-Bitmaps enable
    DeleteObject(SelectObject(HdcBack&,BmpBackOld&))
    DeleteObject(SelectObject(HdcObject&,BmpObjectOld&))
    DeleteObject(SelectObject(HdcMem&,BmpMemOld&))
    DeleteObject(SelectObject(HdcSave&,BmpSaveOld&))
    DeleteObject(SelectObject(HdcTemp&,hhBitmap&))
    memory-Dcs enable
    DeleteDC(HdcMem&)
    DeleteDC(HdcBack&)
    DeleteDC(HdcObject&)
    DeleteDC(HdcSave&)
    DeleteDC(HdcTemp&)

ENDPROC

SetTrueColor 1
CLS @RGB(150,150,150)
Declare SBit1&,haDC&
LoadBmp $syspath+\setup.bmp,0,0;0  Wallpapers to that Testn ( way adjust !! )
SpeicherBitmap 640,480
Let SBit1&=@&(0)
Strich SBit1&,0,0,100,50,@RGB(0,0,255)
Strich SBit1&,100,50,200,100,@RGB(0,255,0)
Strich SBit1&,200,100,300,150,@RGB(255,0,0)
Strich SBit1&,300,150,400,200,@RGB(0,0,255)
Strich SBit1&,400,200,500,250,@RGB(0,255,0)
Strich SBit1&,500,250,600,300,@RGB(255,0,0)
DrawTransparent SBit1&,640,480,RGB(255,255,255)
WaitInput
ZerstohreSpeicherBitmap SBit1&
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
07/21/07  
 




Christian
Eichler
thanks, I had the trouble, that my procedure right slow was ...
I Have but hold nothing better found ...

thanks for Help with the WinAPI !

mfg Christian
 
Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6
07/21/07  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.285 Views

Untitledvor 0 min.
H.Brill09/18/23
Walter04/11/23
Ernst04/18/14
iF05/08/13
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie