Recent

Author Topic: Pixeling  (Read 2222 times)

GEAR_2012

  • Newbie
  • Posts: 2
Pixeling
« on: October 14, 2018, 03:56:59 pm »
Hi.

Can anyone help to me?
I need a turbo pascal code to coloring the screen to a choosen color randomly by pixel by pixel.  My problem is how do not put pixel to there where already I have.

Sorry for my poor english.
Thanks for any answer.


jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Pixeling
« Reply #1 on: October 14, 2018, 04:10:41 pm »
If you are trying to save CPU time, you aren't going to gain much, actually you may even cause more delay because you
would need to first test what is there currently before writing a new value...

 Or could it be you need to simply address the points in a loop manner ?

 For X := 0 to 320 do
   For Y := 0 to 240 do
      SetColor(X,Y, Random(…..));

 That is just a conceptional thought.
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: Pixeling
« Reply #2 on: October 14, 2018, 04:22:19 pm »
You mean something like flood fill? https://en.wikipedia.org/wiki/Flood_fill

GEAR_2012

  • Newbie
  • Posts: 2
Re: Pixeling
« Reply #3 on: October 14, 2018, 09:32:31 pm »
How can I check if the pixel is already colored?

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Pixeling
« Reply #4 on: October 14, 2018, 10:43:36 pm »
How can I check if the pixel is already colored?

It depends on quite a lot of things, among them: What OS is it for? Console app or GUI? What pixel type? Direct access to screen or through library code? If library, which one? How are you coloring the pixels? etc., etc.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: Pixeling
« Reply #5 on: October 14, 2018, 11:03:22 pm »
Maybe use "paint" program. (And screen shot)
Draw an example what it looks at start.
And then what you want it to look after.

 

TinyPortal © 2005-2018