View Single Post
Old 11-25-2012, 05:50 PM
surfR2911 surfR2911 is offline
Join Date: Oct 2009
Posts: 719
Default PNoiz2 with tinting and pixel patterning presets

I have been working at making the PNoiz from last post more "developer friendly",
so that instead of commenting and uncommenting code to get different effects you can just use presets.

The blue sky cloud preset took a long time to develop (and is entirely new to this most recent PNoiz2 class version).
In doing so I had a need to use Lockbits marshaling to check various color thresholds on a per pixel basis.

I thought I would be able to use boops boops FastPix library library to do this.
But after working with it to mesh based graphic image deformations in the ImageWarper thread,
I came to the conclusion it would take just as long to extend the PNoiz class
as it would to modify the FastPix class to do what I needed.

Plus there is the advantage of having everything in one class, all "neat and tidy".

No disrespect to the FastPix code - it works great as a simple uncomplicated wrapper
for GetPixel/SetPixel (which is exactly what it was designed to do).

The new ChangePixels sub code is quite flexible.
You feed it a bitmap as the sole parameter and it modifies the colors of individual pixels
by loading them into an separate color array (away from the weird scan0/stride data array that LockBits uses).

I can also see it being able to create procedural texture patterns by using
matrix transform rotation overlays of images generated by fractal code.

Such a sub also facilitates integrating some TPL-based Parallel.For coding in a possible future enhancement..

Of course right now I'm thorough disgusted with the idea of going any deeper into using multi-threading,
based on what went on in the Sprite-as-what? thread.

I had to take a break..and that's why I why I decided to spend several hours today
working on PNoiz2 for to see if I could get some "post-able".

The attachment to post #65 hasn't gotten many "views" (downloads) thus far,
so maybe I'm just wasting my time, but my time has very little value anyway (),
and hopefully the presets version will be greeted better (maybe a couple downloads over the next few years).

Here's the form code that has all the presets so far:
Public Class Form1
Private PNoizDrawer As New PNoiz2
Private strPresetString As String
Private Sub Form1_Activated(sender As Object, e As System.EventArgs) Handles Me.Activated
Me.BackgroundImage = PNoizDrawer.PNoizBmp
End Sub
Private Sub Form1_Click(sender As Object, e As System.EventArgs) Handles Me.Click
Me.BackgroundImage = PNoizDrawer.PNoizBmp
End Sub
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'strPresetString = "1" 'Default light grey perlin
'strPresetString = "2" 'Default light bluish-purplish perlin
'strPresetString = "3" 'Default light red perlin
'strPresetString = "4" 'Default light green tinted perlin noise

'strPresetString = "5" 'Default medium grey perlin noise
'strPresetString = "6" 'Default medium blu-ish purple tinted perlin noise
'strPresetString = "7" 'Default medium red tinted perlin noise
'strPresetString = "8" 'Default medium green tinted perlin noise

'strPresetString = "9" 'Default medium magenta tinted perlin noise
'strPresetString = "10" 'Default medium yellow tinted perlin noise
'strPresetString = "11" 'Default medium cyan tinted perlin noise
'strPresetString = "12" 'Default medium orangish-brown tinted perlin noise

'strPresetString = "13" 'Default dark grey perlin noise
'strPresetString = "14" 'Default dark blue tinted perlin noise
'strPresetString = "15" 'Default dark red tinted perlin noise
'strPresetString = "16" 'Default dark green tinted perlin noise

'strPresetString = "17" 'Default dark magenta tinted perlin noise
'strPresetString = "18" 'Default dark orangish-brown tinted perlin noise
'strPresetString = "19" 'Default dark cyan tinted perlin noise
'strPresetString = "20" 'Default dark yellow tinted perlin noise

'strPresetString = "21" 'Default/preset for perlin noise shaped into blue sky
strPresetString = "Sampler" 'Default to show all samples of all presets
End Sub
End Class
Note: Depending on the perlin noise tinting scheme used,
the texturebrush style hollow outline text from post #61 above can
sometimes provide more of a stand-out contrast than outputting text as a mere DrawString.
I would also recommend using the boops boops' "Demo2.txt" code,
(for doing single point perspective 3D shadowed text) attached to here.
Attached Images
File Type: jpg screenshot_sampler_for_PNoiz2_presets.JPG (43.5 KB, 10 views)
Attached Files
File Type: zip (25.9 KB, 4 views)

Last edited by surfR2911; 11-25-2012 at 06:17 PM.
Reply With Quote