capturing an are under the mouse

Started by Baggey, October 31, 2024, 18:41:22

Previous topic - Next topic

Baggey

Im looking for inspiration or ideas on how i would select a screen area with the mouse drag and drop.

Once selected save as a Tpixmap / png

The idea is select an area no bigger than 64 x 64 and then capture selected pixels which i can grab the pixel data :-X

Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Midimaster

Why not using GrabImage() or GrabPixMap?
...on the way to China.

GW

#2
EDIT: I realized this is already in the code archives : https://www.syntaxbomb.com/miscellaneous/bmx-tselectionbox-thing-by-ked-1-years-ago/msg3586/

Here ya go.
Code: BASIC
Type tSelectBox
	Field x:Int, y:Int, x2:Int, y2:Int
	
	Method New(startx:Int, starty:Int)
		x = startx
		y = starty
		x2 = startx + 1
		y2 = starty + 1
	End Method
	
	Method Update(mx:Int, my:Int)
		Local tmp:Int
		
'		x = Min(Min(x, mx), x2)
'		x2 = Max(Max(x, mx), x2)
'		
'		y = Min(Min(y, my), y2)
'		y2 = Max(Max(y, my), y2)
'		Return
		
		If mx > x Then
			'x = x2
			x2 = mx
		Else
			x = mx
		EndIf
		
		If my > y Then
			'y = y2
			y2 = my
		Else
			y = my
		EndIf

	End Method
	
	Method Draw()
		SetAlpha 0.3
		SetColor 0, 0, 0
		DrawRect(x, y, x2 - x, y2 - y)
		SetAlpha 1
		SetColor 255, 255, 255
		DrawRectHollow(x, y, x2 - x, y2 - y)
	End Method
	
End Type
box.gif


Baggey

Thanks @GW

That's given me an idea combing @Midimaster grabimage idea. Im thinking of being able to scroll over an image and what ever is under the select rectangle will be able to manipulate the pixels into 8x8 or 16x16 etc. A form of graphics ripper from the Spectrum memory in SpecMax's memory. Which could be saved as .txt file. For further manipulation or just save the bitmap that's altered if it is indeed a graphic :-\

Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!