30 August 2014, 20:38 | #21 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
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.
|
30 August 2014, 20:41 | #22 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
|
30 August 2014, 20:45 | #23 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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 |
30 August 2014, 22:05 | #24 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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 |
31 August 2014, 10:53 | #25 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
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). |
31 August 2014, 11:04 | #26 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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. |
31 August 2014, 11:19 | #27 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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(). */ }; 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. |
31 August 2014, 12:14 | #28 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
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:
|
|
31 August 2014, 12:30 | #29 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
Does the "LABEL" type exist in C?
|
31 August 2014, 13:26 | #30 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
No.
|
31 August 2014, 13:31 | #31 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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. |
31 August 2014, 22:33 | #32 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
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? |
07 September 2014, 12:39 | #33 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
Any news about ABGR ?
|
08 September 2014, 09:02 | #34 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
I am not sure what you mean.
|
08 September 2014, 21:42 | #35 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
An option to convert data to ABGR format because NetSurf shows wrong colors.
|
05 October 2014, 22:47 | #36 |
Registered User
Join Date: Sep 2013
Location: Bettendorf, IA, USA
Age: 52
Posts: 204
|
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), |
06 October 2014, 05:55 | #37 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
I am not sure what you mean but it looks like the answer is no or not yet.
|
06 October 2014, 09:04 | #38 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
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. |
06 October 2014, 10:06 | #39 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
I am impressed.
But in the file pngflux_ic.h there is maybe a typo: Code:
#define PngfluxObject NewObject(pngflux_class,NULL Then, may I include this class somehow in the pngflux archive? |
07 October 2014, 21:10 | #40 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
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:
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. |
|
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 |
|
|