Want to join? Log In or Join Now in seconds. English (United States)

CREATE A NEW ACCOUNT

{{registerModel.Error}}

Log In

/content/images/forum.png

Feedbacks

Get help from the knowledgeable Reddah Community and official Reddah Support!
/content/images/ambassador.png

Discuss on AD

A place for discussing the ads that reddah is currently running.
/content/images/contact_us.png

Contact Us

Get in touch with an Reddah Support technician. We are ready and willing to help you!
201
picture

US flies B-52 bombers near contested islands in the South China Sea

US flies B-52 bombers near contested islands in the South China Sea
news submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Two US B-52 bombers flew near contested islands in the South China Sea Monday, according to US Pacific Air Forces.

"Two US Air Force B-52H Stratofortress bombers departed Andersen Air Force Base, Guam, and participated in a routine training mission" in "the vicinity of the South China Sea," US Pacific Air Forces said in a statement.
"This recent mission is consistent with international law and United States' long-standing commitment to a free and open Indo-Pacific," the statement added.
202
picture

British academic Matthew Hedges jailed for life in UAE for spying

British academic Matthew Hedges jailed for life in UAE for spying
world submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Durham University PhD student Matthew Hedges and his wife Daniela Tejada.

A British academic has been sentenced to life in prison for spying in the United Arab Emirates, according to a family spokeswoman.

Matthew Hedges, 31, and a specialist in Middle Eastern studies at Durham University in England, was arrested on May 5 by UAE officials when he was leaving Dubai airport after a research trip. He had previously been held in solitary confinement for almost six months on spying allegations, but was released on bail last month.

Nikita Bernardi, a spokeswoman for the Hedges family, said that Hedges had been sentenced to "life in prison following a five-minute hearing in which he had no legal representation."

 

205
211

New Year's celebrations around the world

picture
picture
picture
2019
world submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Revelers are ringing in 2019 with celebrations spanning the globe.

From Sydney's Opera House to New York's Times Square and beyond, fireworks will illuminate the night sky in parties festooned with confetti and sparklers.

We'll be adding photos to this story throughout the day as the clock strikes midnight in each time zone.

Fireworks light up the sky in front of the Twin Towers in Kuala Lumpur, Malaysia.

People attend New Year's celebrations in Seoul, South Korea.

Fireworks explode over the Victoria Harbor in Hong Kong.

A reveler wears glasses during a party in Quezon City, Philippines.

 

212

Thousands of tourists flee Thai islands as Tropical Storm Pabuk approaches

picture
picture
Thousands of people are fleeing Thai islands popular with tourists ahead of what could be the most devastating storm to hit in decades, officials told CNN on Thursday.
weather submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Tropical Storm Pabuk is expected to make landfall about 7 p.m. local time Friday (5 a.m. ET) near the Chumphon archipelago, on the eastern border of Thailand's Surat Thani and Nakhon Si Thammarat provinces, but heavy rain has already arrived.

Tourist hotspots in the Gulf of Thailand, including Koh Samui, Koh Phangan and Koh Tao islands, along with islands in the Andaman Sea such as Phuket and Koh Phi Phi -- made famous by the movie "The Beach" -- are expected to be affected by the storm.

"We are still compiling the number of evacuees. I can say several thousand people for over 16 provinces," government spokesman Putthipong Punnakanta told CNN by phone.

"It is high season, there are many foreign tourists at popular destinations. We have informed them in advance since two days ago. I would say most of them have left islands and come to the mainland."

Phuwieng Prakhammintara, director general of Thailand's Meteorological Department, told CNN the storm could cause waves as high as seven meters (22 feet), but that waves were more likely to reach 3 to 5 meters in height.

Schools in coastal areas are to be closed and Thailand's armed forces are on standby for Pabuk's arrival.

Thai men move a fishing boat to a safer location in Songkhla, southern Thailand, in preparation for storm weather conditions on Thursday.

Bangkok Airways announced the cancellation of all flights to and from Koh Samui on Friday "for safety reasons." Affected passengers will be able to rebook their flights without paying fees or charges, the airline said.

After crossing the Chumphon Archipelago the storm will, if the current track holds, make a second landfall over Surat Thani province early Saturday.

213

var c = document.getElementById('c'), c_ = document.createElement('canvas'), ctx = c.getContext('2d'), ctx_ = c_.getContext('2d'), image = document.getElementById('image'), img, original = false, src = "assets/icon/timg.jpg", s = { 'scale': 10, 'font size': 10, 'color': '#fff' }; image.src = src; image.style.display = 'none'; img = new Image(); img.crossOrigin = 'anonymous'; img.src = src; img.onload = function() { c.width = img.width; c.height = img.height; c.style.marginLeft = image.style.marginLeft = -c.width / 2 + 'px'; c.style.marginTop = image.style.marginTop = -c.height / 2 + 'px'; c_.width = img.width = c.width / s.scale; c_.height = img.height = c.height / s.scale; draw(); } function symbol(gs) { var s; if (gs > 230) { s = '.'; } else if (gs > 195) { s = ','; } else if (gs > 170) { s = ';'; } else if (gs > 155) { s = '*'; } else if (gs > 130) { s = 'o'; } else if (gs > 105) { s = '&'; } else if (gs > 80) { s = '8'; } else if (gs > 60) { s = '#'; } else { s = '@'; } return s; } function draw() { ctx_.drawImage(img, 0, 0, img.width, img.height); var imgData = ctx_.getImageData(0, 0, c_.width, c_.height), pixels = imgData.data; for (var y = 0; y < c_.height; y++) { for (var x = 0; x < c_.width; x++) { var index = 4 * (x + y * c_.width), r = pixels[index + 0], g = pixels[index + 1], b = pixels[index + 2], greyscl = Math.round((r + g + b) / 3); var symb = symbol(greyscl); ctx.fillStyle = s.color; ctx.font = s['font size'] + "px Courier New"; ctx.fillText(symb, x * s.scale, y * s.scale); } } } c.addEventListener('click', function() { original = !original; if (original) { ctx.clearRect(0, 0, c.width, c.height); image.style.display = 'block'; } else { image.style.display = 'none'; draw(); } }); window["reddahApi"].loadCompleted()

body { margin: 0; overflow: hidden; background: #000; } body canvas, body img { position: absolute; left: 50%; top: 50%; }
submitted 6 years ago ago by 61ff8469a6da4a44abbcb6d1ad8bbd15
picture
214

var addEvent = function(object, type, callback) { if (object == null || typeof(object) == 'undefined') return; if (object.addEventListener) { object.addEventListener(type, callback, false); } else if (object.attachEvent) { object.attachEvent("on" + type, callback); } else { object["on" + type] = callback; } }; var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], x = w.innerWidth || e.clientWidth || g.clientWidth, y = w.innerHeight || e.clientHeight || g.clientHeight; var horizSliderVal = 0; var vertSliderVal = 0; addEvent(document, "mousemove", function(e) { horizSliderVal = (x / 2 - e.clientX) / (x / 2) * -1; vertSliderVal = (y / 2 - e.clientY) / (y / 2); makeFaceMove(); }); addEvent(document, "resize", function() { x = w.innerWidth || e.clientWidth || g.clientWidth; y = w.innerHeight || e.clientHeight || g.clientHeight; }); function makeFaceMove() { var elementAndPositionList = []; // nose var noseProps = { "elementName": ".nose", "props": { "left": (50 + (17.5 * horizSliderVal)).toString() + "%", "top": (40 - (10 * vertSliderVal)).toString() + "%" } } elementAndPositionList.push(noseProps); // eyes var eyeProps = { "elementName": ".eyes", "props": { "left": (50 + (15 * horizSliderVal)).toString() + "%", "top": (50 - (9 * vertSliderVal)).toString() + "%" } } elementAndPositionList.push(eyeProps); var leftEyeProps = { "elementName": ".eye-left", "props": { "left": (2.5 - (5 * horizSliderVal)).toString() + "%", "width": (40 + (5 * horizSliderVal)).toString() + "%" } } elementAndPositionList.push(leftEyeProps); var leftPupilProps = { "elementName": ".pupil-left", "props": { "left": (60 + (10 * horizSliderVal)).toString() + "%", "top": (50 - (20 * vertSliderVal)).toString() + "%", } } elementAndPositionList.push(leftPupilProps); var rightPupilProps = { "elementName": ".pupil-right", "props": { "left": (40 + (10 * horizSliderVal)).toString() + "%", "top": (50 - (20 * vertSliderVal)).toString() + "%", } } elementAndPositionList.push(rightPupilProps); var rightEyeProps = { "elementName": ".eye-right", "props": { "right": (2.5 + (5 * horizSliderVal)).toString() + "%", "width": (40 - (5 * horizSliderVal)).toString() + "%" } } elementAndPositionList.push(rightEyeProps); var glassesBridgeProps = { "elementName": ".bridge", "props": { "left": (50 + (1 * horizSliderVal)).toString() + "%" } } elementAndPositionList.push(glassesBridgeProps); var faceProps = { "elementName": ".face", "props": { "left": (50 + (2 * horizSliderVal)).toString() + "%" } } elementAndPositionList.push(faceProps); var beardProps = { "elementName": ".beard", "props": { "left": (50 + (5 * horizSliderVal)).toString() + "%", "top": (60 - (6 * vertSliderVal)).toString() + "%", "width": (30 - (5 * Math.abs(horizSliderVal))).toString() + "vh", "height": (20 + (3 * vertSliderVal)).toString() + "vh" } } elementAndPositionList.push(beardProps); var mouthProps = { "elementName": ".mouth", "props": { "left": (50 - (1.5 * horizSliderVal)).toString() + "%", "top": (50 - (5 * vertSliderVal)).toString() + "%", "width": (15 - (2.5 * Math.abs(horizSliderVal))).toString() + "vh", "height": (10 - (2.5 * Math.abs(vertSliderVal))).toString() + "vh" } } elementAndPositionList.push(mouthProps); var teethProps = { "elementName": ".teeth", "props": { "left": (50 - (10 * horizSliderVal)).toString() + "%", "top": "-" + (30 + (25 * Math.abs(vertSliderVal))).toString() + "%" } } elementAndPositionList.push(teethProps); var tongueProps = { "elementName": ".tongue", "props": { "left": (50 - (100 * parseFloat(horizSliderVal))).toString() + "%", "top": (50 + (50 * vertSliderVal)).toString() + "%", //"width": (30 - (20 * Math.abs(vertSliderVal))).toString() + "vh" } } elementAndPositionList.push(tongueProps); var earProps = { "elementName": ".ears", "props": { "left": (50 - (2.5 * horizSliderVal)).toString() + "%", "top": (57 + (2.5 * vertSliderVal)).toString() + "%" } } elementAndPositionList.push(earProps); var leftEarProps = { "elementName": ".ear-left", "props": { "left": 2.5 * Math.abs(horizSliderVal).toString() + "%", "width": (10 + (2.5 * horizSliderVal)).toString() + "vh", "height": (15 - (2.5 * Math.abs(vertSliderVal))).toString() + "vh" } } elementAndPositionList.push(leftEarProps); var rightEarProps = { "elementName": ".ear-right", "props": { "right": 2.5 * Math.abs(horizSliderVal).toString() + "%", "width": (10 - (2.5 * horizSliderVal)).toString() + "vh", "height": (15 - (2.5 * Math.abs(vertSliderVal))).toString() + "vh" } } elementAndPositionList.push(rightEarProps); var quiffProps = { "elementName": ".quiff", "props": { "left": (50 - (2.5 * horizSliderVal)).toString() + "%", "height": (10 - (2.5 * vertSliderVal)).toString() + "vh" } } elementAndPositionList.push(quiffProps); var sideburnProps = { "elementName": ".sideburns", "props": { "top": (30 - (4 * vertSliderVal)).toString() + "%" } } elementAndPositionList.push(sideburnProps); var leftSideburnProps = { "elementName": ".sideburn-left", "props": { "border-left-width": (5 + (2.5 * horizSliderVal)).toString() + "vh", //"left" : "-1vh" } } elementAndPositionList.push(leftSideburnProps); var rightSideburnProps = { "elementName": ".sideburn-right", "props": { "border-right-width": (5 - (2.5 * horizSliderVal)).toString() + "vh", } } elementAndPositionList.push(rightSideburnProps); moveElements(elementAndPositionList); }; function moveElements(elementAndPositionList) { for (var i = 0, len = elementAndPositionList.length; i < len; ++i) { var element = document.getElementById(elementAndPositionList[i].elementName); for (var key in elementAndPositionList[i].props) { // console.log(elementAndPositionList[i].elementName); element.css( key, elementAndPositionList[i].props[key] ); } } } window["reddahApi"].loadCompleted()

body, html { margin: 0; padding: 0; width: 100%; height: 100%; min-width: 100%; min-height: 100%; background-color: #184640; } * { box-sizing: border-box; position: absolute; } .lozenge { width: 75vh; height: 75vh; border-style: solid; border-color: #fff; border-width: 2vh; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; background-color: #2b9a9a; } .head { width: 71vh; height: 71vh; } .hair { width: 45vh; height: 50vh; background-color: #5B3914; left: 50%; top: 50%; -webkit-transform: translate(-50%, -65%); transform: translate(-50%, -65%); border-radius: 25vh; } .ears { left: 50%; top: 57%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); height: 15vh; width: 55vh; } .ears .ear { background-color: #F4D7CB; border-radius: 50%; width: 10vh; height: 15vh; -webkit-transform: rotate(-15deg); transform: rotate(-15deg); left: 0; } .ears .ear::before, .ears .ear::after { content: " "; width: 80%; height: 80%; background-color: #DFA59B; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; border-radius: 50%; } .ears .ear::after { width: 50%; height: 50%; background-color: #F4D7CB; left: 50%; top: 40%; -webkit-transform: rotate(15deg); transform: rotate(15deg); } .ears .ear.ear-right { -webkit-transform: rotate(15deg); transform: rotate(15deg); right: 0; left: auto; } .ears .ear.ear-right::after { left: 10%; -webkit-transform: rotate(-15deg); transform: rotate(-15deg); } .face { position: relative; width: 40vh; height: 60vh; background-color: #F4D7CB; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); border-radius: 20vh; border: 2vh solid #5B3914; } .sideburns { left: 50%; top: 30%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 40vh; height: 14vh; position: relative; overflow: hidden; } .sideburns .sideburn { position: absolute; left: 0; top: 0; border-color: transparent; border-left-color: #5B3914; border-style: solid; content: " "; border-width: 5vh 5vh 10vh; -webkit-transform: rotate(-12deg); transform: rotate(-12deg); } .sideburns .sideburn-right { left: auto; right: 0; border-left-color: transparent; border-right-color: #5B3914; -webkit-transform: rotate(12deg); transform: rotate(12deg); } .beard { width: 30vh; height: 20vh; background-color: #5B3914; left: 50%; top: 60%; -webkit-transform: translate(-50%, 5vh); transform: translate(-50%, 5vh); border-radius: 50%; overflow: hidden; } .mouth { position: relative; left: 50%; top: 50%; -webkit-transform: translate(-50%, -40%); transform: translate(-50%, -40%); width: 15vh; height: 10vh; background-color: #7D3126; border-radius: 4vh 4vh 10vh 10vh; overflow: hidden; } .mouth .tongue { background-color: #D96269; width: 30vh; height: 10vh; border-radius: 50%; left: 50%; top: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .mouth .teeth { background-color: #fff; width: 12vh; height: 5vh; left: 50%; top: -30%; border-radius: 5vh; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .eyes { width: 42vh; height: 10vh; left: 50%; top: 50%; -webkit-transform: translate(-50%, -40%); transform: translate(-50%, -40%); } .eyes .bridge { position: absolute; width: 10vh; height: 4vh; content: " "; border: 1vh solid transparent; border-top-color: #3A2117; border-radius: 50%; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .eyes .eye { background-color: rgba(255, 255, 255, 0.4); width: 40%; height: 100%; left: 2.5%; border-radius: 2vh; border: 1vh solid #3A2117; } .eyes .eye .brow { border-color: #5B3914; border-style: solid; content: " "; width: 0; height: 0; position: absolute; left: 0; top: -6vh; border-top-color: transparent; border-left-color: transparent; border-left-width: 14vh; border-bottom-width: 3vh; border-top-width: 0; border-right-width: 0; -webkit-transform: rotate(-8deg); transform: rotate(-8deg); } .eyes .eye .pupil { left: 60%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); background-color: #3A2117; width: 3vh; height: 4vh; border-radius: 50%; -webkit-animation: blinker 5s infinite; animation: blinker 5s infinite; } .eyes .eye.eye-right { left: auto; right: 2.5%; } .eyes .eye.eye-right .brow { border-right-color: transparent; border-right-width: 14vh; border-left-width: 0; border-left-color: #5B3914; -webkit-transform: rotate(8deg); transform: rotate(8deg); left: auto; right: 0; } .eyes .eye.eye-right .brow::before { left: 0; } .eyes .eye.eye-right .pupil { left: 40%; } .nose { left: 50%; top: 40%; -webkit-transform: translate(-50%, 100%); transform: translate(-50%, 100%); background-color: #F98382; width: 10vh; height: 10vh; border-radius: 5vh; } .nose::before { position: absolute; content: " "; border-color: transparent; border-bottom-color: #F98382; border-width: 0 4vh 10vh 4vh; width: 2vh; height: 0; border-style: solid; left: 0%; top: -5.9vh; } .nose::after { position: absolute; background-color: #F98382; content: " "; width: 2vh; height: 2vh; top: -6.8vh; border-radius: 50% 50% 0 0; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .quiff { left: 50%; top: -4vh; -webkit-transform: translateX(-50%); transform: translateX(-50%); width: 20vh; height: 10vh; border-radius: 50%; background-color: #5B3914; } @-webkit-keyframes blinker { 0% { width: 3vh; height: 4vh; } 60% { width: 3vh; height: 4vh; } 61% { width: 5vh; height: 0.1vh; } 63% { width: 3vh; height: 4vh; } 90% { width: 3vh; height: 4vh; } 91% { width: 5vh; height: 0.1vh; } 95% { width: 3vh; height: 4vh; } } @keyframes blinker { 0% { width: 3vh; height: 4vh; } 60% { width: 3vh; height: 4vh; } 61% { width: 5vh; height: 0.1vh; } 63% { width: 3vh; height: 4vh; } 90% { width: 3vh; height: 4vh; } 91% { width: 5vh; height: 0.1vh; } 95% { width: 3vh; height: 4vh; } }
submitted 6 years ago ago by 61ff8469a6da4a44abbcb6d1ad8bbd15
picture
216
220

v1.0

.test{}
submitted 6 years ago ago by 877285a6b9fb4b5cbe9dd43d11700177
picture
Quickstart for MSAL JS

Welcome to MSAL.js Quickstart





    

221

Why Brazil's Jair Bolsonaro has environmentalists worried for the Amazon

picture
picture
The Amazon rainforest is an ecological wonder. Its waterways and canopy provide a rich ecosystem for a 10th of all the world's species and help regulate the temperature of the entire planet.
world submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Existing threats

The forest is being cut down to make way for activities like cattle ranching, soy bean farming, mining, hydropower dams and new highways.

Deforestation fell dramatically between 2004 and 2012, but in recent years it has been increasing, and the powerful agricultural lobby in the Brazilian congress is pushing for more development of the forest. It endorsed Bolsonaro during his election campaign.

A fire burns trees next to grazing land in the Amazon basin on November 22, in Ze Doca, Brazil, 2014. Fires are often set to clear forest for grazing land.

Indigenous lands

Brazil's Ministry of Agriculture is heavily influenced by the agricultural lobby. Soon after taking office this week, Bolsonaro signed an executive order giving the ministry responsibility for certifying indigenous lands as protected territories.

About 13% of Brazil is legally designated as indigenous land, mostly in the Amazon. That land is reserved for the country's 900,000 indigenous people (less than 0.5% of the population). Indigenous groups said the president's order would lead to "an increase in deforestation and violence against indigenous people."

222

var canvas = document.getElementById("canvas"), ctx = canvas.getContext("2d"), img = new Image(), effectEl = document.getElementById("effect"), settings = { radius: 4, intensity: 25, ApplyFilter: function() { doOilPaintEffect(); } } img.addEventListener('load', function() { // reduced the size by half for pen and performance. canvas.width = (this.width / 2); canvas.height = (this.height / 2); ctx.drawImage(this, 0, 0, canvas.width, canvas.height); doOilPaintEffect(); }); img.crossOrigin = "Anonymous"; img.src = "https://wow.techbrood.com/uploads/161001/normal2.jpg"; //var gui = new dat.GUI(); //gui.add(settings, 'intensity'); //gui.add(settings, 'radius'); //gui.add(settings, 'ApplyFilter'); function doOilPaintEffect() { oilPaintEffect(canvas, settings.radius, settings.intensity); } function oilPaintEffect(canvas, radius, intensity) { var width = canvas.width, height = canvas.height, imgData = ctx.getImageData(0, 0, width, height), pixData = imgData.data, // change to createElement getting added element just for the demo destCanvas = document.getElementById("dest-canvas"), dCtx = destCanvas.getContext("2d"), pixelIntensityCount = []; destCanvas.width = width; destCanvas.height = height; var destImageData = dCtx.createImageData(width, height), destPixData = destImageData.data, intensityLUT = [], rgbLUT = []; for (var y = 0; y < height; y++) { intensityLUT[y] = []; rgbLUT[y] = []; for (var x = 0; x < width; x++) { var idx = (y * width + x) * 4, r = pixData[idx], g = pixData[idx + 1], b = pixData[idx + 2], avg = (r + g + b) / 3; intensityLUT[y][x] = Math.round((avg * intensity) / 255); rgbLUT[y][x] = { r: r, g: g, b: b }; } } for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixelIntensityCount = []; // Find intensities of nearest pixels within radius. for (var yy = -radius; yy <= radius; yy++) { for (var xx = -radius; xx <= radius; xx++) { if (y + yy > 0 && y + yy < height && x + xx > 0 && x + xx < width) { var intensityVal = intensityLUT[y + yy][x + xx]; if (!pixelIntensityCount[intensityVal]) { pixelIntensityCount[intensityVal] = { val: 1, r: rgbLUT[y + yy][x + xx].r, g: rgbLUT[y + yy][x + xx].g, b: rgbLUT[y + yy][x + xx].b } } else { pixelIntensityCount[intensityVal].val++; pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r; pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g; pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b; } } } } pixelIntensityCount.sort(function(a, b) { return b.val - a.val; }); var curMax = pixelIntensityCount[0].val, dIdx = (y * width + x) * 4; destPixData[dIdx] = ~~(pixelIntensityCount[0].r / curMax); destPixData[dIdx + 1] = ~~(pixelIntensityCount[0].g / curMax); destPixData[dIdx + 2] = ~~(pixelIntensityCount[0].b / curMax); destPixData[dIdx + 3] = 255; } } // change this to ctx to instead put the data on the original canvas dCtx.putImageData(destImageData, 0, 0); } window["reddahApi"].loadCompleted()

body { text-align: center; background: #ececec; font-family: Tahoma, Geneva, sans-serif } section { display: inline-block } canvas { border: 1px solid #000 }
submitted 6 years ago ago by 1b54d14be50240948fc53b199a461f52
picture

Original

仿PS油画滤镜特效

223

var canvas = document.getElementById("canvas"), ctx = canvas.getContext("2d"), img = new Image(), effectEl = document.getElementById("effect"), settings = { radius: 4, intensity: 25, ApplyFilter: function() { doOilPaintEffect(); } } img.addEventListener('load', function() { // reduced the size by half for pen and performance. canvas.width = (this.width / 2); canvas.height = (this.height / 2); ctx.drawImage(this, 0, 0, canvas.width, canvas.height); doOilPaintEffect(); }); img.crossOrigin = "Anonymous"; img.src = "https://login.reddah.com/uploadPhoto/5a28b388b6db4efea5656f2670acd937_reddah_preview.jpg"; //"https://wow.techbrood.com/uploads/161001/normal2.jpg"; //var gui = new dat.GUI(); //gui.add(settings, 'intensity'); //gui.add(settings, 'radius'); //gui.add(settings, 'ApplyFilter'); function doOilPaintEffect() { oilPaintEffect(canvas, settings.radius, settings.intensity); } function oilPaintEffect(canvas, radius, intensity) { var width = canvas.width, height = canvas.height, imgData = ctx.getImageData(0, 0, width, height), pixData = imgData.data, // change to createElement getting added element just for the demo destCanvas = document.getElementById("dest-canvas"), dCtx = destCanvas.getContext("2d"), pixelIntensityCount = []; destCanvas.width = width; destCanvas.height = height; var destImageData = dCtx.createImageData(width, height), destPixData = destImageData.data, intensityLUT = [], rgbLUT = []; for (var y = 0; y < height; y++) { intensityLUT[y] = []; rgbLUT[y] = []; for (var x = 0; x < width; x++) { var idx = (y * width + x) * 4, r = pixData[idx], g = pixData[idx + 1], b = pixData[idx + 2], avg = (r + g + b) / 3; intensityLUT[y][x] = Math.round((avg * intensity) / 255); rgbLUT[y][x] = { r: r, g: g, b: b }; } } for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixelIntensityCount = []; // Find intensities of nearest pixels within radius. for (var yy = -radius; yy <= radius; yy++) { for (var xx = -radius; xx <= radius; xx++) { if (y + yy > 0 && y + yy < height && x + xx > 0 && x + xx < width) { var intensityVal = intensityLUT[y + yy][x + xx]; if (!pixelIntensityCount[intensityVal]) { pixelIntensityCount[intensityVal] = { val: 1, r: rgbLUT[y + yy][x + xx].r, g: rgbLUT[y + yy][x + xx].g, b: rgbLUT[y + yy][x + xx].b } } else { pixelIntensityCount[intensityVal].val++; pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r; pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g; pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b; } } } } pixelIntensityCount.sort(function(a, b) { return b.val - a.val; }); var curMax = pixelIntensityCount[0].val, dIdx = (y * width + x) * 4; destPixData[dIdx] = ~~(pixelIntensityCount[0].r / curMax); destPixData[dIdx + 1] = ~~(pixelIntensityCount[0].g / curMax); destPixData[dIdx + 2] = ~~(pixelIntensityCount[0].b / curMax); destPixData[dIdx + 3] = 255; } } // change this to ctx to instead put the data on the original canvas dCtx.putImageData(destImageData, 0, 0); } window["reddahApi"].loadCompleted()

body { text-align: center; background: #ececec; font-family: Tahoma, Geneva, sans-serif } section { display: inline-block } canvas { border: 1px solid #000 }
submitted 6 years ago ago by 1b54d14be50240948fc53b199a461f52
picture

Original

仿PS油画滤镜特效

224

var canvas = document.getElementById("canvas"), ctx = canvas.getContext("2d"), img = new Image(), effectEl = document.getElementById("effect"), settings = { radius: 4, intensity: 25, ApplyFilter: function() { doOilPaintEffect(); } } img.addEventListener('load', function() { // reduced the size by half for pen and performance. canvas.width = (this.width / 2); canvas.height = (this.height / 2); ctx.drawImage(this, 0, 0, canvas.width, canvas.height); doOilPaintEffect(); }); img.crossOrigin = "Anonymous"; img.src = "https://login.reddah.com/uploadPhoto/5a28b388b6db4efea5656f2670acd937_reddah_preview.jpg"; //"https://wow.techbrood.com/uploads/161001/normal2.jpg"; //var gui = new dat.GUI(); //gui.add(settings, 'intensity'); //gui.add(settings, 'radius'); //gui.add(settings, 'ApplyFilter'); function doOilPaintEffect() { oilPaintEffect(canvas, settings.radius, settings.intensity); } function oilPaintEffect(canvas, radius, intensity) { var width = canvas.width, height = canvas.height, imgData = ctx.getImageData(0, 0, width, height), pixData = imgData.data, // change to createElement getting added element just for the demo destCanvas = document.getElementById("dest-canvas"), dCtx = destCanvas.getContext("2d"), pixelIntensityCount = []; destCanvas.width = width; destCanvas.height = height; var destImageData = dCtx.createImageData(width, height), destPixData = destImageData.data, intensityLUT = [], rgbLUT = []; for (var y = 0; y < height; y++) { intensityLUT[y] = []; rgbLUT[y] = []; for (var x = 0; x < width; x++) { var idx = (y * width + x) * 4, r = pixData[idx], g = pixData[idx + 1], b = pixData[idx + 2], avg = (r + g + b) / 3; intensityLUT[y][x] = Math.round((avg * intensity) / 255); rgbLUT[y][x] = { r: r, g: g, b: b }; } } for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixelIntensityCount = []; // Find intensities of nearest pixels within radius. for (var yy = -radius; yy <= radius; yy++) { for (var xx = -radius; xx <= radius; xx++) { if (y + yy > 0 && y + yy < height && x + xx > 0 && x + xx < width) { var intensityVal = intensityLUT[y + yy][x + xx]; if (!pixelIntensityCount[intensityVal]) { pixelIntensityCount[intensityVal] = { val: 1, r: rgbLUT[y + yy][x + xx].r, g: rgbLUT[y + yy][x + xx].g, b: rgbLUT[y + yy][x + xx].b } } else { pixelIntensityCount[intensityVal].val++; pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r; pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g; pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b; } } } } pixelIntensityCount.sort(function(a, b) { return b.val - a.val; }); var curMax = pixelIntensityCount[0].val, dIdx = (y * width + x) * 4; destPixData[dIdx] = ~~(pixelIntensityCount[0].r / curMax); destPixData[dIdx + 1] = ~~(pixelIntensityCount[0].g / curMax); destPixData[dIdx + 2] = ~~(pixelIntensityCount[0].b / curMax); destPixData[dIdx + 3] = 255; } } // change this to ctx to instead put the data on the original canvas dCtx.putImageData(destImageData, 0, 0); } window["reddahApi"].loadCompleted()

body { text-align: center; background: #ececec; font-family: Tahoma, Geneva, sans-serif } section { display: inline-block } canvas { border: 1px solid #000 }
submitted 6 years ago ago by 1b54d14be50240948fc53b199a461f52
picture

Original

仿PS油画滤镜特效

225
picture

Franck Ribery: Gold-coated steak backlash earns 'heavy fine'

His meal of gold-coated steak drew ire on social media for being ostentatious, but Franck Ribery's foul-mouthed response earned him a "heavy fine" from his club Bayern Munich.
sport submitted 7 years ago ago by b8c40ad899c64f9a88cfca87d90e5c34
picture

Franck Ribery warms up during the Bayern Munich training camp in Doha.

"He used words that we, FC Bayern, cannot accept and that Franck does not have the right to use, as a role-model and player of FC Bayern."

The statement added Ribery was invited to try the steak as part of an advertising campaign while on holiday in Dubai.

It denied reports he paid 1200 euros for the steak, but added that Ribery and his family were "savagely attacked" on social media before he "publicly "stood up for his family and fought back."

However, talking at the club's training camp in Doha, Salihamidzic said the response was inappropriate.

View more: < Prev Next > or try a Random SubReddah