I am creating a game in SpriteKit in which I have some SKShapeNodes. I want the SKShapeNodes to be hidden by color. For example:
initially as the scene loads, it should show as plain color.
The user scratches (touches and moves touch) to scratch the color and reveals the shapes behind the color. I will perform other actions on these shapes later
If any one suggests this link:
https://github.com/moqod/iOS-Scratch-n-See
then I have already gone from this but the problem is this that it is using two images one as front and other as background and it is in core graphics. I am completely beginner to core graphics and having difficulty to understand how to show color instead of image to scratch.
I understand that the question has been already asked but it is using images. I want to have only one color as layer which will be scratched.
Any one will please help me how to achieve scratch effect to scratch color and reveal other nodes behind?
Related
I am Wounding How these e commerce Website Edit their product pic for the front page
for example
This is an product image from flipkart.com an online store
This is Photo Taken by the camera
In Picture 1: There is Some blur effect how did they do it
There's no effect used. It is just a simple process.
The object is photographed against a white background.
The image is then 'masked' to isolate the object on it's own layer, either by hand or by a photoshop plugin. Manually, you can draw around the edge of the object using the lasso tool, then add a layer mask to remove the background.
Noise reduction, colour correction and other retouches are applied to this object layer. This is the blur effect that I think you are referring to. This may or may not be required, depending on image quality.
Shadows tend to be redrawn by hand using simple shapes with various blurs applied on a layer below the object. The simplest shadow is just a black ellipse with gaussian blur applied and layer opacity set to 20%.
A background colour is then applied, depending on how you will place the image. With images for E-Commerce this tends to be a white background.
The process for masking is varied and depends on your preferred tools, the complexity of the image and the shadow realism you want to achieve.
I recommend further research into 'Image Masking' to find the technique that suits you.
My problem is three-fold. I'm going to try to explain as detailed as I can, because I've asked this question before and haven't gotten any clear answers.
What I'm Trying to Do:
I have diagonally shaped images, that I'm trying to make clickable, so I separated them out of the background image. They were originally one image, but I've cut out several pieces of the image and I want to align them identically to how they were in the original image. This might not the best method for what I am trying to achieve, and if there is a better way to make non-square areas of an image clickable, that would solve all of these problems. If not, here is my problem. The problem is, as soon as I align them in XML, I boot them up on an Android emulator or my phone, and they are aligned differently on both, differently than the preview and from each other.
Below is my example, and I'll try to explain what I mean.
The black and white grid is my background. The brown, red, and yellow lines are separate images. I don't want to just combine them with the background, because I need those lines to be clickable. I'd set a button behind them, but they are diagonally shaped and I need the entire shape to be clickable. However, they have to be EXACTLY where they are in the background, aligned specifically as they are to the background. The problem is, as soon as I load it on another device, it scales, and everything misaligns.
It also misaligns depending the device, so I presume it's because it's scaling the different parts differently.
I need a way to align it the way I want it, and have each image scale together.
How I've Been Trying This So Far:
Initially, I tried just using XML. And herein was my first problem. My background image is 1920x1080. It loads on the emulator without a problem. However, if I try to load it on my phone, I get the following error:
OpenGLRenderer: Bitmap too large to be uploaded into a texture (5760x3240, max=4096x4096)
So that leads to my first question. Why is my 1920x1080 trying to load as 5760x3240?!
I bypassed this, by using Picasso to scale the image to 1920x1080. As a sidenote, in addition to programmatically loading the image, I also am removing the title bar. Here is my OnCreate:
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main_layout);
Picasso.with(this).load(R.drawable.backgroundimage).resize(1920,1080).into((ImageView)findViewById(R.id.background));
On the XML side, I've tried all sorts of different things. Relative layouts, linear layouts, frame layouts...None seem to scale the separate imageviews the same.
Which leads to my second question.
How do I scale two differently sized imageviews together, so that they maintain their alignment on different sized devices?
My second imageview is 198x547(this would be the equivalent of one of the squiggly lines in the example images) and even setting that in Picasso does not maintain my alignment. In fact, that doesn't seem to work at all, since I have to scale it differently to even match the alignment I have in the original image.
Summary Questions
I need a diagonally shaped portion of an image to be clickable. Is cutting the shape out as a separate image the appropriate method for doing so? If not, how do I make such a specific, non-square area of an image clickable?
I need specific alignments to scale together. Why aren't they?
Why does my png file upscale itself?
I have a problem with gradients transparency key in a PictureBox in visual basic form . I want to get a good transparency as it is in the first form (in PS)
That's what I did:
1- Drawed the picture in Adobe Photoshop (CS6) with these preset:
2- Saved the picture with this option:
3- Added the picture to a PictureBox in vb form with blue BackColor
4- Changed form TransparencyKey to blue
5-The (awful) result:
The Form.TransparencyKey property is not really what you're looking for. It will only make the parts of the image transparent that exactly match the color you specified (Color.Blue, in your case). That means that the parts of the gradient in your image that have even a remotely small amount of red or yellow in them won't match the filter.
Among the things you could try is to have your form drawn with alpha blending. Here's a library that lets you draw stuff with transparency, which looks like what you want.
Alternately I dug up a walkthrough on CodeProject. It involves a lot of chatting with forms interop and the OS, which might not be your cup of tea.
Note that GDI+, the system Windows Forms uses for drawing, is somewhat slow, especially when drawing images. I don't know what your project looks like, but if you're going to draw a lot of transparent images, I suggest looking towards Microsoft DirectX.
I am currently writing a program that requires a picture box with a transparent image to go over several pictureboxes. I have looked for hours now and found nothing useful. the program is a rubiks cube solver. each square is represented as a picturebox and the cube is shown in a net form. I cant upload images as my account is new but i have included an image of a rubiks cube in a net form. now imagine a semi transparent image going over some of the squares (pictureboxes) to represent a visual guide to the rotation about to be made in the solve process. If you need more info I will do my best and upload images and add code for better clarification if needed. If this is not possible is there any alternatives that I could attempt? Thankyou
I don't think what you want is possible. I was actually trying to solve the same problem about 2 days ago and to no avail. You can't have transparency to work with multiple pictureboxes on winforms. What you need to do is draw the images using Graphics like one over the other. Use 1 picturebox and do Graphics to overlay the picture on the picturebox. Or have the main picture as the form's background image and use pictureboxes, this was what I did. This is surely easier using WPF. Alternatively... Try to check this imaging SDK.
http://www.gdpicture.com/
This might help overlaying your images.
And this too, this is basically the one using 1 picturebox and overlaying using Graphics.
VB.NET Winforms: Overlay two transparent images
I'm trying to write a fairly simple animation using Core Animation to simulate a book cover being opened. The book cover is an image, and I'm applying the animations to its layer object.
As well as animating a rotation around the y axis (The the anchorPoint property set of the left of the screen), I need to scale the right hand edge of the image up so it appears to "get closer" to the user and create the illusion of depth. Flipboard, for example, does this scaling really well.
I can't find any way of scaling an image like this, so only one edge is scaled and the image ends up nonrectangular.
All help appreciated with this one!
CoreAnimation, by default, "flattens" its 3D hierarchy into a 2D world at z=0. This causes perspective and the like to not work properly. You need to host your layer in a CATransformLayer, which will render its sublayers as a true 3D layer hierarchy.