WinAPI Good Paradigm for Graphics Viewing Software

Hi everyone,

I want to make an application that opens a certain type of vector graphics files, draws the shapes on the screen, and performs some simple image editing and navigation operations (such as pan and zoom....etc).

I will be using WinAPI and Direct2D to do this.

My problem is that there are a lot of questions that come to mind on how to approach this, and using trial and error will introduce a lot of unnecessary delays. I have tried searching online for examples of similar applications but I couldn't find any. In addition, some examples provided by Microsoft, unfortunately, don't compile on my VS 2019 (I prefer mingw++ and CodeBlocks anyway) as they are quite old.

Does anyone have a well-established paradigm for this type of applications?

In addition, here are some specific questions that I have in mind:
- Should I draw directly in the main window? or should I create a child window to include the drawing?
- Is it better to implement features like pan and zoom by resizing and moving the drawing window? or draw the shapes with transformations?
- If I want to manipulate the drawn image's pixels, should I use something like WIC (Windows Imaging Component) or should I manipulate an internal bitmap structure that then gets redrawn by D2D each time?

Thanks in advance.
drawing in a child or main is about your design.
if you plan to have more than one (file?) open at one time, a child window is pretty much assured as the way to go. Think about what your program will look like and how it will be used. Most likely a child is the way to go, but will it be docked? Always on top? Some other approach?

zoom should use a quality resample algorithm. Just drawing it bigger or smaller without that will cause more distortion and lower quality results. That is OK if you are drawing simple things like a bar graph, but usually not desired. Pan is simple, and can be done by just moving the image's location (how depends on the tool you used).

not sure on the pixels. Every good drawing tool is going to hand you, most likely, a 1-D array of pixels that you can doctor. I can't say that one pixel array is any different from another; your only question when choosing a tool at this level is 'does it support giving me that'. Then the other question, what ELSE do you need to do, and does your selected tool either support it or make it easy to piece together?
Topic archived. No new replies allowed.