Quantcast
Viewing all articles
Browse latest Browse all 1529

[VB6] GDI+ Matrix For Rendering and Hit Testing

GDI+ offers a matrix object that can be applied to various other GDI+ objects. One of those is the Graphics object (similar to GDI's hDC). With a matrix, we can simultaneously scale, rotate, shear & offset/translate a rendering in basically one call.

The attached offers such options in a simple sample project. The matrix is created and can be cached for all future rendering, unless of course something changes and the matrix should be recreated. What's kind of neat is that an inverted copy of the matrix can be used for hit testing on the rotated, scaled, sheared, translated rendering relative to the original object, un-rotated, un-scaled, un-sheared, un-translated.

Please read the comments included in the code, especially within the pvCreateDisplayMatrix routine, before asking questions about the code

Image may be NSFW.
Clik here to view.
Name:  Untitled.jpg
Views: 40
Size:  44.6 KB
Attached Images
Image may be NSFW.
Clik here to view.
 
Attached Files

Viewing all articles
Browse latest Browse all 1529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>