Gamestudio Links
Zorro Links
Newest Posts
lock profit without trail
by Grat. 09/18/20 14:30
how to use BrokerHistory2
by Grat. 09/18/20 14:29
MT4 plugin
by Grat. 09/18/20 08:32
Trail without setting Stop at entry
by AndrewAMD. 09/17/20 14:28
Sky and Water not working correctly?
by Preypacer. 09/17/20 11:39
Returning to A8/3DGS
by Preypacer. 09/17/20 00:46
Problem with history from MT4
by Grat. 09/16/20 18:37
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
10 registered members (NewBorn, AndrewAMD, 3run, Aku_Aku, alibaba, danatrader, 3dvg, 3 invisible), 473 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
NewBorn, 3dvg, secretagentman, distribution, EditeY
18515 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Bmap creation - wrong Alpha values #478762
12/11/19 10:07
12/11/19 10:07
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Hi,

I have an issue with pixel_to_bmap / bmap_fill / bmap_save. It is not creating the correct alpha values.
If I write 50 for the alpha value, it shows in photoshop L: 61 RGB: 147! At 50 Percent alpha RGB value should be 127.5!
All other alpha values create wrong L / RGB values, accept alpha percent is 0 or 100.

I need to have exact values.
Here are more examples: (first number is alpha value in Lite-C, second L in Photoshop and third alpha RGB in Photoshop.

0,0,0
5, 4, 14
20,30,71
40,52,124
50,61,147
70,78,193
90,93,235
100,100,255

Thanks

Re: Bmap creation - wrong Alpha values [Re: Benni003] #478764
12/11/19 12:43
12/11/19 12:43
Joined: Jun 2007
Posts: 1,334
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,334
Hiporope and its pain
Hi,
I have been working with exact BYTE values on bitmaps and never realized of such a thing. Always got the values I was especting out. I use GIMP, so let me ask some questions.

Do you save the bitmap as TGA? Other formats might change the values, as palettized ones, such PCX, or compressed, such PNG.

Do Photoshop apply any color correction on importing proccess? Proffesional bitmap editing programs do commonly apply a color correction. Is there any option while importing?

Here goes the results of a new test of mine:
Code
#include <acknex.h>

void main () {
	wait(3);
	
	BMAP *_bmpT = bmap_createblack(16, 16, 32);
	bmap_fill(_bmpT, vector(128, 128, 128), 50);
	bmap_save(_bmpT, "b01.tga");
	wait(1);
	
	var _frm = bmap_lock(_bmpT, 0);
	var _pixel = pixel_for_vec(vector(128, 128, 128), 50, _frm);
	pixel_to_bmap(_bmpT, 0, 0, _pixel);
	bmap_unlock(_bmpT);
	bmap_save(_bmpT, "b02.tga");
	wait(1);
	
	var _frm = bmap_lock(_bmpT, 0);
	BYTE *_bits = _bmpT->finalbits;
	*(_bits + 3) = 127;
	bmap_unlock(_bmpT);
	bmap_save(_bmpT, "b03.tga");
	wait(1);
	
	bmap_remove(_bmpT);
	
	sys_exit(NULL);
}


The three bitmaps have the same exact values at pixel x0:y0

[Linked Image]

Re: Bmap creation - wrong Alpha values [Re: Benni003] #478767
12/13/19 09:13
12/13/19 09:13
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Hi txesmi,

Im using Photoshop and the TGA format.
I opened it with gimp and it shows the correct values. There was no problem within the code.
I also tried to open it with photoshop, saved it and reopened it with gimp. Still showing the correct values.

I dont know why photoshop is doing it, but problem solved ^^

Thank you

Re: Bmap creation - wrong Alpha values [Re: Benni003] #478768
12/13/19 14:58
12/13/19 14:58
Joined: Jun 2007
Posts: 1,334
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,334
Hiporope and its pain
Your are welcome. I am glad of been of help.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1