1:1 MSPaint clone - not ? but !

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

hto
Developer
Posts: 2193
Joined: Sun Oct 01, 2006 3:43 pm

Post by hto »

Black_Fox wrote: It may help to track down the issue, that ReactOS Calculator does very similar thing when downloaded from SF.net, but executable built as part of ReactOS itself is fine.
WRC (Wine resource compiler), which is used to build ReactOS, assumes that Slovak files are in CP-1250. Maybe ReactOS Calculator from SF.net was compiled with some other tool.
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

dcuny wrote:There's a refresh bug under WinXP. When a bitmap is initially loaded, the canvas remains white until the window receives a mouse click event.
It is not yet implemented. Use the 100% entry from the view->zoom menu to do so. It will also resize the canvas. Use it for the resize function, too.
dcuny wrote:You should check the file header to make sure it's a valid bitmap (or whatever). Loading something like a .exe causes Paint to crash.
Load from file is heavily experimental. There is not much implemented at all.
Black_Fox wrote:You might have noticed that the mouse pointers in MSPaint have a white outline to make them more visible against a dark background.
In Windows Vista they haven't. Nevertheless it's a good idea.

I might have some time to work on it between Tuesday and Friday.
User avatar
EmuandCo
Developer
Posts: 4723
Joined: Sun Nov 28, 2004 7:52 pm
Location: Germany, Bavaria, Steinfeld
Contact:

Re: 1:1 MSPaint clone - not ? but !

Post by EmuandCo »

I added your Paint source to my local tree. Problems I see right now are that we don't include htmlhelp which makes problems in linking at winproc.c line 274. I commented it out and removed the ^ at the lines " "^N", IDM_IMAGEDELETEIMAGE, SHIFT, VIRTKEY" in all rc files. It dislikes the non ASCII character and does not build. Well. Now it does :-D

Needed RBUILD:

<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="paint" type="win32gui" installbase="system32" installname="paint.exe" allowwarnings="true">
<include base="paint">.</include>
<library>comdlg32</library>
<library>shell32</library>
<library>user32</library>
<library>gdi32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>comctl32</library>
<file>dialogs.c</file>
<file>dib.c</file>
<file>drawing.c</file>
<file>history.c</file>
<file>main.c</file>
<file>mouse.c</file>
<file>palette.c</file>
<file>selection.c</file>
<file>toolsettings.c</file>
<file>winproc.c</file>
<file>rsrc.rc</file>
</module>

Here the Warnings:
http://www.reactos.org/paste/index.php/4524/
ReactOS is still in alpha stage, meaning it is not feature-complete and is recommended only for evaluation and testing purposes.

If my post/reply offends or insults you, be sure that you know what sarcasm is...
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

It's nice to hear that it is somehow working. :) The next thing I'm going to do is fixing some of the makeshift implementations used in the load and save functions and monitoring and updating the canvas size in the undo/redo insertReversible etc. functions.
lollebol
Posts: 60
Joined: Tue Mar 17, 2009 6:15 pm
Location: Netherlands

Re: 1:1 MSPaint clone - not ? but !

Post by lollebol »

I have downloaded and tested your paint, gyROS,
and i must say i am impressed what you already have done!

Only one bug is when you have a pencil en you draw on the screen with holding left mouse mouse button for a while,
your program is freezing for a minute and then its working again... known bug?

Tested it on Windows 7 RC1 (build 7057)

Good luck on further development!

- lollebol
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

lollebol wrote:Only one bug is when you have a pencil en you draw on the screen with holding left mouse mouse button for a while,
your program is freezing for a minute and then its working again... known bug?
?!
Not at all. Well, if you told me that after a while of painting it is reliably crashing, that would have been a known bug. :roll:
But why doesn't the program crash? What's wrong with the bug? :shock:
Last edited by gyROS on Tue Mar 17, 2009 7:39 pm, edited 1 time in total.
Speedator
Posts: 136
Joined: Sat Jun 17, 2006 4:42 pm

Re: 1:1 MSPaint clone - not ? but !

Post by Speedator »

Don't worry. He's talking about Windows 7 RC1.
lollebol: DId you test paint from let's say Windows XP, too?
lollebol
Posts: 60
Joined: Tue Mar 17, 2009 6:15 pm
Location: Netherlands

Re: 1:1 MSPaint clone - not ? but !

Post by lollebol »

yes i have tested it few mintunes ago on windows xp on an older machine and i get the same result,
to recreate:

1. click on the pencil
2. inside the white screen
3. hold the left mouse button
4. go crazy and do what you like but stay inside the white screen
5. go on till you see the pencil doesn't draw lines anymore (around 20-30 sec?)
6. its freezed :(
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

I'm creating a new pen for every line a tool draws. But it should be deleted within the same (line-) function, so I don't know what causes the freeze.
Nintendo Maniac 64
Posts: 234
Joined: Sun Sep 17, 2006 3:08 am
Location: Northeast Ohio, USA

Re: 1:1 MSPaint clone - not ? but !

Post by Nintendo Maniac 64 »

lollebol wrote: 1. click on the pencil
2. inside the white screen
3. hold the left mouse button
4. go crazy and do what you like but stay inside the white screen
5. go on till you see the pencil doesn't draw lines anymore (around 20-30 sec?)
6. its freezed :(
HOLY CRAP. Doing this I end up with not a program freeze, but graphical errors. O_o The program SEEMED to still work, but nothing would happen. I was able to close it out normally and stuff without forcing an end task. Print Screen didn't work during the graphical errors, and if I tried to click a toolbar button, then print screen, I start getting errors and fullscreen graphical glitches.
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

Known bug, unknown reason. See above.
swight
Posts: 130
Joined: Thu Jan 10, 2008 10:31 pm

Re: 1:1 MSPaint clone - not ? but !

Post by swight »

I haven't tested this yet, but from the last few posts it might be a good idea to check if there is a gdi leak since this could cause a delayed graphical glitch. In case you don't know how to check for this type of leak one method is
1.open up the task manager
2.go to the view menu
3.go to Select Columns...
4.select GDI Objects from the list
5. watch the number in the new column and see how quickly it goes up(hopefully it will pretty much stay put).
The123king
Posts: 242
Joined: Mon Jun 16, 2008 6:51 pm

Re: 1:1 MSPaint clone - not ? but !

Post by The123king »

yeh, seems like a gdi object leak. I managed to rack up 4k objects after about 10 seconds pen drawing

And it seems to affect all the tools pretty much :|

After making it go up to about 10,000 gdi objects XP starts to throw up gbraphical error everywhere pretty much :?
gyROS
Posts: 199
Joined: Sun Nov 09, 2008 8:10 pm
Location: Deutschland

Re: 1:1 MSPaint clone - not ? but !

Post by gyROS »

Code: Select all

void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
{
    HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
    MoveToEx(hdc, x1, y1, NULL);
    LineTo(hdc, x2, y2);
    DeleteObject(SelectObject(hdc, oldPen));
}
It has to be somewhere in here. I just do not see, where... The Pen is created, selected into the DC, thrown out of the DC again and finally deleted. :|
jorl17
Posts: 83
Joined: Sun Sep 10, 2006 10:43 pm
Location: Coimbra, Portugal

Re: 1:1 MSPaint clone - not ? but !

Post by jorl17 »

Hi, I've been following your progress and I must say I admire your work.
It's been a while since I last did native windows programming and this may be totally wrong, still, I thought I should say something.

It seems you are creating a pen and not destroying it. And, if you read MSDN, they recommend you t DeleteObject on it. Maybe that is what you are doing with your last line of code, and maybe oldPen is your new pen, but then why are you calling it oldPen?

Excuse me if saying anything wrong, but I'm just throwing suggestions away.

Anyway, keep up the awesome work.
Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests