News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

still construct my bmp viewer problem again

Started by xiahan, May 03, 2012, 03:44:03 AM

Previous topic - Next topic

xiahan


xiahan




integrated the mask with menu and indicate it upon title bar

xiahan

full source code and execute

hope you like it

dedndave


baltoro

XIAHAN,   
As a suggestion: CodeProject has a very popular imaging program, with the complete source available (it's C++, MFC),...
CxImage, By Davide Pizzolato

...And DAVE is right about Christian Graus,...he's one of the best authors there,...
Baltoro

xiahan

i have read some parts of Christian Graus's article,

and implemented them in my own program

like Brightness,Invert

baltoro thanks Your suggestion,the CxImage is really full of functionalities

i will try to translate C++ code to assemble language ,

cuz assemble is familiar to me

dedndave

hmmm
doesn't seem to work for me


did you try this attachment ???
http://www.masm32.com/board/index.php?topic=18799.msg159331#msg159331
notice how the old picture disappears if you open a new one
notice how you can move a window on top - then move it away

xiahan

Quote from: dedndave on May 08, 2012, 02:15:49 AM
hmmm
doesn't seem to work for me


did you try this attachment ???
http://www.masm32.com/board/index.php?topic=18799.msg159331#msg159331
notice how the old picture disappears if you open a new one
notice how you can move a window on top - then move it away

i have seen you code ,and just trying to fix mine's shortcoming, for the past 6 days
i eliminate the color filter and RGB&BGR rotation,i add a new functionality to my bmpviewer - GrayScale
besides, i had rewrite my code , just to make it modularization,of course,your painting Algo is applied
read file -> pHeap(duplicate to pHeap2) -> pHeap2(manupulate it) -> fresh(back to the duplication) -> save
                                                               

dedndave

aside from the flicker (my fault - lol)   :P ....
i used a simple paint algo

there are a couple problems

first, you try to size the window to fit the image
this may not always work well
some images are larger than the screen
some are so small, that they cause the menu to wrap
there are a number of ways to address these issues
but, the simplest method is to start the program with some reasonable size
and let the user decide how large to make the window

oddly enough - lol
the first image i opened was larger than my screen
the second one i opened was a picture of a message box button   :bg

another problem is loading bitmaps
when you do this, it creates a handle, which is HBITMAP type
to be more accurate, it is a HGDIOBJ type GDI object handle - same as brushes, pens, etc
when you are done using these handles, they should be deleted using DeleteObject

so - if they open a file (the first time) - you store the handle
if they close it, you should delete the object
if they open a new file, the old object should be deleted
if they close the program, any object that is open should be deleted

one way to implement this is to set the handle to 0 after you delete it
and - test it for 0
if it is non-zero, you have one opened

not closing GDI object handles will cause your system to act strangely   :P
it can only support a limited number of GDI objects at any given time

other than those few problems, it is looking better and better   :U

xiahan

ok, thanks for your testing and analizing

i will fix up them later ,

maybe the next 6 days.

and i try to implement other functionalities like flip filter, swirl filter,water filter

but first of all, i need to build a offset procudure to address pixel inside a bitmap

it may involves lots of computation, my nightmare

but write these code using assemble language is much cleaner than C#, and more powerful

ok having achieved this edition i fell i had made lots of progress in writing codes using assemble

language which is really just like a kind of language :dance:

dedndave

you can use GetPixel and SetPixel
they are not fast, but they do all the calculation for you

otherwise, calculate offsets - you can do this if the HDC has a bitmap selected into it
the calculations are not as bad as you might think   :P