News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Pixel manipulation

Started by Gunther, March 14, 2013, 05:21:30 AM

Previous topic - Next topic

Gunther

Is there any example inside the forum pool for manipulating (set and read) pixels, drawing lines, circles etc? Any help is welcome.

Gunther
You have to know the facts before you can distort them.

jj2007

You need a DC, i.e. what BeginPaint returns in eax, and various simple graphics functions:
SetPixel
Chord
Ellipse
FillRect
FrameRect
InvertRect
Pie
Polygon
PolyPolygon
Rectangle
RoundRect

Select a brush and a pen into the DC, and go ahead.

Circles are done with
invoke Ellipse, myDC, Rect.left, Rect.top,, Rect.right, Rect.bottom

No rocket science, just try it in the WM_PAINT handler.
hth, jj

dedndave

you can use SetPixel and GetPixel for maybe a few pixels
but, they are slow
it would seem they create a DC and blit for each pixel
so - much better to create a DC and blit once, edit your pixels, then blit back to the window DC

for lines, there is MoveTo, LineTo, et al

http://msdn.microsoft.com/en-us/library/windows/desktop/dd145031%28v=vs.85%29.aspx

the real "work horses" are

CreateCompatibleDC
CreateCompatibleBitmap
CreateDIBSection
BitBlt
StretchBlt
TransparentBlt

and the functions that go with them

DeleteDC
DeleteObject
SetStretchBltMode/SetBrushOrgEx

Gunther

Hi Dave,

thank you for the hints.  :t

Gunther
You have to know the facts before you can distort them.

dedndave

there are a number of forum members that i have learned a lot from
of course, there are the usual suspects   :P
and also Seikmanski, guga, gwapo, Tedd, and a few others

another great resource is Jose Roca's site
http://www.jose.it-berater.org/smfforum/index.php

you can search almost any GDI function, and get a few nice examples

Gunther

Hi Dave,

Quote from: dedndave on March 14, 2013, 06:52:48 AM
there are a number of forum members that i have learned a lot from
of course, there are the usual suspects   :P

oh yes, the usual suspects.

Quote from: dedndave on March 14, 2013, 06:52:48 AM
another great resource is Jose Roca's site
http://www.jose.it-berater.org/smfforum/index.php

you can search almost any GDI function, and get a few nice examples

thank you, great ressource.

Gunther
You have to know the facts before you can distort them.

dedndave

by "usual suspects", i am refering to the guys we learn all kinds of stuff from
Hutch--, qWord, donkey, Vortex, KetilO, jj2007, MichaelW, FORTRANS, ToutEnMasm, BillCravener, etc

you can use the advanced search tool in the new and the old forums to help find things   :P

Gunther

Hi Dave,

Quote from: dedndave on March 14, 2013, 08:29:54 AM
by "usual suspects", i am refering to the guys we learn all kinds of stuff from
Hutch--, qWord, donkey, Vortex, KetilO, jj2007, MichaelW, FORTRANS, ToutEnMasm, BillCravener, etc

yes, that was my impression, too.

Quote from: dedndave on March 14, 2013, 08:29:54 AM
you can use the advanced search tool in the new and the old forums to help find things   :P

I'll use the tool.  :t

Gunther
You have to know the facts before you can distort them.

dedndave

let us know if you have some specific task in mind   :t

Gunther

Hi Dave,

Quote from: dedndave on March 15, 2013, 10:27:08 AM
let us know if you have some specific task in mind   :t

yes, I'll drop a line.

Gunther
You have to know the facts before you can distort them.

TouEnMasm


manipulating (set and read) pixels:
There is a fast and a slow method.The slow use API,the fast modify the pixels directly in memory.
A sample of this is here http://masm32.com/board/index.php?topic=835.msg7335#msg7335
,the region.cpp modifie the pixels to made a transparent color.

Fa is a musical note to play with CL

Gunther

Hi ToutEnMasm,

thank you for the link. It was a great help.  :t

Gunther
You have to know the facts before you can distort them.