The EBGFX Library is a Free MFC compatible library created to get fast
access to image data and include several functions not available in the
windows gdi.
Whether you create a Ray-Tracer, an Image Processing
Library, a Painting Program or Games, you need direct pixel access,
you can’t just use GetPixel, SetPixelV. One way to achieve this is using
Dibs (Device Independant Bitmaps). To get rid of the details of creating
destroying DibSections I wrote a CDib class.
However I want more
than just Creating and Destroying Images, I want to have several layers
and techniques to composite those layers into a final Image, so I’ve
implemented some of the Compositing techniques found in Photoshop.
(As a GFX Artist I’m more acquainted with those techniques as with
src & dst Blend functions).
I also included some routines to Copy/Paste
parts of Images to other Images, with optional Compositing.
The current public version of the Library contains two classes :
CDib, which can be used as an offscreen surface, a tile, a layer, and
which includes several Compositing techniques and Drawing Primitives.
CDrawDib, which can be used to write a CDib directly into Video
Memory with optional Stretching and/or Dithering the Dib.
Two other classes are not yet released : CFilter, which implements a lot of
Image Processing Filters, and CFileHandler which loads several Image
Formats like BMP, JPG, GIF, TGA, TIFF, PCX, PSD, etc.
In the future I’ll probably create a DirectDaw based version for
Games.
Compositing
Original
Original | Blend | Darken | Difference | Lighten | Multiply | Screen |
What does each function do ?
Blend : | Blends the src color with the dst color (alpha from 0 to 255) |
Darken : | dst = Darkest Color ( src, dst ) |
Difference : | dst = Abs ( src-dst ) |
Lighten : | dst = Lightest Color ( src, dst ) |
Multiply : | dst = src*dst |
Screen : | dst = (255-src)*(255-dst) |
What can they be used for ?
Blend : | That nice Glassy effect for windows, water, fading |
Darken : | Shadows |
Difference : | Inverting |
Multiply : | Exclude certain color channels, masking |
Lighten, Screen : | Flares, Fire, Explosions |
This is a small example which shows some of the functionality
of the CDib and CDrawDib classes : RotoZoom.zip
It’s a small RotoZoomer with optional Motion Blur (using the CDib functions)
This is a second example testing the new CopyDC/PasteDC functions,
It grabs the opposite part of the screen, and puts it behind Glass.
There is still a little problem though (see Second Screenshot), how can you grab the screen
before your window gets painted ? If anyone knows how to fix this,
please mail me
Bugs & Warnings
Send Suggestions, Speed Increases and Bug Reports to [email protected]
Bugs : |
|
Warnings : |
|
Future Enhancements
|
Download demo project and source code: RotoZoom – 160KB
Download demo project XRay.zip – 145KB
Date Posted: 5/08/98