Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color Extraction Developer Insights
#5
(01-28-2024, 07:16 AM)SMcNeill Wrote: A better way may be to just get values directly.

$Checking:off
Alpha = _MEMGET(m, o +3, _unsigned _byte)
Red = _MEMGET(m, o + 2, unsigned byte)
Green...   o + 1
Blue ... o
$Checking:on

No shifting, no calculations.  Just a direct value read.

(When then goes to the speed question: is it faster to just read 4 values directly, or to only read one and then math it?)

I'd *think* a simple direct read would be faster, but with cacheing and all nowadays...  I'd swear to nothing!  Wink
Leave it Steve to think even deeper. Very interesting and of course so simple I completely overlooked it.

One thing I noticed here is that because of the way you are reading offset values it appears that the bytes are ordered in BGRA. Is that correct Steve, was my bit manipulation efforts reading in the data backwards?
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Color Extraction Developer Insights - by TerryRitchie - 01-28-2024, 04:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  find color of a pixel PhilOfPerth 8 764 10-09-2025, 05:20 PM
Last Post: SMcNeill
  palette color help pmackay 7 989 07-13-2025, 11:51 PM
Last Post: madscijr
  Trasparent color not being set correctly here... Dav 9 1,560 11-10-2024, 04:11 AM
Last Post: bplus
  Who is the ISE developer/maintainer? desA 3 1,020 08-02-2024, 03:23 AM
Last Post: grymmjack
  Error displaying 256 color PCX image program? macalwen 8 1,679 07-05-2024, 01:39 PM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: 1 Guest(s)