Clearing a gfx buffer...

General FreeBASIC programming questions.
Stormy
Posts: 198
Joined: May 28, 2005 17:57
Location: Germany
Contact:

Clearing a gfx buffer...

Postby Stormy » Apr 12, 2006 20:01

Hey guys,

maybe you can help me out with this problem, too ! ;) I want to optimize PAINT in combination with a gfx buffer. I want to fill the buffer with a specific color. Currently I'm using this way:

Code: Select all

DIM Handle AS UBYTE PTR
Handle = ImageCreate(640,480)
SCREENRES 640,480,32
PAINT Handle,(0,0),RGBA(255,0,0,0)
ImageDestroy(Handle)


I thought about this way, but it isnt working:

Code: Select all

#include "crt.bi"
memset Handle, RGBA(255,0,0,0), 1228800


I'm doing this, because I want to create a night-effect by darken the whole screen -> see here

I'm following this method to do this... (the filling process at step 2 costs most of the performance)

Image

Any ideas to do it better or to fill my buffer faster than with paint ?

regards, Stormy
Pritchard
Posts: 5493
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Apr 12, 2006 20:56

Line works fast. Very fast. ^_^;; Line buffer, (x, y), etc... allows you to draw into a buffer that you can put on the screen.

Don't know if it's buffer, (x, y) or just buffer (x, y) though.
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Postby voodooattack » Apr 12, 2006 21:16

just fill it upon creation

Code: Select all

DIM Handle AS UBYTE PTR
Handle = ImageCreate(640, 480, RGBA(255,0,0,0) )


for some reason memset/clear act really wierd when i pass a RGBA value..

EDIT:
btw, when you try to access a buffer directly, you need to skip 4 bytes (2 shorts) = the image header..

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest