April 02, 2020, 10:07:09 AM

Author Topic: ReadPixel WritePixel speed  (Read 867 times)

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 476
Re: ReadPixel WritePixel speed
« Reply #30 on: March 03, 2020, 01:34:40 PM »
Ok, I just added a "reach" parameter to the code.  Now it will extract the tiles correctly. :) :)
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #31 on: March 03, 2020, 04:08:11 PM »
Here is my last version..
Im planning to add more PNG Tools..
Also Im about to make Also Option to Turn a non Transparent Tile Set that will turn it into a PNG.
Thats pretty easy to do now that main thing is done..

Im simply too busy lately to put a lot of coding effort.. so ill take my time..

but its definitely gonna be faster than my damn game editor.

I started this process because i needed that for my editor..

https://drive.google.com/file/d/158pkbR3xtRHDXpUgcWjJJXCTooK5x3x2/view?usp=sharing

Ive Started with Xors so im not about to move the normal blitzmax..
I dont have the powers..


if anyone improved that code that i posted ill be glad to have it :)

This is the last code..

Code: [Select]
Type TilesSpliter_Section

    Field TitleuN_bt = alCreateGScrollArea(alDesktop, "", 0, 30, 300, 30, 0)
Field Title_bt = Alba.CreateButtonWithImage_al(alDesktop, AppURL + "Media\TileSetSplitter.png", -2, 27, 300, 30)

Field Roller_Area = alCreateGScrollArea(alDesktop, "", 300, 30, 480, 30, 0)
Field LoadTileSet_bt = alCreateGButton(Roller_Area, "LoadTileSet", -2, -3, 100, 30)
Field Convert_bt = alCreateGButton(Roller_Area, "ConvertToPNGS", 128, -3, 115, 30)
    Field SelectEmptySpace_bt = alCreateGButton(Roller_Area, "SelectBackGroundPixel", 270, -3, 170, 30)

   'Versions
   'Field Version_roller = alCreateGScrollArea(alDesktop, "", 780, 30, 130, 30, 0)
Field LiteVersion_Logo = Alba.CreateButtonWithImage_al(alDesktop, "Media/LiteVersion.png", 780, 30, 100, 30, True)
Field FullVersion_Logo = Alba.CreateButtonWithImage_al(alDesktop, "Media/FullVersion.png", 780, 30, 100, 30, True)

Field ForceStop_bt = alCreateGButton(alDesktop, "ForceStop", xsize / 2 - 50, ysize / 2 - 50, 130, 30)

Field Original_Win = alCreateGScrollArea(alDesktop, "", 0, 60, 880, 410)
Field ImageButton

   'Field OutPut_win = alCreateGScrollArea(alDesktop, "", 880, 60, 400, 560)

Field OutputURL:String = "Output\"

Field PNGTileSETURF:String
Field TilesetImageHandle
Field TempNegativeImageHandle
Field Pixel[,]
Field Images[]
Field NewImageName:String

  Const UnChecked = 0
  Const OccupiedPix = 1

   '----------------'
    Field CurrentSection = Section_Normal
Const Section_Normal = 0
Const Section_ChoosePixel = 1

Method New()

alHide(ForceStop_bt)

Alba.SetElementColorBack(Original_Win, Alba.Color_Gray1)
Alba.SetElementColorBack(TitleuN_bt, Alba.Color_Brown)
Alba.SetElementColorBack(ForceStop_bt, Alba.Color_red)

Alba.SetRemark(LoadTileSet_bt, "Load A Tileset Single PNG and Turn it to Seperate PNGS")
Alba.SetRemark(Convert_bt, "Convert The Loaded Image To Seperate PNG's")

   'Version Logo
If DemoVersion_flg = False Then
alHide(LiteVersion_Logo)
Else
alHide(FullVersion_Logo)
End If

End Method

Method Play()

Select CurrentSection

Case Section_Normal

       'Load PNG TileSet
If alTestClick(TS.LoadTileSet_bt) Then
Local TmpImageHandle
PNGTileSETURF = RequestFile("Select PNG TileSet")
NewImageName = StripAll(PNGTileSETURF)
TmpImageHandle = xLoadImage(PNGTileSETURF)
If TmpImageHandle > 0 Then
ClearAll()
TilesetImageHandle = TmpImageHandle
alShow(Convert_bt)
ImageButton = Alba.CreateButtonWithImage_al(Original_Win, TS.PNGTileSETURF, 5, 5, 850, 540, True) ; UpdateGraphics()
If IsPNG(TmpImageHandle) = False Then PixelSelectProcess()
End If
End If

   'Convert to Seperated Pngs
    If alTestClick(Convert_bt) Then
If TS.TilesetImageHandle > 0 Then

ClearConsol()
ConsoleMessage("Converting Began, Please Wait")
alShow(ForceStop_bt) ; alOnTop(ForceStop_bt)

    'Free! Variables

TS.Pixel = Null
  TS.Pixel = New Int[xImageWidth(TS.TilesetImageHandle) , xImageHeight(TS.TilesetImageHandle)]

ClearFolder(OutputURL)
 
For Local Image = EachIn images
xFreeImage(Image)
Next

     Images = Null
     Images = New Int[0]

'Create Negative Mask
ConsoleMessage("Creating Negative")
TempNegativeImageHandle = xCreateImage(xImageWidth(TS.TilesetImageHandle), xImageHeight(TS.TilesetImageHandle))
BuildEmptySpacesField(TS.TilesetImageHandle,,, True)

'Read PNGS
ConsoleMessage("Extracting PNGS")
Images = TS.ReadAllPngs(TS.TilesetImageHandle, TS.Pixel)
ConsoleMessage("~nConvertion Over")

    'Save Images
Local URL:String = OutputURL, Counter
For Local Image = EachIn Images
Counter = Counter + 1
xSaveImage(Image, URL + NewImageName + " " + Counter + ".png")
xFreeImage(Image)
Next

alHide(Convert_bt)
alHide(ForceStop_bt)

OpenURL(OutputURL)

End If
    End If

   'Open OutputURL
If alTestClick(GotoFolder_TA) Then OpenURL(OutputURL)

Case Section_ChoosePixel

End Select

End Method

'------------------------------Sub Commands------------------------------------'

Method ReadPNG(ImageHandle, CurrentX = 0, CurrentY = 0, Pixel[,] Var)
Local X, Y, StartX, StartY, NewPixel[ximagewidth(imagehandle), ximageheight(imagehandle)]
Local LeftX, RightX, UpY, DownY

   'Start
Local Coords:Coords_Class = New Coords_Class
Coords = GetFirstEmptyPoint(ImageHandle, Pixel)
If Coords.X = -1 Then Return 'End Of Trace
StartX = Coords.X
StartY = Coords.Y
LeftX = StartX
RightX = StartX
UpY = StartY
DownY = StartY
    NewPixel[StartX, StartY] = OccupiedPix 'A Must
    Pixel[StartX, StartY] = OccupiedPix    'Not Certain
Coords = Null

   'Left To Right
For Y = StartY To xImageHeight(ImageHandle) - 1

For X = 0 To xImageWidth(ImageHandle) - 1

   'Is UnChecked
If Pixel[X, Y] = UnChecked Then
If HasAnOccupiedPointAroundHim(ImageHandle, X, Y, NewPixel) = True Then
If X < LeftX Then LeftX = X
If X > RightX Then RightX = X
If Y < UpY Then UpY = Y
If Y > DownY Then DownY = Y
Pixel[X, Y] = OccupiedPix
NewPixel[X, Y] = OccupiedPix
End If
End If

   'ForceStop
If ForceStopFlg = True Then Return

TimedUpdateGraphics()

Next

Next

   'Right To Left And Down To Up
For Y = xImageHeight(ImageHandle) - 1 To 0 Step - 1

For X = xImageWidth(ImageHandle) - 1 To 0 Step - 1

   'Is Empty
If Pixel[X, Y] = UnChecked Then
If HasAnOccupiedPointAroundHim(ImageHandle, X, Y, NewPixel) = True Then
If X < LeftX Then LeftX = X
If X > RightX Then RightX = X
If Y < UpY Then UpY = Y
If Y > DownY Then DownY = Y
Pixel[X, Y] = OccupiedPix
NewPixel[X, Y] = OccupiedPix
End If
End If

   'ForceStop
If ForceStopFlg = True Then Return
TimedUpdateGraphics()

Next

Next

   'Up To Down  [All Seems To Work]
For X = 0 To xImageWidth(ImageHandle) - 1

For Y = 0 To xImageHeight(ImageHandle) - 1

   'Is Empty
If Pixel[X, Y] = UnChecked Then
If HasAnOccupiedPointAroundHim(ImageHandle, X, Y, NewPixel) = True Then
If X < LeftX Then LeftX = X
If X > RightX Then RightX = X
If Y < UpY Then UpY = Y
If Y > DownY Then DownY = Y
Pixel[X, Y] = OccupiedPix
NewPixel[X, Y] = OccupiedPix
End If
End If

   'ForceStop
If ForceStopFlg = True Then Return
TimedUpdateGraphics()

Next

Next

   'Down To Up
For X = 0 To xImageWidth(ImageHandle) - 1

For Y = xImageHeight(ImageHandle) - 1 To 0 Step - 1

   'Is Empty
If Pixel[X, Y] = UnChecked Then
If HasAnOccupiedPointAroundHim(ImageHandle, X, Y, NewPixel) = True Then
If X < LeftX Then LeftX = X
If X > RightX Then RightX = X
If Y < UpY Then UpY = Y
If Y > DownY Then DownY = Y
Pixel[X, Y] = OccupiedPix
NewPixel[X, Y] = OccupiedPix
End If
End If

   'ForceStop
If ForceStopFlg = True Then Return
TimedUpdateGraphics()

Next

Next

   'Write The Image
Local NewImage = Xcreateimage (RightX - LeftX, DownY - UpY)
For Y = UpY To DownY
For X = LeftX To RightX

If NewPixel[X, Y] = OccupiedPix Then xWritePixel(X - LeftX, Y - UpY, xReadPixel(X, Y, xImageBuffer(ImageHandle)), xImageBuffer(NewImage))

   'ForceStop
If ForceStopFlg = True Then Return
TimedUpdateGraphics(50)

Next
Next

Return NewImage
End Method

Method ReadAllPngs[] (ImageHandle, Pixel[,] Var)
Local Image[], NewImage, Counter

Repeat

NewImage = ReadPNG(ImageHandle,,, Pixel)
If NewImage = 0 Then
Return Image 'End Of Cycles
Else
Image = Image +[NewImage]
End If

Counter = Counter + 1
    ConsoleMessage("Image Num " + Counter, False)
If Counter > 500 Then Return 'Max Limit

   'Demo Version
If DemoVersion_flg = True Then
If Counter >= LimitingOutput_Val Then
Notify ("Free Version allows only up to 10 Images extraction")
Return Image
End If
End If

   'Force Stop
If ForceStopFlg = True Then Return Image

Forever

End Method

Method HasAnOccupiedPointAroundHim(ImageHandle, X, Y, Pixel[,] Var)

   'Checks Left Pixel
If X > 0 And Pixel[X - 1, Y] = OccupiedPix Then Return True

   'Checks Right Pixel
If X < xImageWidth(ImageHandle) - 1 And Pixel[X + 1, Y] = OccupiedPix Then Return True

   'ChecksUpPixel
If Y > 0 And Pixel[X, Y - 1] = OccupiedPix Then Return True

   'ChecksDownPixel
If Y < xImageHeight(ImageHandle) - 1 And Pixel[X, Y + 1] = OccupiedPix Then Return True

   'LeftUpPixelIsOccupied
If X > 0 And Y > 0 And Pixel[X - 1, Y - 1] = OccupiedPix Then Return True

   'RightUpPixelIsOccupied
If X < xImageWidth(ImageHandle) - 1 And Y > 0 And Pixel[X + 1, Y - 1] = OccupiedPix Then Return True

   'DownLeftPixelIsOccupied
If X > 0 And Y < xImageHeight(ImageHandle) - 1 And Pixel[X - 1, Y + 1] = OccupiedPix Then Return True

   'DownRightPixelIsOccupied
If X < xImageWidth(ImageHandle) - 1 And Y < xImageHeight(ImageHandle) - 1 And Pixel[X + 1, Y + 1] = OccupiedPix Then Return True

End Method

Method GetFirstEmptyPoint:Coords_Class(ImageHandle, Pixel[,] Var)
Local X, Y, CRDS:Coords_Class

CRDS = New Coords_Class

For Y = 0 To xImageHeight(ImageHandle) - 1
For X = 0 To xImageWidth(ImageHandle) - 1
If Pixel[X, Y] = UnChecked Then
CRDS.X = X
CRDS.Y = Y
Return CRDS
End If
Next
Next

   'NotFound
CRDS.X = -1
End Method

Method BuildEmptySpacesField(ImageHandle, CurrentX = 0, CurrentY = 0, Start = False)
Local X, Y, StartX, StartY

   'Start
If Start = True Then
Local Coords:Coords_Class = New Coords_Class
Coords = GetFirstEmptyPixel(ImageHandle)
StartX = Coords.X
StartY = Coords.Y
Pixel[StartX, StartY] = OccupiedPix
Coords = Null
End If

   'Left To Right
For Y = StartY To xImageHeight(ImageHandle) - 1

For X = StartX To xImageWidth(ImageHandle) - 1

   'Is Empty
If PixelIsOccupied(xReadPixel(X, Y, xImageBuffer(ImageHandle))) = False Then
If HasAnEmptyPixelAroundHim(ImageHandle, X, Y) = True Then
Pixel[X, Y] = OccupiedPix
End If
End If

TimedUpdateGraphics()

Next

Next

   'Right To Left
For Y = xImageHeight(ImageHandle) - 1 To 0 Step - 1

For X = xImageWidth(ImageHandle) - 1 To 0 Step - 1

   'Is Empty
If PixelIsOccupied(xReadPixel(X, Y, xImageBuffer(ImageHandle))) = False Then
If HasAnEmptyPixelAroundHim(ImageHandle, X, Y) = True Then
Pixel[X, Y] = OccupiedPix
End If
End If

TimedUpdateGraphics()

Next

Next

   'Up To Down
For X = 0 To xImageWidth(ImageHandle) - 1

For Y = 0 To xImageHeight(ImageHandle) - 1

   'Is Empty
If PixelIsOccupied(xReadPixel(X, Y, xImageBuffer(ImageHandle))) = False Then
If HasAnEmptyPixelAroundHim(ImageHandle, X, Y) = True Then
Pixel[X, Y] = OccupiedPix
End If
End If

TimedUpdateGraphics()

Next

Next

   'Down To Up
For X = 0 To xImageWidth(ImageHandle) - 1

For Y = xImageHeight(ImageHandle) - 1 To 0 Step - 1

   'Is Empty
If PixelIsOccupied(xReadPixel(X, Y, xImageBuffer(ImageHandle))) = False Then
If HasAnEmptyPixelAroundHim(ImageHandle, X, Y) = True Then
Pixel[X, Y] = OccupiedPix
End If
End If

Next

TimedUpdateGraphics()

Next

End Method

Method HasAnEmptyPixelAroundHim(ImageHandle, X, Y)

   'Checks Left Pixel
If LeftPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X - 1, Y] = OccupiedPix Then Return True

   'Checks Right Pixel
If RightPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X + 1, Y] = OccupiedPix Then Return True

   'ChecksUpPixel
If UpPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X, Y - 1] = OccupiedPix Then Return True

   'ChecksDownPixel
If DownPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X, Y + 1] = OccupiedPix Then Return True

   'LeftUpPixelIsOccupied
If LeftUpPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X - 1, Y - 1] = OccupiedPix Then Return True

   'RightUpPixelIsOccupied
If RightUpPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X + 1, Y - 1] = OccupiedPix Then Return True

   'DownLeftPixelIsOccupied
If DownLeftPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X - 1, Y + 1] = OccupiedPix Then Return True

   'DownRightPixelIsOccupied
If DownRightPixelIsOccupied(ImageHandle, X, Y) = False And Pixel[X + 1, Y + 1] = OccupiedPix Then Return True

End Method

'------------------Check If Pixel Is Occupied----------------------'

'LeftPixelIsOccupied
Method LeftPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX > 0 Then
Return PixelIsOccupied(xReadPixel(CurrentX - 1, CurrentY, xImageBuffer(ImageHandle)))
Else
Return - 1
End if
End Method

'RightPixelIsOccupied
Method RightPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX < xImageWidth(ImageHandle) Then
Return PixelIsOccupied(xReadPixel(CurrentX + 1, CurrentY, xImageBuffer(ImageHandle)))
Else
Return - 1
End If
End Method

'UpPixelIsOccupied
Method UpPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentY > 0 Then
Return PixelIsOccupied(xReadPixel(CurrentX, CurrentY - 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End If
End Method

'DownPixelIsOccupied
Method DownPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentY < xImageHeight(ImageHandle) Then
Return PixelIsOccupied(xReadPixel(CurrentX, CurrentY + 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End If
End Method

'LeftUpPixelIsOccupied
Method LeftUpPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX > 0 And CurrentY > 0 Then
Return PixelIsOccupied(xReadPixel(CurrentX - 1, CurrentY - 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End if
End Method

'RightUpPixelIsOccupied
Method RightUpPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX < xImageWidth(ImageHandle) And CurrentY > 0 Then
Return PixelIsOccupied(xReadPixel(CurrentX + 1, CurrentY - 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End if
End Method

'DownLeftPixelIsOccupied
Method DownLeftPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX > 0 And CurrentY < xImageHeight(ImageHandle) Then
Return PixelIsOccupied(xReadPixel(CurrentX + 1, CurrentY + 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End If
End Method

'DownRightPixelIsOccupied
Method DownRightPixelIsOccupied(ImageHandle, CurrentX, CurrentY)
If CurrentX < xImageWidth(ImageHandle) And Currenty < xImageHeight(ImageHandle) Then
Return PixelIsOccupied(xReadPixel(CurrentX + 1, CurrentY + 1, xImageBuffer(ImageHandle)))
Else
Return - 1
End If
End Method

'----------------------------------------'

Method GetFirstOccupiedPoint:Coords_Class(Image)
Local I, J, CRDS:Coords_Class, Pixel

CRDS = New Coords_Class

For I = 0 To xImageWidth(Image) - 1
For J = 0 To xImageHeight(Image) - 1
Pixel = xReadPixel(I, J, xImageBuffer(Image))
If Pixel <> PNGPixelValue And Pixel <> 0 Then
CRDS.X = I
CRDS.Y = J
Return CRDS
End If
Next
Next

End Method

Method GetFirstEmptyPixel:Coords_Class(Image)
Local I, J, CRDS:Coords_Class, Pixel

CRDS = New Coords_Class

For I = 0 To xImageWidth(Image) - 1
For J = 0 To xImageHeight(Image) - 1
Pixel = xReadPixel(I, J, xImageBuffer(Image))
If Pixel = PNGPixelValue Or Pixel = 0 Then   'Or Pixel = 3750201  'not sure about the 0
CRDS.X = I
CRDS.Y = J
Return CRDS
End If
Next
Next

End Method

Method PixelIsOccupied(Pixel)
Return Pixel <> PNGPixelValue And Pixel <> 0 'And Pixel <> 3750201
End Method

Method ClearAll()
   'Alba.ClearElement(Consol_Win)
If TilesetImageHandle > 0 Then xFreeImage(TilesetImageHandle) ;TilesetImageHandle = 0
If ImageButton > 0 Then alFreeElement(ImageButton) ; ImageButton = 0
End Method

 '------------------------------------------------------------'
 
    Field ZoomPixImage = xcreateimage(15, 15)

Method PixelSelectProcess()
Repeat
   'Local X, Y
   'xWritePixel(X, Y, $ffffffff, xImageBuffer(ZoomPixImage) xImageColor(
   'xImageColor(ZoomPixImage, $ff, $ff, $ff)
    If Alba.MouseOverElementArea(Original_Win) Then ShowThisIcon = Cross_Ico
BlinkQuickMessage("PLEASE SELECT BACKGROUND PIXEL")
   'ConsoleMessage("[This Image is not a PNG, Please Select a background Pixel]")
UpdateGraphics()
If xKeyHit(xKEY_ESCAPE) Then Exit
Forever

   'Add Zoom Pixel So You can Choose Well

End Method

End Type

Type Coords_Class
Field X
Field Y
End Type

Type PixelCounter_Class
Field Value
Field Amount
End Type





Happy New Year

Offline Derron

  • Hero Member
  • *****
  • Posts: 2818
Re: ReadPixel WritePixel speed
« Reply #32 on: March 03, 2020, 04:26:07 PM »
You can simply use the code of TomToad without affecting your Xors-stuff.

Just
Import brl.pixmap

and you gain access to LoadPixmap and TPixmap. if you need to load a PNG: import brl.pngloader


bye
Ron

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #33 on: March 03, 2020, 05:54:57 PM »
Ok derron ill check it thanks
Happy New Year

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #34 on: March 09, 2020, 07:29:58 PM »
hi.. can anyone have to algorithm of turning a color pixel into a gray pixel in order to turn a color image into black and white image?
Im experimenting as we speak.. but im not sure im doing the algorithm right, so better ask.

when i read a pixel value i sometimes get a negative number..
so whats that means? and can i overcome it and turn all numbers into positive values for comparison
Happy New Year

Offline Derron

  • Hero Member
  • *****
  • Posts: 2818
Re: ReadPixel WritePixel speed
« Reply #35 on: March 09, 2020, 08:08:39 PM »
Read the integer value of the pixel color - split it into RGBA and use the algorithm of your choice to create grayscale versions of it.

There are different approaches as the conversion is using a kind of "perceived color" approach.
You could for example convert RGB into HSL and then set the "S" (saturation) to 0 and convert back your HSL to RGB.

Or you can use CIE_Lab colors which use a more psychological/pereceived color approach for "color distances". Easiest bet with satisfying results though, is the HSL<->RGB thing.

Algorithms can be found here:
https://github.com/GWRon/Dig/blob/master/base.util.color.bmx

It also lists the "not so good but still working":
Code: BlitzMax
  1.         'faster than using the RGB-HSL-RGB conversion
  2.         'but results are not exactly the same
  3.         Method AdjustSaturationRGB:TColor(percentage:Float = 0.0)
  4.                 'convert relative param to absolute param
  5.                 percentage = 1.0 + percentage
  6.                 'long
  7.                 local luminance:float = sqr(0.299 * r*r + 0.587 * g*g + 0.114 * b*b)
  8.                 r = Min(255, Max(0, luminance + (r - luminance) * percentage))
  9.                 g = Min(255, Max(0, luminance + (g - luminance) * percentage))
  10.                 b = Min(255, Max(0, luminance + (b - luminance) * percentage))
  11.                 return self
  12.         End Method
  13.  


bye
Ron

Online Matty

  • Hero Member
  • *****
  • Posts: 923
    • MattiesGames
Re: ReadPixel WritePixel speed
« Reply #36 on: March 10, 2020, 03:09:37 AM »
The absolute easiest way once you split the rgb into components is to do this:

(R + G + B)/3 is the new value for r,g and b.

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #37 on: March 10, 2020, 07:01:46 AM »
ok.. Thanks Derron and Matty
Happy New Year

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #38 on: March 10, 2020, 08:55:27 PM »
Ok ive solved my write pixel speed problem..
all i needed to do is to use lockbuffer than use command called writepixelfast and than unlock buffer again..

that was all the issue. cheers
Happy New Year

Offline takis76

  • Jr. Member
  • **
  • Posts: 96
Re: ReadPixel WritePixel speed
« Reply #39 on: March 15, 2020, 12:17:18 AM »
@Hardcoal

Hello,
I saw your little program and I have one unrelated question.
Which library are you using for your GUI? I am interested in the GUI library if I will use it for my game.
Is this supposed to be programmed with BlitzMax?

Thank you.

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #40 on: March 15, 2020, 03:51:45 AM »
this gui only works under Xors3D engine under blitzmax
so only if you are planning to use Xors3D you can use this GUI.
other than that, you better find another GUI . Cheers :)
Happy New Year

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #41 on: March 15, 2020, 03:58:54 AM »
I finally DId picture hidden in picture..
the hidden picture is on black and white but i can also make it colored in the future if i like.

You load two pictures and than press process and you will get the image inside image new image..

Note: if you transfer this image using whatsup or some medias that process the pixels this wont work..

I did anyway just for experimenting.. i was wondering if its possible.

I simply steal some bits from the main image and use it as gray scales for the hidden image..

please choose a bigger image as the visible image.. because if not it will get stuck..
i didnt fix this yet

https://drive.google.com/file/d/10vPfCDd73soh4_9nwqCy2FA4fcuSZnb4/view?usp=sharing



Happy New Year

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #42 on: March 20, 2020, 04:38:14 AM »
Ok i made the hidden Image In Color..
it was more complicated but i managed..

I only do this as a type of excersize ..

i learnt a lot from it..

now that i finished it  can move on with life :)

https://drive.google.com/file/d/1qOWXd_3vUDjW-UmifU9dl3Ev7Fj29Ybg/view?usp=sharing

Happy New Year

Offline fielder

  • Jr. Member
  • **
  • Posts: 86
Re: ReadPixel WritePixel speed
« Reply #43 on: March 22, 2020, 09:41:04 PM »
the main exacutable (supermain.exe) is not doing anything on my pc (Windows 10 64)

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 409
Re: ReadPixel WritePixel speed
« Reply #44 on: March 22, 2020, 09:46:19 PM »
weird.. i got also windows 10 .. 64

maybe i missed one DLL .. ill check it

because it wont show you that it misses a dll , it just wont run..
checking..

ok i checked it. and all seems fine.. I have no idea at this point why its not working for you..
ill ask a friend to download it and see if he has issues too.

ok he had no issues..
but he uses windows 7 so.. I dont know ;)
Happy New Year

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal