English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. General > Coders. Releases

 
 
Thread Tools
Old 30 August 2014, 20:38   #21
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
Quote:
Originally Posted by AGS View Post
Ah! And what about memory consumption for a picture of let us say screen size?
The alternative is to load the image with datatypes and apply the alpha channel with pngalpha.library. Then you would have the image in memory, the ARGB array and the alpha array. That's much more than with your library.
thomas is offline  
AdSense AdSense  
Old 30 August 2014, 20:41   #22
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
Quote:
Originally Posted by AGS View Post
needs only one multiplication
* 4 is a multiplication, too, isn't it?
thomas is offline  
Old 30 August 2014, 20:45   #23
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
LOL @ last two posts

this seems to work:

Code:
		move.l	pfo_Width(a0),d7
		mulu.w	d7,d3			; y * width
		ext.l	d2
		add.l	d2,d3			; + x
		lsl.l	#2,d3			; * 4 bytes (ARGB)

Last edited by AGS; 30 August 2014 at 20:46. Reason: added formula
AGS is offline  
Old 30 August 2014, 22:05   #24
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
Happy

Ok, here is version 2.3:

http://images.quicktunnels.net/pngflux_v2.3.zip

Drawing functions are and work now like Thomas suggested.

- DrawArray
- DrawClip
- Draw

If everything is well I release the source.

NOTE: Yet only PNG in RGB format with or without alpha channel are supported! Loader returns ERROR_OBJECT_WRONG_TYPE with dos IoErr() when no match.


EDIT: Very little fix, had to copy the new library into the archive and fix the RGB format w/o alpha to work also (revision now set to 1). Please download again.

EDIT: Bugfix: didn't save registers in pngfDraw(), revision set to 2

EDIT: proper C includes

EDIT: speedup, revision set to 3

Last edited by AGS; 31 August 2014 at 21:06. Reason: bugfix
AGS is offline  
Old 31 August 2014, 10:53   #25
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
C files upated.

Maybe you could add a flag to the PNGFObject (and possibly an attribute for pngfGetAttr) which indicates that the loaded files did not have an alpha channel. Then, if the draw functions see this flag, they should revert to immediately call WritePixelArray resp. copy the data into the array without alpha blending. Perhaps the load routine can be so intelligent to set this flag also if there is an alpha channel but it is completely solid (i.e. all pixels are $ff).
Attached Files
File Type: lha pngflux_c.lha (4.8 KB, 65 views)
thomas is offline  
Old 31 August 2014, 11:04   #26
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
Yes, I could add that, however I did not plan to make a full featured PNG library but only one for alpha ... but I think I add this ...

Thanks again for the includes.
AGS is offline  
Old 31 August 2014, 11:19   #27
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
Code:
/* Object returned by pfLoad(): */

struct PNGFObject {
	struct MinNode reserved;	/* Reserved, eventually for a list node */
	ULONG	pfo_Width;		/* You may find the width of the loaded
					   PNG image here. */
	ULONG	pfo_Height;		/* You may find the height of the lo.aded
					   PNG image here. */

	APTR	pfo_DrawBuffer;		/* PRIVATE */
	UWORD	pfo_DrawBufferModulo;	/* PRIVATE (actually width * 3) */
	ULONG	pfo_ARGBModulo;		/* PRIVATE (actually width * 4) */
	APTR	pfo_ARGBData;		/* PRIVATE. For compatibility always use
					   pfGetAttr() to read out this field. */
					
	UBYTE	pfo_EndHead;		/* End of the head, NOT of the Object!
					   Object size may vary:
	
					   DrawBuffer and ARGBData follow here,
					   so that alltogether can be freed with
					   one call to FreeVec(). */
	};

Is pfo_EndHead really an UBYTE? In my .i it is a LABEL.

Further, I removed all the funny fields from the object structure. Now it looks like this:

Code:
/* Object returned by pfLoad(): */

struct PNGFObject {
	struct MinNode reserved;	/* Reserved, eventually for a list node */
	ULONG	pfo_Width;		/* You may find the width of the loaded
					   PNG image here. */
	ULONG	pfo_Height;		/* You may find the height of the lo.aded
					   PNG image here. */
	APTR	pfo_ARGBData;		/* PRIVATE. For compatibility always use
					   pfGetAttr() to read out this field. */
					
	UBYTE	pfo_EndHead;		/* End of the head, NOT of the Object!
					   Object size may vary:
	
					   DrawBuffer and ARGBData follow here,
					   so that alltogether can be freed with
					   one call to FreeVec(). */
	};
I think this is the only place where to change that. So I did it.


PS: Is it possible to make the PRIVATE fields really private an not appear in the public struct?

Last edited by AGS; 31 August 2014 at 11:27.
AGS is offline  
Old 31 August 2014, 12:14   #28
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
Quote:
Originally Posted by AGS View Post
Is pfo_EndHead really an UBYTE? In my .i it is a LABEL.
I don't know what it's good for. A label is just another name for the field that follows. But there does not follow anything.

Quote:
Is it possible to make the PRIVATE fields really private an not appear in the public struct?
No. The only way is obvious: just don't tell people where these fields are.
thomas is offline  
Old 31 August 2014, 12:30   #29
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
Does the "LABEL" type exist in C?
AGS is offline  
Old 31 August 2014, 13:26   #30
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
No.
thomas is offline  
Old 31 August 2014, 13:31   #31
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
so would it be ok if I remove that last line "pfo_EndHead" line from the C include completely? I mean it is only used by the library itself and that only from the pngflux.i (and I would also like to remove the pfo_ARGBData field also, it is only for internal purposes and there is the GetAttr()).

Last edited by AGS; 31 August 2014 at 13:56.
AGS is offline  
Old 31 August 2014, 22:33   #32
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
I built in a branch around the muls and divs in a pixel for the case that the alpha value of that pixel is $00 or $ff.

What about an "accuracy" parameter for the case someone is satisfied with a lsr instead of a divs?
AGS is offline  
Old 07 September 2014, 12:39   #33
arti
Registered User

 
Join Date: Jul 2008
Location: Poland
Posts: 473
Any news about ABGR ?
arti is offline  
Old 08 September 2014, 09:02   #34
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
I am not sure what you mean.
AGS is offline  
Old 08 September 2014, 21:42   #35
arti
Registered User

 
Join Date: Jul 2008
Location: Poland
Posts: 473
An option to convert data to ABGR format because NetSurf shows wrong colors.
arti is offline  
Old 05 October 2014, 22:47   #36
mritter0
Registered User

 
Join Date: Sep 2013
Location: Bettendorf, IA, USA
Age: 46
Posts: 203
Will this be usable with ReAction ButtonClass, LabelClass, etc. images?
Code:
LAYOUT_AddChild,			ChildObjects[GAD_IMAGE]=NewObject(ButtonClass,NULL,
    GA_ID,						GAD_IMAGE,
    GA_ReadOnly,				TRUE,
    BUTTON_BevelStyle,			BVS_NONE,
    BUTTON_Transparent,			TRUE,
    BUTTON_RenderImage,			ImgObjects[IMG_REQ_ARCHIVE],
TAG_END),
mritter0 is offline  
Old 06 October 2014, 05:55   #37
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
I am not sure what you mean but it looks like the answer is no or not yet.
AGS is offline  
Old 06 October 2014, 09:04   #38
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
It's a library, not a class, so no certainly it cannot be used with ReAction.

On the other hand, everything can be used with BOOPSI, you just need to write a class. Find an example attached.

Last edited by thomas; 07 October 2014 at 21:10.
thomas is offline  
Old 06 October 2014, 10:06   #39
AGS
XoXo/Tasko Developer
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 42
Posts: 439
Smile

I am impressed.

But in the file pngflux_ic.h there is maybe a typo:

Code:
	#define PngfluxObject NewObject(pngflux_class,NULL
I think a closing bracket ")" is missing.

Then, may I include this class somehow in the pngflux archive?
AGS is offline  
Old 07 October 2014, 21:10   #40
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,507
Quote:
Originally Posted by AGS View Post
I think a closing bracket ")" is missing.
Not, it's not. PngfluxObject is a macro which opens the NewObject call. Tags are then passed in the source code and finally there is EndObject macro which contains TAG_END and the closing bracket.

Quote:
Then, may I include this class somehow in the pngflux archive?
I've cleaned up the code a bit, removed all the macros and PPC stuff. Now you can include it in your archive if you like.

Note: it is a piece of source code which compiles into an object module which is linked to the main program. It is not an external class as in Sys:Classes/Images.
Attached Files
File Type: lha pngflux_ic.lha (11.2 KB, 57 views)
thomas is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for 2P PD Western Draw Game! hansel75 Looking for a game name ? 2 13 April 2013 14:10
Anyone have Draw 4D Pro? Pyromania request.Apps 3 31 December 2007 19:35
How to draw a (rubbish) zipstick with 10 shapes killergorilla Nostalgia & memories 54 30 March 2007 04:25
Default draw Retro1234 support.Other 1 02 July 2006 17:14
What ever happened to Draw Studio 2? Pyromania Amiga scene 3 08 November 2002 02:32

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:47.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.22036 seconds with 13 queries