# drawing

The following routines can be used to draw on a bitmap:
drawShadedPolygonToDib(a32Dib dib_dest, sequence coords_dest, sequence colors_dest)
See also: drawDibTransformedPolygon, which is part drawing, part copying, but mainly geometry-altering.
You can also use standard windows API routines to draw directly onto a bitmap, for example those already wrapped in axtra.ew:

        include axtra.ew
        drawEllipseh(dib[DibHandle], left, top, right, bottom)

There is in fact only one routine for drawing bitmaps onto a window or control:
drawDib(integer control, a32Dib dib, integer cX, integer cY, integer dX1, integer dY1, integer dX2, integer dY2)
And finally, the following summary of optimisation tips repeats what has already been said elsewhere:

killDib
  Always call killDib as soon as you do not need a certain bitmap anymore. This deletes the bitmap from memory.
Putting/getting pixels
  If you want to put or get some pixels on or from a bitmap, and you are sure that the point (x, y) is inside the bitmap area, use fastPutDibPixel and fastGetDibPixel instead of putDibPixel or getDibPixel. If you have to put or get a lot of pixels, it is better to use poke() and peek(): see pixels.
clearDib
  Clearing the bitmap with a gray color (blue = green = red) is a lot faster than clearing the bitmap with a color that is not gray.
drawDibToDib and translucency
  If you want to use translucency as an effect, and do not really care about how translucent it is, use an alpha of 127 or 128, which is a lot faster than a different alpha.
copyDibToDib
  If you have 2 bitmaps that have the same size, and you need to copy one of the bitmaps onto the other, use copyDibToDib instead of drawDibToDib.
Adjusting brightness and contrast
  If you need to adjust both brightness and contrast, use adjustDibBrightnessAndContrast instead of adjustDibBrightness and adjustDibContrast.
Filtering
  If your matrix is only 3 by 3, use filterDib3x3 or filterDibGray3x3. Filters with a matrix that has a lot of zeros in it will be a lot faster. filterDibGray and filterDibGray3x3 are a lot faster than filterDib and filterDib3x3, but will make the bitmap gray first.
Sharpening and blurring
  subtleSharpenDib and subtleBlurDib are a lot faster than sharpenDib and blurDib. They are however more subtle: the result is less sharp/blurry than sharpenDib and blurDib.
embossDib
  embossDib is a lot faster if the passed color is a gray color (blue = green = red).
drawDibTransformedPolygon
  drawDibTransformedPolygon is a lot faster if both source- and destination-polygon are inside the area of their bitmap. Source-clipping slows down the routine a lot. Destination-clipping is less expensive, but still a slowdown-factor.