How do I create a partially overlapping shape in Sketch? - shapes

This is the effect I'm after. The pink line would be the 'tail' of the shape overlapping the circle, and the grey part would be a dropshadow from the tail on the circle. How do I go about this? Thanks!

With Sketchapp you can do this like :
Create the logo shape
Add a round shape and substract the two object
Create the path that will be the white border with the shadow
Substract this path (4) with the combined shape
Ctrl + C and Ctrl + v the path (3)
Create a mask from the combined path and mask the path cloned
Add the shadow on your cloned path
🎉
Here is a screen with every shape / group you need to do this.

Related

Openlayer distors vector shapes

I have a problem with drawing my vector shapes - when I zoom enough, it looks like some coordinates are skipped and the shape gets distorted - see the attached picture:
The shape is loaded from geojson file, where it's defined like:
"coordinates":[[[18.58235,49.81784],[18.58545,49.81738],[18.59252,49.81296]
,[18.59279,49.80395],[18.59986,49.79953],[18.60013,49.79051]
,[18.60719,49.78609],[18.61425,49.78168],[18.61093,49.7663]
,[18.07565,49.432],[18.07509,49.43198],[18.06119,49.43289]
,[18.04734,49.43411],[18.03356,49.43564],[18.01987,49.43747]
,[18.00628,49.4396],[17.99281,49.44204],[17.98218,49.44422]]]
Any idea, what's wrong?
Marek
Your polygon geometry is invalid. You have to add another coordinate pair at the end, with the same values as the first coordinate pair:
"coordinates":[[[18.58235,49.81784],[18.58545,49.81738],[18.59252,49.81296]
,[18.59279,49.80395],[18.59986,49.79953],[18.60013,49.79051]
,[18.60719,49.78609],[18.61425,49.78168],[18.61093,49.7663]
,[18.07565,49.432],[18.07509,49.43198],[18.06119,49.43289]
,[18.04734,49.43411],[18.03356,49.43564],[18.01987,49.43747]
,[18.00628,49.4396],[17.99281,49.44204],[17.98218,49.44422]
,[18.58235,49.81784]]]

Photoshop layer blending - null out background

Is it possible using layer blending and maybe masking to null out the background(transparent) using a picture with the product in place and one without the product as a background reference picture.
Like a layer mask that only reveals where images are different. (Product and shadow)
Thanks in advance.
Totally possbile but i'm not sure you'll get the desired effect. If you want to subtract absolutely just the areas where there are color differences that means shadow edges will be pixelated. Nonetheless, here's how you do it
Set up your layers like so:
Layer 1 (background + product baked in on top)
Layer 2 (background only)
Set Layer 1 blending mode to "Difference" --All the pixels with the same color information will turn black.
Flatten this and we'll call it "Layer 3 (Difference)"
Go into Layer 3's FX Styles. Under Blending Options, all the way at the bottom you'll find "Blend if:"
Set this to Gray and slide the "This layer:" markers until it says 0 0.
Voila. You have the mask to put on your original Layer 1 that eliminates all pixels with the same information.

How to change the anchor point from the top-left corner of a transformation matrix to the bottom-left corner?

Say, I have an image on an HTML page.
I apply an affine transformation to the image using CSS3 matrix function.
It looks like:
img#myimage {
transform: matrix(a, b, c, d, tx, ty);
/* use -webkit-transform, -moz-transform etc. */
}
The origin of an HTML page is the top-left corner and the y-axis is inverted.
I'm trying to put the same image in an environment (cocos2d) where the origin is the bottom-left corner and the y-axis is upright.
To get the same result in the other environment, I need to transform the origin somehow and reflect that in the resulting CGAffineTransform.
It would be great if I can get some help with the matrix math that goes here. (I'm not so good with matrices.)
The following formula would work,
for converting the position from CSS3 to Cocos2d:
(screen Size - "y" position in CSS3 - height of object)
Explanation:
To make the origin for the Cocos environment same as for the CSS3 environment we would only have to add the screen size to the cocos2d's bodies y co-ordinate.
Eg. The screen size is (100,100) and the body is a point object if you place it at (0,0) in CSS3 it would be at the top left corner. If we add the screen size to the y co-ordinates for cocos2d the object would be placed at (0,100) which is the top-left corner for cocos2d as well
To make the co-ordinates same, since the Y axis is inverted, we have to subtract the "Y" co-ordinate given in CSS3 from the Screen Size for Cocos2d. Suppose we place the same point object in the previous example at (0,10) in CSS3 we would place it at (0, 100 - 10) in cocos2d which would be the same positions on the screen
Since our body would NOT always be a point object we have to take care of its anchor point as well. If suppose the body's height is 20 and we place it at (0,10) in CSS3 then it would be placed at the top-left position and would be coming down because the Y axis is inverted
Hence we would also have to subtract the body's total height from the screen size and "y" co-ordinate to place it at the same position which would be (0, 100 - 10 - 20) putting the body at the same place in cocos2d environment
I hope I am correct and clear :)

Drawing a chart with gradient in Objective C

I'm trying to make a simple app where a chart is drawn with a line and X axis. I want to fill parts of the view enclosed by chart and X axis with gradient. To fill them I use the following code
CGContextSaveGState(c);
CGContextAddPath(c, CGContextCopyPath(c));
CGContextClip(c);
CGContextDrawLinearGradient(c, g, previousPointOfIntersection, intersectionPoint, 0);
CGContextRestoreGState(c);
every time the line crosses the X axis. However, the problem is that the gradient fills the whole view between previous point of intersection and current one.
Is this a right way to draw a gradient for a part of view enclosed by lines?
I'd be very happy to hear any suggestions regarding my problem :)
P.S. here's the code of my class http://pastebin.com/wYiHkuVi
I'd say you don't have the path in the context that you think you do.
If you've "stroked" the path for your graph it's been used up.
Replace your Add Path with:
CGContextAddEllipseInRect(c, self.bounds);
to see if you get some clipping occurring.
If so, then you need to rebuild your path here instead of the AddPath/Ellipse code.

How to replace all pixels of some color in a bitmap in Rebol?

Let's say I have a picture, I want to create some variations by changing a color. How to do this ?
I don't want to apply color filter to a picture, I want to change pixels color pixel by pixel by testing a color pixel if it is let's say red, i want to turn it to blue.
In Rebol images are also series, so you can use most of the series functions to change/find rgb colors etc.
i: load %test.png
type? i
image!
first i
255.255.255.0 (the last value is alpha)
change i 255.0.0.0 ;change the first rgba value to red
view layout [image i] ;you can see the upper-left pixel is now red
you can dump all rgba values in an image:
forall i [print first i]
you can also change a continues part:
change/dup head i blue 100 ;change first 100 pixels to blue
you can also work on i/rgb and i/alpha, these are binary values (bytes)
and you can use copy to get a part of an image:
j: copy/part at i 100x100 50x50 ;copy from 100x100 to 150x150 to a new image.
Use some of the image processing capabilities as documented here:
http://www.rebol.com/docs/view-guide.html
Demo program showing some of them in action here:
http://www.rebol.com/view/demos/gel.r