Author Topic: Paint Pixels 7 With JPG Saves And No Gaps In Drawing And Thicker Drawing!  (Read 4151 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
I had a blast updated this one year old project tonight! I finally have JPG saves and no gaps when drawing! I also made thicker drawing using my old .25 sz loops. :) The way I made no gaps was to use oldx and oldy that it draws the mouse coordinates to with a LINE command. And when the mouse isn't clicked, oldx and oldy becomes the mouse coordinates again so it won't draw a line from where you clicked before. I can't believe I figured this out finally. :)))
Last year B+ added the color picker screen which I kept. And pretty much everything else I kept. Here is the tech notes. Please tell me what you all think of this. It would be nice to figure out how to use the PAINT option to fill in places but I don't know how to do that using different colors as its borders. Does anyone know how?
The 3 needed files are in a zip file attached.
Thanks and Enjoy! 

Paint Pixels 7
by Sierraken and B+
Made on June 25, 2020
Technical Notes:
Changed from .bmp pictures to .jpg pictures.
Fixed the Drawing so that there's no gaps.
Fixed the Erasing so that there's no gaps.
Deleted tiny dot in center of orbits when turning them off.


EDIT NOTE: I just put a newer attachment zip file in because I forgot to change some simple text on the loading of the picture section. If yours says you cannot edit a picture, you actually can load and edit and save it.


Update: Huge memory issue found, please delete this version if you have it. Zip file has been removed.
« Last Edit: July 04, 2020, 05:20:03 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Quote
It would be nice to figure out how to use the PAINT option to fill in places but I don't know how to do that using different colors as its borders. Does anyone know how?

Dang! I always thought PAINT without border option filled out from whatever color it started out on that color only until it was stopped by any other color, but just tested and it does't. PAINT without border color option fills out to itself's color ie the PAINT's fill color is the border color. That's the usual way to make filled circles.

Can make a PAINT that fills out on the color it starts on until it hit's some other color, piece of cake, but would likely fill slower ie it checks the start color with POINT and PAINTs out only on that color. It's too late to dig around tonight I will find or make tomorrow, if Steve or someone else doesn't already have it by then.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Yeah I found something already mostly there:
Code: QB64: [Select]
  1. _TITLE "PAINT3 test" 'b+ 2020-06-26
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. _DELAY .25
  4. DIM i, mb, mx, my
  5. FOR i = 1 TO 50
  6.     LINE (RND * 800, RND * 600)-(RND * 800, RND * 600), _RGB32(RND * 255, RND * 255, RND * 255, 128 + RND * 128)
  7.     CIRCLE (RND * 800, RND * 600), RND * 50 + 10, _RGB32(RND * 255, RND * 255, RND * 255, 128 + RND * 128)
  8.     mx = _MOUSEX: my = _MOUSEY: mb = _MOUSEBUTTON(1)
  9.     IF mb THEN paint3 mx, my, &HFFFFFFFF
  10.      _LIMIT 200
  11.  
  12. SUB paint3 (x0, y0, fill AS _UNSIGNED LONG) ' needs max, min functions
  13.     DIM fillColor AS _UNSIGNED LONG, W, H, parentF, tick, ystart, ystop, xstart, xstop, x, y
  14.     fillColor = POINT(x0, y0)
  15.     'PRINT fillColor
  16.     W = _WIDTH - 1: H = _HEIGHT - 1
  17.     DIM temp(W, H)
  18.     temp(x0, y0) = 1: parentF = 1
  19.     PSET (x0, y0), fill
  20.     WHILE parentF = 1
  21.         parentF = 0: tick = tick + 1
  22.         ystart = max(y0 - tick, 0): ystop = min(y0 + tick, H)
  23.         y = ystart
  24.         WHILE y <= ystop
  25.             xstart = max(x0 - tick, 0): xstop = min(x0 + tick, W)
  26.             x = xstart
  27.             WHILE x <= xstop
  28.                 IF POINT(x, y) = fillColor AND temp(x, y) = 0 THEN
  29.                     IF temp(max(0, x - 1), y) THEN
  30.                         temp(x, y) = 1: parentF = 1: PSET (x, y), fill
  31.                     ELSEIF temp(min(x + 1, W), y) THEN
  32.                         temp(x, y) = 1: parentF = 1: PSET (x, y), fill
  33.                     ELSEIF temp(x, max(y - 1, 0)) THEN
  34.                         temp(x, y) = 1: parentF = 1: PSET (x, y), fill
  35.                     ELSEIF temp(x, min(y + 1, H)) THEN
  36.                         temp(x, y) = 1: parentF = 1: PSET (x, y), fill
  37.                     END IF
  38.                 END IF
  39.                 x = x + 1
  40.             WEND
  41.             y = y + 1
  42.         WEND
  43.     WEND
  44.  
  45. FUNCTION min (n1, n2)
  46.     IF n1 > n2 THEN min = n2 ELSE min = n1
  47.  
  48. FUNCTION max (n1, n2)
  49.     IF n1 < n2 THEN max = n2 ELSE max = n1
  50.  
  51.  
PAINT3 test.PNG
* PAINT3 test.PNG (Filesize: 45.61 KB, Dimensions: 803x629, Views: 219)
« Last Edit: June 26, 2020, 03:52:30 am by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Thank you B+! I added that to Paint Pixels 7 and also let the user pick from 5 different screen sizes to draw on: 320 x 240, 640 x 480, 800 x 600, 1024 x 768, and 1536 x 1024.
Here is the updated zip file. Check it out! I also added a picture below of a fill-in example.



Scene1.jpg
* Scene1.jpg (Filesize: 49.38 KB, Dimensions: 801x601, Views: 199)
* Paint Pixels 7.zip (Filesize: 22.47 KB, Downloads: 150)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Good it's working for you!

That is an obvious 3rd way to do PAINT! :)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
I've been working all day on this and have added a JPG file list on your Notepad when you just press Enter and nothing else in the Load section. At first I tried the Wiki open and save files window example but it froze the program for some reason, like Scotty on Star Trek says, "She just can't take it anymore Captain!" So I removed that and went with the Notepad temp .txt file example using the SHELL commands. I also decided to remove the sounds and fixed one or two minor things. Here is the latest update for Paint Pixels 7 again. I might not add anything else for awhile. The updated zip file is in the attachment. I also decided to show off what this little program can do. I found a real nice lake picture online and added a boat with this. lol I added it below too. The program calculates the size of the picture and resizes the screen to show and edit it. 
* Paint Pixels 7.zip (Filesize: 22.63 KB, Downloads: 164)
boatinlake.jpg
* boatinlake.jpg (Filesize: 269.18 KB, Dimensions: 801x481, Views: 226)

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Wow! From "Scene1" to a Mountain vista in one day!... Then I opened the thumbnail... "boatinlake"... *sigh*

She looks like a sturdy craft, Captain! A fine vessel. A credit to the designing shipyard. Oh... and the scenery is ok as well...
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Johnno, logic would assume I was no artist to begin with. :D
But thanks, was a good project today. :)

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
"no artist to begin with"? I disagree... I can create planets, star fields, nebulae, restore old photos etc using Gimp... But, I can assure you that, your free hand drawing is a 'Michelangelo' compared to my 'crayon' skills... You are too modest....

Just realized.... It's lunchtime and I have had only one coffee... Best correct that before my circulatory system thinks it is being 'weaned'...
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
LOL Thanks.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
@SierraKen

If you'd like to try a really nice Filename Dialog for Windows I set up a little demo for what Petr and Spriggsy had worked out, looks quite professional. Then Spriggsy helped with syntax of files masks.

File Dialog demo
https://www.qb64.org/forum/index.php?topic=2702.msg119702#msg119702

a couple of replies up are the .BI (include at start) and .BM files (include at the end of your code after subs).

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Awesome B+! I got it to Open new pictures perfectly, but I can't find the right dialog for some reason to Save them. I replied to that other thread you mentioned here:

https://www.qb64.org/forum/index.php?topic=2702.15


Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Hi Ken
this your program have made steps towards on!

I hope that my feedbacks are useful:

1.Splashscreen in opening:
can I suggest to use different frames or colors to separate the logical sections of Opening Splashscreen?
 
paint_pixel_6_7.jpg


2. Color setting:
can the user get more informations about how to use the Color Setting window?
What is the box with gradients at bottom?
How can I use them?
 
PaintPixel7_colorsetting.png


3.
It is not clear for me new beginner user that with the keyboard I can select the action to do and with mouse I can only draw.  Moreover I have learned after attempts that I must press  keyboard to select and then again to UNselect the same tool/action

4.
It is not clear for me new beginner user that to draw an Orbit first I must put the pointer of mouse in the place where is the center of the Orbit that I want draw, and I must press key "O"
In other program you select the tool and then you click to start drawing it and then drag until releasing the button of mouse to stop drawing.

5.
I start to Draw a line with free hand, then I try to draw a Rays and magically the thickness of the line is very different! 
 5.1 Why not the same thickness of line?
 5.2 How to increase /decreadse the thickness of the line drawn?
 
paintPixel7_DrawVSRays.jpg
« Last Edit: June 27, 2020, 03:22:56 am by TempodiBasic »
Programming isn't difficult, only it's  consuming time and coffee

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Thanks TempodiBasic, but I am sticking with what I have now and getting the "meat" of it finished before I round off the details. I did think of the rays already though, I don't know if I can make them thicker or not. But I'll think of all what you said on your post.
Oh, and the bottom part of the color picker screen you can't use, it's just examples in colors that are close to what you draw with. B+ would know more about it since he made it.
« Last Edit: June 27, 2020, 11:40:42 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
I fixed the Windows Open and Save File Dialogue! Now you can open a picture and save a picture using the regular Windows way. It just needed to add an extension to the name it chooses for it to Save, and also even for it to be Saved in the right directory. Without adding the extension, it would putting the files in the Windows User directory in the Recent folder, without the .jpg extension. lol
I also just now added an IF/THEN to it to make sure the user didn't already add the extension to the name when it saves, before it adds the extension automatically.
Below is the updated attachment zip with 4 library files and 1 .bas file.



Update: Huge memory issue found, please delete this version if you have it. Zip file has been removed.
« Last Edit: July 04, 2020, 05:20:27 pm by SierraKen »