Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36509
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2017-04-21 13:59 -0700 |
| References | (3 earlier) <903d6ec5-ab8e-4e87-9581-13ff803bf461@googlegroups.com> <a2ae1966-1dc0-4019-8286-16a5825ba843@googlegroups.com> <125e8758-3bf6-453b-8c5c-cadd339a0ebf@googlegroups.com> <e09756ab-7d8b-49ea-a529-6d6b71a8554f@googlegroups.com> <76664d4e-bc0e-4f10-9262-171f4db6d6fe@googlegroups.com> |
| Message-ID | <b3ba7166-4895-4114-aeff-557aaffb5a46@googlegroups.com> (permalink) |
| Subject | Re: BufferedImage and int[] array |
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
On Friday, April 21, 2017 at 4:54:43 PM UTC-4, Eric Douglas wrote:
> On Friday, April 21, 2017 at 4:37:47 PM UTC-4, Rick C. Hodgin wrote:
> > That code was all written last night and when I ran into the issue
> > with reading in a transparent enabled PNG file and it losing the
> > alpha channel I sort of stopped.
> >
> > The algorithm is inverting the color. This line reverses the color
> > of each pixel color channel:
> >
>
> I believe I did figure out the invert was trying to invert the colors not the horizontal. Change the pixels line in the invert to pass the actual alpha:
> pixels[offset] = rgba(255 - red, 255 - grn, 255 - blu, (rgba & 0xff000000) >> 24);
>
> Then change the rgba method to just add them.
> return(red + (grn << 8) + (blu << 16) + (alp << 24));
LOL! Well, they should be OR operations, not AND:
return (red | (grn << 8) | (blu << 16) | <alp << 24);
I code like that all of the time. I know what I'm intending, but it
literally gets translated out of my fingers differently than what's
in my mind. It's very frustrating at times. A symptom of dylsexia
and the associated family of the spectrum. :-)
Thank you,
Rick C. Hodgin
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 08:28 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 08:54 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 09:03 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 10:41 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 10:46 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 11:13 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 12:12 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 13:24 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 13:37 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 13:40 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 13:54 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 13:59 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-21 13:58 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-21 14:06 -0700
Re: BufferedImage and int[] array Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-04-22 11:28 -0500
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-24 07:33 -0700
Re: BufferedImage and int[] array Eric Douglas <e.d.programmer@gmail.com> - 2017-04-24 08:04 -0700
Re: BufferedImage and int[] array "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-04-24 08:17 -0700
Re: BufferedImage and int[] array Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-04-24 11:25 -0500
csiph-web