Author Topic: Challenge  (Read 1748 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Challenge
« on: June 25, 2013, 06:44:33 AM »
Deleted
« Last Edit: April 25, 2015, 04:15:07 AM by Peter »

JRS

  • Guest
Re: Challenge
« Reply #1 on: June 25, 2013, 08:39:03 AM »
Quote
I am no member there,

You should be. It only takes a minute to register. I'm sure Charles has better things to do and I know I do.


Aurel

  • Guest
Re: Challenge
« Reply #2 on: June 25, 2013, 08:53:50 AM »
Objection... ;D
jedenfalls ist das hier - scheise  ::)

and this freaky dude is infact two Tom & Mathias  .ToooMaaaz ;D

Aurel

  • Guest
Re: Challenge
« Reply #3 on: June 25, 2013, 09:45:18 AM »
Ok here is method from EBasic but without directX using GDI,it is mandelbrot...
Code: [Select]
include "awinh.inc"
#lookahead
INT win,c,r
INT w,h
dim i,y,px as INT
dim Z_re2 as FLOAT
dim Z_im2 as FLOAT
dim Z_re as FLOAT
dim Z_im as FLOAT
dim c_re as FLOAT
dim c_im as FLOAT


INT hdc, hdcMem, hbmMem,   oldBmp, oldBrush, oldPen, oldFont, fColor
INT textX,textY,hBrush

INT ImageWidth=640
INT ImageHeight=480

MinRe = -2.0f
MaxRe = 1.0f
MinIm = -1.2f
MaxIm = MinIm+(MaxRe-MinRe)*ImageHeight/ImageWidth
Re_factor = (MaxRe-MinRe)/(ImageWidth-1)
Im_factor = (MaxIm-MinIm)/(ImageHeight-1)
'window
win = SetWindow("Mandelbrot EB",0,0,ImageWidth,ImageHeight,0,WS_SYSMENU)

InitDrawing()
'---------------------------------------------------------------------
for y = 0 to ImageHeight-1
c_im = MaxIm - y*Im_factor
for px=0 to ImageWidth-1
c_re=MinRe+px*Re_factor
Z_re=c_re
Z_im=c_im
for i = 1 to 30
Z_re2=Z_re*Z_re
Z_im2=Z_im*Z_im
if (Z_re2+Z_im2) > 4
'Pix (win, px, y, 255-(i+5),i*5, i) 'draw to back buffer is faster
                   Setpixel hdcMem, px, y,RGB(255-(i+5),i*5, i)
exit for
end if
Z_im=2*Z_re*Z_im+c_im
Z_re=Z_re2-Z_im2+c_re
next i

next px
next y



'----------------------------------------------------------------
Wait()

Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback

Select wmsg

CASE WM_CLOSE
DestroyWindow win
CleanUp()
PostQuitMessage 0

CASE WM_SIZE
'GetSize(win,0,0,w,h)

CASE WM_PAINT
BitBlt(hDC, 0, 0, w, h, hdcMem, 0, 0, SRCCOPY)

End Select

Return DEFAULT

End Function

SUB InitDrawing
''get current size of window
GetSize(win,0,0,w,h)
'get window DC
hdc=GetDC(win)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, w, h)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, w, h, hdc, 0, 0, SRCCOPY)
ReleaseDC( win, hdc)
End SUB

SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
END SUB

Sub Pix(wnd as int,sys x, y, r, g, b)
 hdc=GetDC(wnd)
    sys pcolor = RGB(r,g,b)
    Setpixel hdc, x, y,pcolor
BitBlt(hDCmem, 0, 0, w, h, hdc, 0, 0, SRCCOPY)
 ReleaseDC(wnd, hdc)
End Sub