1. windows graphics engine
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Dec 19, 2000
- 565 views
------=_NextPart_000_0005_01C069DD.0F953720 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable is there any fast graphics engine for windows in window mode, not = fullscreen. Like AutoCad has to use some fast graphcis engine for = drawing. It doesn't have to be 3d engine, I just need it for fast = drawing. Or does somebody know some ASM code which will draw fast in windows? ------=_NextPart_000_0005_01C069DD.0F953720 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>is there any fast graphics engine for = windows=20 in window mode, not fullscreen. Like AutoCad has to use some = fast=20 graphcis engine for drawing. It doesn't have to be 3d engine, I = just need=20 it for fast drawing.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Or does somebody know some ASM = code which will=20 ------=_NextPart_000_0005_01C069DD.0F953720--
2. Re: windows graphics engine
- Posted by Brian Broker <bkb at CNW.COM> Dec 19, 2000
- 534 views
On Tue, 19 Dec 2000 16:59:33 +0100, <tone.skoda at SIOL.NET> wrote: >is there any fast graphics engine for windows in window mode, not fullscreen. Like AutoCad has to use some fast graphcis engine for drawing. It doesn't have to be 3d engine, I just need it for fast drawing. >Or does somebody know some ASM code which will draw fast in windows? Windows GDI isn't too bad. Otherwise DirectX... -- Brian
3. Re: windows graphics engine
- Posted by Ray Smith <smithr at IX.NET.AU> Dec 19, 2000
- 522 views
Hi, >is there any fast graphics engine for windows in window mode, not fullscreen. Like AutoCad has to use some fast graphcis engine for drawing. It doesn't have to be 3d engine, I just need it for fast drawing. >Or does somebody know some ASM code which will draw fast in windows? euAllegro has the option to run in a windowed mode. I tried it a few times and some things worked and some didn't so I left it. I "think" it might have been that I was trying to setup a screen mode that my desktop couldn't handle but I'm not sure. I'll have a look at it tonight and if I sort out the problem I'll let you know. euAllegro uses DirectX and is very easy to use. Ray Smith http://www.geocities.com/ray_223
4. Re: windows graphics engine
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Dec 19, 2000
- 550 views
- Last edited Dec 20, 2000
>From: Brian Broker <bkb at CNW.COM> > > Windows GDI isn't too bad. Otherwise DirectX... Where do I get Windows GDI?
5. Re: windows graphics engine
- Posted by mic _ <stabmaster_ at HOTMAIL.COM> Dec 20, 2000
- 611 views
>Where do I get Windows GDI? The GDI (Graphics Device Interface (?) ) is a standard component of Windows. You can import the routines from gdi32.dll. Here's an example of how to use the gdi function StretchDIBits() (note that StretchDIBits isn't the fastest function available). (note 2: this code is for 8-bit bitmaps) --STRUCT BITMAPINFOHEADER global constant biSize = 0, biWidth = 4, biHeight = 8, biPlanes = 12, biBitCount = 14, biCompression = 16, biSizeImage = 20, biXPelsPerMeter = 24, biYPelsPerMeter = 28, biClrUsed = 32, biClrImportant = 36, SIZE_OF_BITMAPINFOHEADER = 40 --END STRUCT --STRUCT RGBQUAD global constant rgbBlue = 0, rgbGreen = 1, rgbRed = 2, rgbReserved = 3, SIZE_OF_RGBQUAD = 4 --END STRUCT --### STRUCT RECT ### global constant rect_left = 0, rect_top = 4, rect_right = 8, rect_bottom = 12, SIZE_OF_RECT = 16 --### END STRUCT ### --### Color component compression ### global constant BI_RGB = 0, BI_RLE8 = 1, BI_RLE4 = 2, BI_BITFIELDS = 3 global constant DIB_PAL_COLORS = 1, DIB_RGB_COLORS = 0 --### Raster operations ### global constant SRCINVERT = #660046, SRCAND = #8800C6, MERGEPAINT = #BB0226, MERGECOPY = #C000CA, SRCCOPY = #CC0020, SRCPAINT = #EE0086 --STRUCT BITMAPINFO global constant BITMAPINFOHEADER = 0, RGBQUAD = 40, SIZE_OF_BITMAPINFO = SIZE_OF_BITMAPINFOHEADER + SIZE_OF_RGBQUAD --END STRUCT -- make room for one BITMAPINFOHEADER + 256 RGBQUAD structs bi = allocate(SIZE_OF_BITMAPINFOHEADER + 1024) constant rect = allocate(SIZE_OF_RECT) constant Width = ???, Height = ???, Pointer = allocate(Width*Height) -- 'Pointer' is your bitmap, this is where you keep your graphics. atom dc --### Here's how to set the palette ### --### R, G & B should be 0-255 ### procedure set_windows_palette(sequence pal) for i=0 to 255 do poke(bi + RGBQUAD + (i*4),pal[i+1][3]) poke(bi + RGBQUAD + (i*4)+1,pal[i+1][2]) poke(bi + RGBQUAD + (i*4)+2,pal[i+1][1]) poke(bi + RGBQUAD + (i*4)+3,0) end for end procedure --### Do this once at init ### mem_set(bi, 0, SIZE_OF_BITMAPINFOHEADER) --### Do this whenever you repaint your window ### poke4(bi + BITMAPINFOHEADER + biSize, SIZE_OF_BITMAPINFOHEADER) poke4(bi + BITMAPINFOHEADER + biWidth, Width) poke4(bi + BITMAPINFOHEADER + biHeight, Height) poke_word(bi + BITMAPINFOHEADER + biPlanes, 1) poke_word(bi + BITMAPINFOHEADER + biBitCount, 8) -- the RGBQUAD entries contains explicit RGB values (actually BGRX..) poke4(bi + BITMAPINFOHEADER + biCompression, BI_RGB) dc = GetDC(hwnd) if GetClientRect(hwnd,rect) then end if -- this is it - StretchDIBits copies a memory block to a window's device context -- syntax is as follows: -- StretchDIBits({ -- atom hdc, handle of device context -- atom XDest, x-coordinate of upper-left corner of dest. rect. -- atom YDest, y-coordinate of upper-left corner of dest. rect. -- atom nDestWidth, width of destination rectangle -- atom nDestHeight, height of destination rectangle -- atom XSrc, x-coordinate of upper-left corner of source rect. -- atom YSrc, y-coordinate of upper-left corner of source rect. -- atom nSrcWidth, width of source rectangle -- atom nSrcHeight, height of source rectangle -- atom lpBits, address of bitmap bits -- atom lpBitsInfo, address of bitmap data -- atom iUsage, usage -- atom dwRop raster operation code -- }) StretchDIBits({dc,0,0,peek4s(rect + rect_right),peek4s(rect + rect_bottom), 0,0,Width,Height,Pointer,bi,DIB_RGB_COLORS,SRCCOPY}) if ReleaseDC(hwnd,dc) then end if --### The End ### If this just confused you, I've written some programs that actually use this stuff, and not only for 8-bit graphics. Try searching for "windows animation" at the Euphoria site and my program should pop up at the top.. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
6. Re: windows graphics engine
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Dec 20, 2000
- 536 views
- Last edited Dec 21, 2000
I use BitBlt, is it slower?
7. Re: windows graphics engine
- Posted by mic _ <stabmaster_ at HOTMAIL.COM> Dec 21, 2000
- 581 views
>I use BitBlt, is it slower? No, it's probably faster. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
8. Re: windows graphics engine
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Dec 21, 2000
- 544 views
- Last edited Dec 22, 2000
>mic _ <stabmaster_ at HOTMAIL.COM> i downloaded your windows demo. it will be great help. A bit complex with all the ASM code, though. winhole.exw demo looks very good! I didn't think it was possible with GDI. I have a couple of questions: does only ASM code do the actual drawing on window? or does it draw in bitmap? how much slower do you think it would be if there was no ASM code and only pure Euphoria code? if i understand how the demo works: ASM code writes to bitmap, and StretchDIBits displays the bitmap? Wouldn't it be faster if ASM code wrote directly to screen? another quick question ( i allways forget it (or_bits)): how to get red or green or blue value from RGB color value?
9. Re: windows graphics engine
- Posted by mic _ <stabmaster_ at HOTMAIL.COM> Dec 21, 2000
- 564 views
- Last edited Dec 22, 2000
>does only ASM code do the actual drawing on window? or does it draw in >bitmap? It draws to the bitmap. >how much slower do you think it would be if there was no ASM code and only >pure Euphoria code? Much slower. The asm code makes up the wormhole, wich is the time-critical part of the program. >if i understand how the demo works: ASM code writes to bitmap, and >StretchDIBits displays the bitmap? Yep. >Wouldn't it be faster if ASM code wrote >directly to screen? No can do. Windows won't give you the address to a window's client area (not that I know anyway). It'd seem a bit risky for an OS to hand out such information.. >another quick question ( i allways forget it (or_bits)): how to get red or >green or blue value from RGB color value? Huh? Do you want to read the palette? Or extract the components of a single color? If the latter; it depends on what format your color is. There's 888, 565, 555 to name a few.. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
10. Re: windows graphics engine
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Dec 21, 2000
- 534 views
- Last edited Dec 22, 2000
> >how much slower do you think it would be if there was no ASM code and only > >pure Euphoria code? > > Much slower. The asm code makes up the wormhole, wich is the time-critical > part of the program. > What if I just want to draw text with TextOut() to bitmap? Here is no complex algorithm to calculate. > >Wouldn't it be faster if ASM code wrote > >directly to screen? > > No can do. Windows won't give you the address to a window's client area (not > that I know anyway). It'd seem a bit risky for an OS to hand out such > information.. I don't understand, why do you need window's client area? I wonder, is there (asm?) source code available for basic windows drawing functions (SetPixel,LineTo,Rectangle,Ellipse...) These functions draw directly to screen, don't they? There has to be "one and only" machine code instruction to draw a pixel with a certain color to screen, which has to be the fastest way to draw something to screen, because all other functions are made up from it. And this can't be SetPixel, because it's so slow. Can you explain to me why is it so slow and what's going on? I would really like to know this. Does OS prevent you to use this instruction directly or what ... ? > > >another quick question ( i allways forget it (or_bits)): how to get red or > >green or blue value from RGB color value? > > Huh? Do you want to read the palette? Or extract the components of a single > color? > If the latter; it depends on what format your color is. There's 888, 565, > 555 to name a few.. The color you get with GetPixel() function? is it something like and_bits()?
11. Re: windows graphics engine
- Posted by mic _ <stabmaster_ at HOTMAIL.COM> Dec 21, 2000
- 514 views
- Last edited Dec 22, 2000
>What if I just want to draw text with TextOut() to bitmap? Here is no >complex algorithm to calculate. > Drawing truetype characters is actually a pretty complicated task, though using asm would speed up anything in this case since you'd eventually have to call the gdi textout routine anyway. >I don't understand.. Drawing directly to the screen (or a window) means getting a pointer to the desired are and write to that address. Windows won't give you a ny such pointers. Instead, it'll give you device-contexts to use with the Windows gdi functions. If you want to draw *directly* to the screen/window, then you should go for DirectDraw. >The color you get with GetPixel() function? is it something like >and_bits()? RGB = GetPixel(dc, x, y) red = and_bits(RGB, 255) green = and_bits(floor(RGB/256), 255) blue = and_bits(floor(RGB/65536), 255) _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.