PDF manual version 3.3

User avatar
Dutchman
Posts: 848
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: PDF manual version 3.3

Post by Dutchman »

OK, clear. Thanks

User avatar
Dutchman
Posts: 848
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: PDF manual version 3.3

Post by Dutchman »

I have problems with the documentation on GRAPHICS MODE.
1.
The usage of Alpha seems crucial considering the given formulas.
However which alfa is used when circles lines, rectangles etc. are drawn?
Alfa can not be set with DRAW COLOR or FILL COLOR.
2.
I hoped that the XOR-mode would invert colors.
'001' XORred with '111' gives '110' and XORred again returns to '001'.
So I would expect that blue (r,g,b=0,0,1) XORred with white (R,g,b,=1,1,1) results in yellow (r,g,b,=1,1,0)
After drawing the same figure again on the same position would result in erasing the figure.
3.
I made the following code to test several modes.
It appears that the XOR-mode and several others, only clear the image.
Can you please clarify? How could I get item 2. realised?

Code: Select all

' Blinking disk
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
GRAPHICS
GRAPHICS CLEAR 0,0,1
FILL COLOR 1,1,1 
GRAPHICS MODE XOR
DO
  GRAPHICS LOCK
  FILL CIRCLE sw/2,sh/2 SIZE sw/4
  PAUSE 0.2
  GRAPHICS UNLOCK
  GET TOUCH n AS x,y
UNTIL X>-1 AND y>-1

User avatar
Mr. Kibernetik
Site Admin
Posts: 4782
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: PDF manual version 3.3

Post by Mr. Kibernetik »

Alpha is set by commands DRAW ALPHA and FILL ALPHA.

These graphics modes are compositing modes and they work according to given formulas.
XOR is not bitwise XOR, also there is no connection between bits and color values (bits are discrete values: just 0 or 1, and color values are unlimited number of floating values between 0 and 1). So your suggestion can not be applied here.

I cannot understand what exactly do you want to get in the result, but maybe this example will help you:

Code: Select all

graphics
graphics clear
graphics mode screen
fill color 1,0,0
fill circle 150,100 size 100
fill color 0,1,0
fill circle 90,190 size 100
fill color 0,0,1
fill circle 210,190 size 100
Снимок экрана 23 янв. 2014 г., 2.59.15 с Симулятора iOS.png
Снимок экрана 23 янв. 2014 г., 2.59.15 с Симулятора iOS.png (174.35 KiB) Viewed 5388 times

User avatar
Dutchman
Posts: 848
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: PDF manual version 3.3

Post by Dutchman »

I had overseen the commands DRAW ALPHA and FILL ALPHA. Thanks

1.
I want colours to change to complementary colors.
2.
I don't understand the descriptions
e.g. SCREEN mode is described:
SCREEN : Multiplies the inverse of the source image samples with the inverse of the background image samples
What I see however, in your display of the coloured disks, that the colors are simply added where they overlap.
Can I find somewhere more information on these modes?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4782
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: PDF manual version 3.3

Post by Mr. Kibernetik »

Dutchman wrote: I don't understand the descriptions
e.g. SCREEN mode is described:
SCREEN : Multiplies the inverse of the source image samples with the inverse of the background image samples
Actually here information is missing. Result is then also inversed. I will correct this in the manual.
It is very nice that you pointed on that, because I just took the description of blend modes from Apple documentation as it was, without re-checking it: https://developer.apple.com/library/ios ... rence.html

Full description of blend modes can be found here: http://wwwimages.adobe.com/www.adobe.co ... e15_v5.pdf
please see "TABLE 7.2 Standard separable blend modes".

Now after some investigation I also found this resource: https://developer.apple.com/library/mac ... mages.html
with images describing some blend modes.

User avatar
Dutchman
Posts: 848
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: PDF manual version 3.3

Post by Dutchman »

Thank you very much! That is what I was looking for.
Especially the info in the last link clarifies a lot.
I have made a copy of a section and will add that to the DropBox manual folder.
I have also attached it here.
Attachments
Image composition modes.rtfd.zip
using image composition modes
(259.08 KiB) Downloaded 527 times

User avatar
Mr. Kibernetik
Site Admin
Posts: 4782
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: PDF manual version 3.3

Post by Mr. Kibernetik »

Very good!

Post Reply